Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RADI_rFLO_FlimAllocDataBuffers.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 FLD radiation data buffers (send & receive) for
26 ! inter-region 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%valRadi%... = send & receive buffers
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: RADI_rFLO_FlimAllocDataBuffers.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_flimallocdatabuffers( 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 :: sndradieccell, rcvradieccell
73 
74 !******************************************************************************
75 
76  global => regions(ireg)%global
77 
78  CALL registerfunction( global,'RADI_RFLO_FlimAllocDataBuffers',&
79  'RADI_rFLO_FlimAllocDataBuffers.F90' )
80 
81  IF (regions(ireg)%radiInput%radiModel /= radi_model_fldtran) goto 999
82 
83 ! data buffers for patches ----------------------------------------------------
84 
85  ncv = regions(ireg)%radiInput%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%valRadi%sendBuff(ndimsrc),stat=errorflag )
109  ALLOCATE( patch%valRadi%recvBuff(ndim ),stat=errorflag )
110  global%error = errorflag
111  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
112  patch%valRadi%nSendBuff = ndimsrc
113  patch%valRadi%nRecvBuff = ndim
114  global%nRequests = global%nRequests + 1
115  patch%valRadi%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%sndRadiEcCells(global%nRegions),stat=errorflag )
136  ALLOCATE( level%rcvRadiEcCells(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  sndradieccell => regions(ireg)%levels(ilev)%sndRadiEcCells(ir)
144  rcvradieccell => regions(ireg)%levels(ilev)%rcvRadiEcCells(ir)
145  sndradieccell%nCells = sendeccell%nCells
146  rcvradieccell%nCells = recveccell%nCells
147 
148  IF (sndradieccell%nCells > 0) THEN
149  global%nRequests = global%nRequests + 1
150  sndradieccell%iRequest = global%nRequests
151  ALLOCATE( sndradieccell%buff(sndradieccell%nCells*ncv), &
152  stat=errorflag )
153  global%error = errorflag
154  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
155  ENDIF
156  IF (rcvradieccell%nCells > 0) THEN
157  rcvradieccell%iRequest = -999999
158  ALLOCATE( rcvradieccell%buff(rcvradieccell%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 radi_rflo_flimallocdatabuffers
175 
176 !******************************************************************************
177 !
178 ! RCS Revision history:
179 !
180 ! $Log: RADI_rFLO_FlimAllocDataBuffers.F90,v $
181 ! Revision 1.3 2008/12/06 08:44:38 mtcampbe
182 ! Updated license.
183 !
184 ! Revision 1.2 2008/11/19 22:17:50 mtcampbe
185 ! Added Illinois Open Source License/Copyright
186 !
187 ! Revision 1.1 2004/09/30 17:49:10 wasistho
188 ! prepared for full FLD radiation model
189 !
190 !
191 !
192 !******************************************************************************
193 
194 
195 
196 
197 
198 
199 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
Definition: patch.h:74
subroutine radi_rflo_flimallocdatabuffers(regions, iReg)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469