Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_AllocateDataBuffers.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 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%mixt%... = send & receive buffers
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: RFLO_AllocateDataBuffers.F90,v 1.4 2008/12/06 08:44:25 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2001 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE rflo_allocatedatabuffers( regions,iReg )
46 
47  USE moddatatypes
48  USE modbndpatch, ONLY : t_patch
49  USE moddatastruct, ONLY : t_region, t_dcelltransf
50  USE modglobal, ONLY : t_global
51  USE moderror
52  USE modparameters
53  IMPLICIT NONE
54 
55 ! ... parameters
56  TYPE(t_region), POINTER :: regions(:)
57 
58  INTEGER :: ireg
59 
60 ! ... loop variables
61  INTEGER :: ipatch, ilev, ir
62 
63 ! ... local variables
64  INTEGER :: bctype, iregsrc, n1, n2, n1src, n2src, neqs, neqssrc, &
65  ndc, ndcsrc, ndim, ndimsrc, errorflag
66 
67  TYPE(t_patch), POINTER :: patch
68  TYPE(t_global), POINTER :: global
69  TYPE(t_dcelltransf), POINTER :: sendeccell, recveccell
70 
71 !******************************************************************************
72 
73  global => regions(ireg)%global
74 
75  CALL registerfunction( global,'RFLO_AllocateDataBuffers',&
76  'RFLO_AllocateDataBuffers.F90' )
77 
78 ! data buffers for patches
79 
80  DO ilev=1,regions(ireg)%nGridLevels
81  DO ipatch=1,regions(ireg)%nPatches
82 
83  patch => regions(ireg)%levels(ilev)%patches(ipatch)
84  bctype = patch%bcType
85 
86  IF ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
87  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
88  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range)) THEN
89  iregsrc = patch%srcRegion
90  IF (regions(iregsrc)%procid /= global%myProcid) THEN ! other processor
91  n1 = abs(patch%l1end -patch%l1beg ) + 2 ! large enough
92  n2 = abs(patch%l2end -patch%l2beg ) + 2 ! for NODES!
93  n1src = abs(patch%srcL1end-patch%srcL1beg) + 2
94  n2src = abs(patch%srcL2end-patch%srcL2beg) + 2
95  neqs = cv_mixt_neqs ! valid for mixture
96  neqssrc = cv_mixt_neqs ! valid for mixture
97  ndc = regions(ireg )%nDumCells
98  ndcsrc = regions(iregsrc)%nDumCells
99  ndim = n1*n2*neqs*ndc
100  ndimsrc = n1src*n2src*neqssrc*ndcsrc
101  ALLOCATE( patch%mixt%sendBuff(ndimsrc),stat=errorflag )
102  ALLOCATE( patch%mixt%recvBuff(ndim ),stat=errorflag )
103  global%error = errorflag
104  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
105  patch%mixt%nSendBuff = ndimsrc
106  patch%mixt%nRecvBuff = ndim
107  global%nRequests = global%nRequests + 1
108  patch%mixt%iRequest = global%nRequests
109  ENDIF
110  ELSE IF ((bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) .OR. &
111  (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range)) THEN
112  CALL errorstop( global,err_unknown_bc,__line__ ) ! #### TEMPORARY ####
113  ENDIF ! bcType
114 
115  ENDDO ! iPatch
116  ENDDO ! iLev
117 
118 ! data buffers for edge & corner cells
119 
120  IF (global%nProcAlloc > 1) THEN ! only if multiple processors
121 
122  DO ilev=1,regions(ireg)%nGridLevels
123  DO ir=1,global%nRegions
124  sendeccell => regions(ireg)%levels(ilev)%sendEcCells(ir)
125  recveccell => regions(ireg)%levels(ilev)%recvEcCells(ir)
126  IF (sendeccell%nCells > 0) THEN
127  global%nRequests = global%nRequests + 1
128  sendeccell%iRequest = global%nRequests
129  ALLOCATE( sendeccell%buff(sendeccell%nCells*cv_mixt_neqs), &
130  stat=errorflag )
131  global%error = errorflag
132  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
133  ENDIF
134  IF (recveccell%nCells > 0) THEN
135  recveccell%iRequest = -999999
136  ALLOCATE( recveccell%buff(recveccell%nCells*cv_mixt_neqs), &
137  stat=errorflag )
138  global%error = errorflag
139  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
140  ENDIF
141  ENDDO ! ir
142  ENDDO ! iLev
143 
144  ENDIF
145 
146 ! finalize
147 
148  CALL deregisterfunction( global )
149 
150 END SUBROUTINE rflo_allocatedatabuffers
151 
152 !******************************************************************************
153 !
154 ! RCS Revision history:
155 !
156 ! $Log: RFLO_AllocateDataBuffers.F90,v $
157 ! Revision 1.4 2008/12/06 08:44:25 mtcampbe
158 ! Updated license.
159 !
160 ! Revision 1.3 2008/11/19 22:17:36 mtcampbe
161 ! Added Illinois Open Source License/Copyright
162 !
163 ! Revision 1.2 2006/08/19 15:39:25 mparmar
164 ! Renamed patch variables
165 !
166 ! Revision 1.1 2004/11/29 20:51:38 wasistho
167 ! lower to upper case
168 !
169 ! Revision 1.12 2003/05/15 02:57:03 jblazek
170 ! Inlined index function.
171 !
172 ! Revision 1.11 2003/02/14 22:32:36 jblazek
173 ! Finished implementation of corener and edge cells.
174 !
175 ! Revision 1.10 2002/10/12 03:20:50 jblazek
176 ! Replaced [io]stat=global%error with local errorFlag for Rocflo.
177 !
178 ! Revision 1.9 2002/09/27 00:57:10 jblazek
179 ! Changed makefiles - no makelinks needed.
180 !
181 ! Revision 1.8 2002/09/05 17:40:20 jblazek
182 ! Variable global moved into regions().
183 !
184 ! Revision 1.7 2002/03/29 23:15:22 jblazek
185 ! Corrected bug in MPI send.
186 !
187 ! Revision 1.6 2002/03/18 23:11:32 jblazek
188 ! Finished multiblock and MPI.
189 !
190 ! Revision 1.5 2002/02/21 23:25:05 jblazek
191 ! Blocks renamed as regions.
192 !
193 ! Revision 1.4 2002/01/28 23:55:22 jblazek
194 ! Added flux computation (central scheme).
195 !
196 ! Revision 1.3 2002/01/08 22:09:17 jblazek
197 ! Added calculation of face vectors and volumes.
198 !
199 ! Revision 1.2 2001/12/22 00:09:39 jblazek
200 ! Added routines to store grid and solution.
201 !
202 ! Revision 1.1 2001/12/11 21:59:29 jblazek
203 ! memory allocation added.
204 !
205 !******************************************************************************
206 
207 
208 
209 
210 
211 
212 
subroutine rflo_allocatedatabuffers(regions, iReg)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
Definition: patch.h:74
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469