Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_BufferSizeRecv.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: receive buffer size from adjacent regions on different processor.
26 !
27 ! Description: none.
28 !
29 ! Input: regions = data of all regions
30 ! iReg = index of current region.
31 !
32 ! Output: buffer size from other processors.
33 !
34 ! Notes: None.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PLAG_BufferSizeRecv.F90,v 1.5 2009/03/02 00:19:36 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2003 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE plag_buffersizerecv( regions, iReg )
45 
46  USE moddatatypes
47  USE modpartlag, ONLY : t_buffer_plag
48  USE modbndpatch, ONLY : t_patch
49  USE moddatastruct, ONLY : t_region
50  USE modglobal, ONLY : t_global
51  USE modpartlag, ONLY : t_plag
52  USE moderror
53  USE modmpi
54  USE modparameters
55  IMPLICIT NONE
56 
57 ! ... parameters
58  TYPE(t_region), POINTER :: regions(:)
59 
60  INTEGER :: ireg
61 
62 ! ... loop variables
63  INTEGER :: ipatch
64 
65 ! ... local variables
66  CHARACTER(CHRLEN) :: rcsidentstring
67 
68 #ifdef MPI
69  INTEGER :: statusplag(mpi_status_size)
70 #endif
71 
72  INTEGER :: bctype, ilev, ipatchdes, ipatchsrc, iregsrc, &
73  ndimbuffsize, ndv, npatches, ntv, procsrc, tagsrc
74 
75  TYPE(t_patch), POINTER :: patchsrc, patchdes
76  TYPE(t_plag), POINTER :: pplag
77  TYPE(t_global), POINTER :: global
78 
79 !******************************************************************************
80 
81  rcsidentstring = '$RCSfile: PLAG_BufferSizeRecv.F90,v $ $Revision: 1.5 $'
82 
83  global => regions(ireg)%global
84 
85  CALL registerfunction( global,'PLAG_BufferSizeRecv',&
86  'PLAG_BufferSizeRecv.F90' )
87 
88 ! receive buffer size from source to destination region
89 
90 ! get dimensions --------------------------------------------------------------
91 
92  ndimbuffsize = 1
93 
94  ilev = regions(ireg)%currLevel
95  npatches = regions(ireg)%nPatches
96 
97 ! loop over patches -----------------------------------------------------------
98 
99  DO ipatch = 1, npatches
100 
101 ! - pointer is at Des region getting data from Src region ---------------------
102 
103  patchdes => regions(ireg)%levels(ilev)%patches(ipatch)
104 
105  bctype = patchdes%bcType
106  iregsrc = patchdes%srcRegion
107  ipatchsrc = patchdes%srcPatch
108 
109 ! - region interface for various boundary conditions --------------------------
110 
111  IF ( (bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
112  (bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) .OR. &
113  (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) .OR. &
114  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
115  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range) ) THEN
116 
117  IF ( regions(iregsrc)%procid /= global%myProcid ) THEN
118  patchsrc => regions(iregsrc)%levels(ilev)%patches(ipatchsrc)
119 
120 #ifdef MPI
121  procsrc = regions(iregsrc)%procid
122  tagsrc = regions(ireg)%localNumber &
123  + plag_tag_shift +mpi_patchoff*patchsrc%srcPatch*ireg &
124  + global%myProcid
125 
126  IF(tagsrc .gt. global%mpiTagMax) tagsrc = mod(tagsrc,global%mpiTagMax)
127 
128  CALL mpi_recv( patchdes%bufferPlag%nBuffSizeDes, &
129  ndimbuffsize,mpi_integer, &
130  procsrc,tagsrc,global%mpiComm,statusplag,global%mpierr )
131 
132  IF (global%mpierr /= err_none) &
133  CALL errorstop( global,err_mpi_trouble,__line__ )
134 
135 #ifdef PLAG_MPI_DEBUG
136  IF ( patchdes%bufferPlag%nBuffSizeDes /= 0 ) &
137  WRITE(stdout,*) ' PLAG_BufferSizeRecv: iRegDes, iRegSrc, procSrc, tagSrc, nBuffSizeDes = ',&
138  ireg, iregsrc, procsrc,tagsrc, patchdes%bufferPlag%nBuffSizeDes
139 #endif
140 
141 #endif
142 
143  ENDIF ! regions
144  ENDIF ! bcType
145 
146  ENDDO ! iPatch
147 
148 ! finalize --------------------------------------------------------------------
149 
150  CALL deregisterfunction( global )
151 
152 END SUBROUTINE plag_buffersizerecv
153 
154 !******************************************************************************
155 !
156 ! RCS Revision history:
157 !
158 ! $Log: PLAG_BufferSizeRecv.F90,v $
159 ! Revision 1.5 2009/03/02 00:19:36 mtcampbe
160 ! Added some ifdefs around Rocflo to disable particle injection on INFLOW
161 ! boundaries and added some checks around MPI tags utilizing a new global
162 ! data item, global%mpiTagMax.
163 !
164 ! Revision 1.4 2008/12/06 08:44:32 mtcampbe
165 ! Updated license.
166 !
167 ! Revision 1.3 2008/11/19 22:17:45 mtcampbe
168 ! Added Illinois Open Source License/Copyright
169 !
170 ! Revision 1.2 2006/04/07 15:19:23 haselbac
171 ! Removed tabs
172 !
173 ! Revision 1.1 2004/12/01 20:56:57 fnajjar
174 ! Initial revision after changing case
175 !
176 ! Revision 1.12 2004/04/09 23:05:54 fnajjar
177 ! Added IF statement to activate only for non-null buffer size
178 !
179 ! Revision 1.11 2004/03/21 00:43:32 fnajjar
180 ! Fixed tags to be smaller number since Frost run-time system complains about size
181 !
182 ! Revision 1.10 2004/03/06 21:25:05 fnajjar
183 ! Added PLAG_TAG_SHIFT to MPI-based communication tags
184 !
185 ! Revision 1.9 2003/05/07 00:15:05 fnajjar
186 ! Included I/O within ifdef PLAG_MPI_DEBUG construct
187 !
188 ! Revision 1.8 2003/01/24 23:10:15 f-najjar
189 ! Added to tagSrc and tagDes procId for Des region to avoid tag collision
190 !
191 ! Revision 1.7 2003/01/24 22:46:14 f-najjar
192 ! Moved WRITE statement and included nBuffSizeDes in writeup for testing
193 !
194 ! Revision 1.6 2003/01/24 22:37:30 f-najjar
195 ! Made tagSrc less prone to tag collision by multiplying by iReg
196 !
197 ! Revision 1.5 2003/01/24 22:33:35 f-najjar
198 ! Used generic ERR_NONE for MPI error trapping
199 !
200 ! Revision 1.4 2003/01/24 22:31:03 f-najjar
201 ! Changed call MPI_Irecv to MPI_Recv
202 !
203 ! Revision 1.3 2003/01/23 18:49:13 f-najjar
204 ! Bug fix for WRITE statement
205 !
206 ! Revision 1.2 2003/01/23 17:51:34 f-najjar
207 ! Add ModMPI for MPI communication
208 !
209 ! Revision 1.1 2003/01/23 17:30:39 f-najjar
210 ! Initial import for MPI
211 !
212 !******************************************************************************
213 
214 
215 
216 
217 
218 
219 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine plag_buffersizerecv(regions, iReg)