Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PERI_AllocateMemory.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 memory for all variables associated with rocperi
26 ! for all active regions on current processor.
27 !
28 ! Description: none.
29 !
30 ! Input: region = info of current region data
31 !
32 ! Output: region%peri = info of current rocperi data
33 !
34 ! Notes: none
35 !
36 !******************************************************************************
37 !
38 ! $Id: PERI_AllocateMemory.F90,v 1.6 2008/12/06 08:44:36 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2001 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE peri_allocatememory( region ) ! PUBLIC
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY : t_region
48  USE modglobal, ONLY : t_global
49 #ifdef RFLO
51 
52 #include "Indexing.h"
53 #endif
54  USE modperiodic, ONLY : t_peri
55  USE moderror
56  USE modparameters
58  IMPLICIT NONE
59 
60 ! ... parameters
61  TYPE(t_region), TARGET :: region
62 
63 ! ... loop variables
64  INTEGER :: ilev
65 
66 ! ... local variables
67  CHARACTER(CHRLEN) :: rcsidentstring
68  TYPE(t_global), POINTER :: global
69  TYPE(t_peri), POINTER :: peri
70 
71  INTEGER :: nsndvar, ibc, iec, ncv, errfl
72 #ifdef RFLO
73  INTEGER :: idcbeg, idcend, jdcbeg, jdcend, kdcbeg, kdcend
74  INTEGER :: jdc, icoff, ijcoff
75 #endif
76 
77 !******************************************************************************
78 
79  rcsidentstring = '$RCSfile: PERI_AllocateMemory.F90,v $'
80 
81  global => region%global
82  CALL registerfunction( global,'PERI_AllocateMemory',&
83  'PERI_AllocateMemory.F90' )
84 
85 #ifdef RFLO
86 
87 ! get variables and pointers --------------------------------------
88 
89 ! loop over all grid levels
90 
91  DO ilev=1,region%nGridLevels
92 
93  peri => region%levels(ilev)%peri
94 
95 ! - get cell and node dimensions ----------------------------------
96 
97  CALL rflo_getdimensdummy( region,ilev,idcbeg,idcend, &
98  jdcbeg,jdcend,kdcbeg,kdcend )
99  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
100  ibc = indijk(idcbeg,jdcbeg,kdcbeg,icoff,ijcoff)
101  iec = indijk(idcend,jdcend,kdcend,icoff,ijcoff)
102 #endif
103 #ifdef RFLU
104 ! - get variables and pointers ----------------------------------------
105 
106 ! - get cell and node dimensions --------------------------------------
107  ibc = 1
108  iec = region%grid%nCellsTot
109 #endif
110 
111 ! - PERI derived variables
112 
113  IF (region%periInput%flowKind /= peri_flow_none) THEN
114  nsndvar = region%periInput%nVar + gas_nvar
115  ncv = cv_mixt_neqs
116 #ifdef RFLO
117  jdc = jdcend-jdcbeg+1
118  ALLOCATE( peri%varSend(jdc,nsndvar),stat=errfl ); IF (errfl>0) goto 88
119  ALLOCATE( peri%varRecv(jdc,nsndvar),stat=errfl ); IF (errfl>0) goto 88
120  ALLOCATE( peri%cvMean(jdc,ncv),stat=errfl ); IF (errfl>0) goto 88
121 #endif
122 #ifdef RFLU
123  ALLOCATE( peri%varSend(iec,nsndvar),stat=errfl ); IF (errfl>0) goto 88
124  ALLOCATE( peri%varRecv(iec,nsndvar),stat=errfl ); IF (errfl>0) goto 88
125  ALLOCATE( peri%cvMean(iec,ncv),stat=errfl ); IF (errfl>0) goto 88
126 #endif
127  ELSE
128  nullify( peri%varSend, peri%varRecv )
129  ENDIF
130 
131  IF (region%periInput%flowKind == peri_flow_cpr) THEN
132 #ifdef RFLO
133  ALLOCATE( peri%cprVar(cpr_ncomp,jdcbeg:jdcend),stat=errfl )
134  IF (errfl>0) goto 88
135 #endif
136 #ifdef RFLU
137  ALLOCATE( peri%cprVar(cpr_ncomp,iec),stat=errfl )
138  IF (errfl>0) goto 88
139 #endif
140  ELSE
141  nullify( peri%cprVar )
142  ENDIF
143 
144 #ifdef RFLO
145  ENDDO !iLev
146 #endif
147 
148  goto 999
149 
150 ! finalize ----------------------------------------------------------
151 
152 88 CONTINUE
153 
154  global%error = errfl
155  CALL errorstop( global,err_allocate,__line__ )
156 
157 999 CONTINUE
158 
159  CALL deregisterfunction( global )
160 
161 END SUBROUTINE peri_allocatememory
162 
163 !******************************************************************************
164 !
165 ! RCS Revision history:
166 !
167 ! $Log: PERI_AllocateMemory.F90,v $
168 ! Revision 1.6 2008/12/06 08:44:36 mtcampbe
169 ! Updated license.
170 !
171 ! Revision 1.5 2008/11/19 22:17:48 mtcampbe
172 ! Added Illinois Open Source License/Copyright
173 !
174 ! Revision 1.4 2005/03/07 05:06:42 wasistho
175 ! install hybrid DESSA turbulence model
176 !
177 ! Revision 1.3 2004/06/17 20:02:54 wasistho
178 ! compiled with RFLU
179 !
180 ! Revision 1.2 2004/06/11 21:49:40 wasistho
181 ! prepared for RFLU
182 !
183 ! Revision 1.1 2004/06/08 23:56:56 wasistho
184 ! changed nomenclature
185 !
186 ! Revision 1.3 2003/08/29 01:40:05 wasistho
187 ! Added TARGET attribute to region variable, since pointers are cached into it
188 !
189 ! Revision 1.2 2003/05/15 02:57:05 jblazek
190 ! Inlined index function.
191 !
192 ! Revision 1.1.1.1 2003/03/29 03:36:30 wasistho
193 ! install ROCPERI
194 !
195 !
196 !******************************************************************************
197 
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
208 
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE idcend
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine peri_allocatememory(region)
subroutine rflo_getdimensdummy(region, iLev, idcbeg, idcend, jdcbeg, jdcend, kdcbeg, kdcend)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE kdcbeg
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE idcbeg
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE jdcend
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE jdcbeg
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469