Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RADI_rFLO_FlimClearSendRequests.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: wait until FLD radiation data is received by other processors
26 ! communicating with the current region
27 !
28 ! Description: none.
29 !
30 ! Input: regions = all regions
31 ! iReg = current region
32 !
33 ! Output: none.
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: RADI_rFLO_FlimClearSendRequests.F90,v 1.3 2008/12/06 08:44:38 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2003 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE radi_rflo_flimclearsendrequests( regions,iReg ) ! PUBLIC
46 
47  USE moddatatypes
48  USE modbndpatch, ONLY : t_patch
49  USE moddatastruct, ONLY : t_region
50  USE modglobal, ONLY : t_global
51  USE moderror
52  USE modmpi
53  USE modparameters
55  IMPLICIT NONE
56 
57 ! ... parameters
58  TYPE(t_region), POINTER :: regions(:)
59 
60  INTEGER, INTENT(IN) :: ireg
61 
62 ! ... loop variables
63  INTEGER :: ipatch, ir
64 
65 ! ... local variables
66  INTEGER :: ilev, npatches, bctype, iregsrc, irequest
67 #ifdef MPI
68  INTEGER :: status(mpi_status_size)
69 #endif
70 
71  LOGICAL dowait
72 
73  TYPE(t_patch), POINTER :: patch
74  TYPE(t_global), POINTER :: global
75 
76 !******************************************************************************
77 
78  global => regions(1)%global
79 
80  CALL registerfunction( global,'RADI_RFLO_FlimClearSendRequests',&
81  'RADI_rFLO_FlimClearSendRequests.F90' )
82 
83  IF (regions(ireg)%radiInput%radiModel /= radi_model_fldtran) goto 999
84 
85 #ifdef MPI
86 ! get dimensions --------------------------------------------------------------
87 
88  ilev = regions(ireg)%currLevel
89  npatches = regions(ireg)%nPatches
90 
91 ! wait for patch data being received by other processors ----------------------
92 
93  DO ipatch=1,npatches
94 
95  patch => regions(ireg)%levels(ilev)%patches(ipatch)
96 
97  bctype = patch%bcType
98  iregsrc = patch%srcRegion
99  irequest = patch%valRadi%iRequest
100 
101 ! - region interface, periodic boundary
102 
103  dowait = ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
104  (bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) .OR. &
105  (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) .OR. &
106  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
107  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range))
108 
109  IF (iregsrc > 0) THEN
110  IF (dowait .AND. (regions(iregsrc)%procid /= global%myProcid)) THEN
111  CALL mpi_wait( global%requests(irequest), status, global%mpierr )
112  IF (global%mpierr /= err_none) &
113  CALL errorstop( global,err_mpi_trouble,__line__ )
114  ENDIF
115  ENDIF
116 
117  ENDDO ! iPatch
118 
119 ! wait for edges & corners being received by other processors -----------------
120 
121  IF (global%nProcAlloc>1) THEN
122  DO ir=1,global%nRegions
123  IF (regions(ireg)%levels(ilev)%sndRadiEcCells(ir)%nCells > 0) THEN
124  irequest = regions(ireg)%levels(ilev)%sndRadiEcCells(ir)%iRequest
125  CALL mpi_wait( global%requests(irequest),status,global%mpierr )
126  IF (global%mpierr /= 0) CALL errorstop( global,err_mpi_trouble,__line__ )
127  ENDIF
128  ENDDO
129  ENDIF
130 #endif
131 
132 ! finalize --------------------------------------------------------------------
133 
134 999 CONTINUE
135 
136  CALL deregisterfunction( global )
137 
138 END SUBROUTINE radi_rflo_flimclearsendrequests
139 
140 !******************************************************************************
141 !
142 ! RCS Revision history:
143 !
144 ! $Log: RADI_rFLO_FlimClearSendRequests.F90,v $
145 ! Revision 1.3 2008/12/06 08:44:38 mtcampbe
146 ! Updated license.
147 !
148 ! Revision 1.2 2008/11/19 22:17:50 mtcampbe
149 ! Added Illinois Open Source License/Copyright
150 !
151 ! Revision 1.1 2004/09/30 17:49:10 wasistho
152 ! prepared for full FLD radiation model
153 !
154 !
155 !
156 !******************************************************************************
157 
158 
159 
160 
161 
162 
163 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
Definition: patch.h:74
subroutine radi_rflo_flimclearsendrequests(regions, iReg)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469