Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_rFLO_RansClearSendRequests.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 RaNS data is received by other processors communicating
26 ! 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: TURB_rFLO_RansClearSendRequests.F90,v 1.4 2008/12/06 08:44:45 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2003 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE turb_rflo_ransclearsendrequests( 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
52  USE moderror
53  USE modmpi
54  USE modparameters
56  IMPLICIT NONE
57 
58 ! ... parameters
59  TYPE(t_region), POINTER :: regions(:)
60 
61  INTEGER, INTENT(IN) :: ireg
62 
63 ! ... loop variables
64  INTEGER :: ipatch, ir
65 
66 ! ... local variables
67  INTEGER :: ilev, npatches, bctype, iregsrc, irequest
68 #ifdef MPI
69  INTEGER :: status(mpi_status_size)
70 #endif
71 
72  LOGICAL dowait
73 
74  TYPE(t_patch), POINTER :: patch
75  TYPE(t_global), POINTER :: global
76 
77 !******************************************************************************
78 
79  global => regions(1)%global
80 
81  CALL registerfunction( global,'TURB_RFLO_RansClearSendRequests',&
82  'TURB_rFLO_RansClearSendRequests.F90' )
83 
84  IF (regions(ireg)%turbInput%modelClass /= model_rans) goto 999
85 
86 #ifdef MPI
87 ! get dimensions --------------------------------------------------------------
88 
89  ilev = regions(ireg)%currLevel
90  npatches = regions(ireg)%nPatches
91 
92 ! wait for patch data being received by other processors ----------------------
93 
94  DO ipatch=1,npatches
95 
96  patch => regions(ireg)%levels(ilev)%patches(ipatch)
97 
98  bctype = patch%bcType
99  iregsrc = patch%srcRegion
100  irequest = patch%turb%iRequest
101 
102 ! - region interface, periodic boundary
103 
104  dowait = ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
105  (bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) .OR. &
106  (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) .OR. &
107  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
108  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range))
109 
110  IF (iregsrc > 0) THEN
111  IF (dowait .AND. (regions(iregsrc)%procid /= global%myProcid)) THEN
112  CALL mpi_wait( global%requests(irequest), status, global%mpierr )
113  IF (global%mpierr /= err_none) &
114  CALL errorstop( global,err_mpi_trouble,__line__ )
115  ENDIF
116  ENDIF
117 
118  ENDDO ! iPatch
119 
120 ! wait for edges & corners being received by other processors -----------------
121 
122  IF (global%nProcAlloc>1) THEN
123  DO ir=1,global%nRegions
124  IF (regions(ireg)%levels(ilev)%sndTurbEcCells(ir)%nCells > 0) THEN
125  irequest = regions(ireg)%levels(ilev)%sndTurbEcCells(ir)%iRequest
126  CALL mpi_wait( global%requests(irequest),status,global%mpierr )
127  IF (global%mpierr /= 0) CALL errorstop( global,err_mpi_trouble,__line__ )
128  ENDIF
129  ENDDO
130  ENDIF
131 #endif
132 
133 ! get mu_t and kappa_t from tilde[nu]
134 
135  CALL turb_ranssageteddyvis( regions(ireg) )
136 
137 ! finalize --------------------------------------------------------------------
138 
139 999 CONTINUE
140 
141  CALL deregisterfunction( global )
142 
143 END SUBROUTINE turb_rflo_ransclearsendrequests
144 
145 !******************************************************************************
146 !
147 ! RCS Revision history:
148 !
149 ! $Log: TURB_rFLO_RansClearSendRequests.F90,v $
150 ! Revision 1.4 2008/12/06 08:44:45 mtcampbe
151 ! Updated license.
152 !
153 ! Revision 1.3 2008/11/19 22:17:56 mtcampbe
154 ! Added Illinois Open Source License/Copyright
155 !
156 ! Revision 1.2 2006/08/19 15:40:54 mparmar
157 ! Renamed patch variables
158 !
159 ! Revision 1.1 2004/03/11 03:26:33 wasistho
160 ! changed rocturb nomenclature
161 !
162 ! Revision 1.1 2004/03/08 23:35:45 wasistho
163 ! changed turb nomenclature
164 !
165 ! Revision 1.2 2004/01/23 00:33:41 wasistho
166 ! added clear-send-request of RaNS edge/corner variables
167 !
168 ! Revision 1.1 2003/10/07 02:17:03 wasistho
169 ! initial installation of RaNS-SA and DES
170 !
171 !
172 !******************************************************************************
173 
174 
175 
176 
177 
178 
179 
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 turb_ranssageteddyvis(region)
subroutine turb_rflo_ransclearsendrequests(regions, iReg)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469