Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_rFLO_RansAllocDataBuffers.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: allocate RaNS data buffers (send & receive) for inter-region
26 ! communication (mixture only).
27 !
28 ! Description: none.
29 !
30 ! Input: regions = data of all regions
31 ! iReg = region number
32 !
33 ! Output: regions%levels%patches%turb%... = send & receive buffers
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: TURB_rFLO_RansAllocDataBuffers.F90,v 1.4 2008/12/06 08:44:44 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2003 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE turb_rflo_ransallocdatabuffers( regions,iReg ) ! PUBLIC
46 
47  USE moddatatypes
48  USE modbndpatch, ONLY : t_patch
49  USE moddatastruct, ONLY : t_region, t_level, t_dcelltransf
50  USE modglobal, ONLY : t_global
51  USE moderror
52  USE modparameters
54  IMPLICIT NONE
55 
56 ! ... parameters
57  TYPE(t_region), POINTER :: regions(:)
58 
59  INTEGER :: ireg
60 
61 ! ... loop variables
62  INTEGER :: ipatch, ilev, ir
63 
64 ! ... local variables
65  INTEGER :: bctype, iregsrc, n1, n2, n1src, n2src, neqs, neqssrc, &
66  ndc, ndcsrc, ndim, ndimsrc, ncv, errorflag
67 
68  TYPE(t_patch), POINTER :: patch
69  TYPE(t_global), POINTER :: global
70  TYPE(t_level), POINTER :: level
71  TYPE(t_dcelltransf), POINTER :: sendeccell, recveccell
72  TYPE(t_dcelltransf), POINTER :: sndturbeccell, rcvturbeccell
73 
74 !******************************************************************************
75 
76  global => regions(ireg)%global
77 
78  CALL registerfunction( global,'TURB_RFLO_RansAllocDataBuffers',&
79  'TURB_rFLO_RansAllocDataBuffers.F90' )
80 
81  IF (regions(ireg)%turbInput%modelClass /= model_rans) goto 999
82 
83 ! data buffers for patches ----------------------------------------------------
84 
85  ncv = regions(ireg)%turbInput%nCv
86 
87  DO ilev=1,regions(ireg)%nGridLevels
88  DO ipatch=1,regions(ireg)%nPatches
89 
90  patch => regions(ireg)%levels(ilev)%patches(ipatch)
91  bctype = patch%bcType
92 
93  IF ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
94  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
95  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range)) THEN
96  iregsrc = patch%srcRegion
97  IF (regions(iregsrc)%procid /= global%myProcid) THEN ! other processor
98  n1 = abs(patch%l1end -patch%l1beg ) + 2 ! large enough
99  n2 = abs(patch%l2end -patch%l2beg ) + 2 ! for NODES!
100  n1src = abs(patch%srcL1end-patch%srcL1beg) + 2
101  n2src = abs(patch%srcL2end-patch%srcL2beg) + 2
102  neqs = ncv
103  neqssrc = ncv
104  ndc = regions(ireg )%nDumCells
105  ndcsrc = regions(iregsrc)%nDumCells
106  ndim = n1*n2*neqs*ndc
107  ndimsrc = n1src*n2src*neqssrc*ndcsrc
108  ALLOCATE( patch%turb%sendBuff(ndimsrc),stat=errorflag )
109  ALLOCATE( patch%turb%recvBuff(ndim ),stat=errorflag )
110  global%error = errorflag
111  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
112  patch%turb%nSendBuff = ndimsrc
113  patch%turb%nRecvBuff = ndim
114  global%nRequests = global%nRequests + 1
115  patch%turb%iRequest = global%nRequests
116  ENDIF
117  ELSE IF ((bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) .OR. &
118  (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range)) THEN
119  CALL errorstop( global,err_unknown_bc,__line__ ) ! #### TEMPORARY ####
120  ENDIF ! bcType
121 
122  ENDDO ! iPatch
123  ENDDO ! iLev
124 
125 ! data buffers for edge & corner cells
126 
127  IF (global%nProcAlloc > 1) THEN ! only if multiple processors
128 
129  DO ilev=1,regions(ireg)%nGridLevels
130 
131 ! --- allocate send and receive region data
132 
133  level => regions(ireg)%levels(ilev)
134 
135  ALLOCATE( level%sndTurbEcCells(global%nRegions),stat=errorflag )
136  ALLOCATE( level%rcvTurbEcCells(global%nRegions),stat=errorflag )
137  global%error = errorflag
138  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
139 
140  DO ir=1,global%nRegions
141  sendeccell => regions(ireg)%levels(ilev)%sendEcCells(ir)
142  recveccell => regions(ireg)%levels(ilev)%recvEcCells(ir)
143  sndturbeccell => regions(ireg)%levels(ilev)%sndTurbEcCells(ir)
144  rcvturbeccell => regions(ireg)%levels(ilev)%rcvTurbEcCells(ir)
145  sndturbeccell%nCells = sendeccell%nCells
146  rcvturbeccell%nCells = recveccell%nCells
147 
148  IF (sndturbeccell%nCells > 0) THEN
149  global%nRequests = global%nRequests + 1
150  sndturbeccell%iRequest = global%nRequests
151  ALLOCATE( sndturbeccell%buff(sndturbeccell%nCells*ncv), &
152  stat=errorflag )
153  global%error = errorflag
154  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
155  ENDIF
156  IF (rcvturbeccell%nCells > 0) THEN
157  rcvturbeccell%iRequest = -999999
158  ALLOCATE( rcvturbeccell%buff(rcvturbeccell%nCells*ncv), &
159  stat=errorflag )
160  global%error = errorflag
161  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
162  ENDIF
163  ENDDO ! ir
164  ENDDO ! iLev
165 
166  ENDIF
167 
168 ! finalize
169 
170 999 CONTINUE
171 
172  CALL deregisterfunction( global )
173 
174 END SUBROUTINE turb_rflo_ransallocdatabuffers
175 
176 !******************************************************************************
177 !
178 ! RCS Revision history:
179 !
180 ! $Log: TURB_rFLO_RansAllocDataBuffers.F90,v $
181 ! Revision 1.4 2008/12/06 08:44:44 mtcampbe
182 ! Updated license.
183 !
184 ! Revision 1.3 2008/11/19 22:17:56 mtcampbe
185 ! Added Illinois Open Source License/Copyright
186 !
187 ! Revision 1.2 2006/08/19 15:40:53 mparmar
188 ! Renamed patch variables
189 !
190 ! Revision 1.1 2004/03/11 03:26:33 wasistho
191 ! changed rocturb nomenclature
192 !
193 ! Revision 1.1 2004/03/08 23:35:45 wasistho
194 ! changed turb nomenclature
195 !
196 ! Revision 1.2 2004/01/23 00:27:58 wasistho
197 ! add data allocations for RaNS variables at edge and corners
198 !
199 ! Revision 1.1 2003/10/07 02:17:02 wasistho
200 ! initial installation of RaNS-SA and DES
201 !
202 !
203 !******************************************************************************
204 
205 
206 
207 
208 
209 
210 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine turb_rflo_ransallocdatabuffers(regions, iReg)
Definition: patch.h:74
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469