OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_exchange_grad.F
Go to the documentation of this file.
1Copyright> OpenRadioss
2Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3Copyright>
4Copyright> This program is free software: you can redistribute it and/or modify
5Copyright> it under the terms of the GNU Affero General Public License as published by
6Copyright> the Free Software Foundation, either version 3 of the License, or
7Copyright> (at your option) any later version.
8Copyright>
9Copyright> This program is distributed in the hope that it will be useful,
10Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12Copyright> GNU Affero General Public License for more details.
13Copyright>
14Copyright> You should have received a copy of the GNU Affero General Public License
15Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16Copyright>
17Copyright>
18Copyright> Commercial Alternative: Altair Radioss Software
19Copyright>
20Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21Copyright> software under a commercial license. Contact Altair to discuss further if the
22Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23!||====================================================================
24!|| spmd_exchange_grad ../engine/source/mpi/fluid/spmd_exchange_grad.F
25!||--- called by ------------------------------------------------------
26!|| ale51_gradient_reconstruction ../engine/source/ale/alemuscl/ale51_gradient_reconstruction.F
27!|| ale51_gradient_reconstruction2 ../engine/source/ale/alemuscl/ale51_gradient_reconstruction2.F
28!||--- calls -----------------------------------------------------
29!||--- uses -----------------------------------------------------
30!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
31!||====================================================================
32 SUBROUTINE spmd_exchange_grad(DIM,DIM1,DIM2,
33 1 PHI ,NERCVOIS,NESDVOIS,LERCVOIS,
34 2 LESDVOIS,LENCOM )
35C-----------------------------------------------
36C I m p l i c i t T y p e s
37C-----------------------------------------------
38 USE spmd_comm_world_mod, ONLY : spmd_comm_world
39#include "implicit_f.inc"
40#include "macro.inc"
41C-----------------------------------------------
42C M e s s a g e P a s s i n g
43C-----------------------------------------------
44#include "spmd.inc"
45C-----------------------------------------------
46C C o m m o n B l o c k s
47C-----------------------------------------------
48#include "com01_c.inc"
49#include "task_c.inc"
50#include "tabsiz_c.inc"
51C-----------------------------------------------
52C D u m m y A r g u m e n t s
53C-----------------------------------------------
54 INTEGER, INTENT(IN) :: DIM,DIM1,DIM2,LENCOM
55 INTEGER, INTENT(IN) :: NERCVOIS(SNERCVOIS), NESDVOIS(SNESDVOIS)
56 INTEGER, INTENT(IN) :: LERCVOIS(SLERCVOIS), LESDVOIS(SLESDVOIS)
57 my_real, DIMENSION(DIM1,DIM2), INTENT(INOUT) :: phi
58C-----------------------------------------------
59C L o c a l V a r i a b l e s
60C-----------------------------------------------
61#ifdef MPI
62 INTEGER I, NDIM, IDEB, IDEB2, MSGOFF, IERROR,MSGTYP,IAD_RECV(NSPMD),
63 . STATUS(MPI_STATUS_SIZE), REQ_S(NSPMD), REQ_R(NSPMD),
64 . loc_proc, n, nn, nbirecv, irindex(nspmd), ii, index,
65 . len
66 DATA msgoff/3004/
68 . wa(dim, lencom)
69C-----------------------------------------------
70C
71C Updating Phi on adjacent elements
72C
73
74 loc_proc = ispmd+1
75 ideb = 0
76 ideb2 = 0
77 nbirecv = 0
78 DO i = 1, nspmd
79 msgtyp = msgoff
80 iad_recv(i) = ideb2+1
81 IF(nercvois(i)>0) THEN
82 nbirecv = nbirecv + 1
83 irindex(nbirecv) = i
84 len = nercvois(i)
85 CALL mpi_irecv(
86 s wa(1,ideb2+1),len*dim,real,it_spmd(i),msgtyp,
87 g spmd_comm_world,req_r(nbirecv),ierror)
88 ideb2 = ideb2 + len
89 ENDIF
90 ENDDO
91C
92 ideb = 0
93 DO i = 1, nspmd
94 msgtyp = msgoff
95 len = nesdvois(i)
96 IF(len>0) THEN
97 DO n = 1, len
98 nn = lesdvois(ideb+n)
99 DO ndim = 1, dim
100 wa(ndim,ideb2+n) = phi(nn,ndim) ! nn,dim
101 ENDDO
102 ENDDO
103 CALL mpi_isend(
104 s wa(1,ideb2+1),len*dim,real,it_spmd(i),msgtyp,
105 g spmd_comm_world,req_s(i),ierror)
106 ideb = ideb + len
107 ideb2 = ideb2 + len
108 ENDIF
109 ENDDO
110C
111 DO ii = 1, nbirecv
112 CALL mpi_waitany(nbirecv,req_r,index,status,ierror)
113 i = irindex(index)
114 ideb = iad_recv(i)-1
115 DO n = 1, nercvois(i)
116 nn = lercvois(ideb+n)
117 DO ndim = 1, dim
118 phi(nn,ndim) = wa(ndim,ideb+n)
119 ENDDO
120 ENDDO
121 ENDDO
122C
123 DO i = 1, nspmd
124 IF(nesdvois(i)>0) THEN
125 CALL mpi_wait(req_s(i),status,ierror)
126 ENDIF
127 ENDDO
128C
129
130#endif
131 RETURN
132 END SUBROUTINE spmd_exchange_grad
#define my_real
Definition cppsort.cpp:32
subroutine mpi_isend(buf, cnt, datatype, dest, tag, comm, ireq, ierr)
Definition mpi.f:382
subroutine mpi_wait(ireq, status, ierr)
Definition mpi.f:525
subroutine mpi_waitany(cnt, array_of_requests, index, status, ierr)
Definition mpi.f:549
subroutine mpi_irecv(buf, cnt, datatype, source, tag, comm, ireq, ierr)
Definition mpi.f:372
subroutine spmd_exchange_grad(dim, dim1, dim2, phi, nercvois, nesdvois, lercvois, lesdvois, lencom)