Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_AllocateMemoryTile.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 variables associated with Tile datastructure
26 ! for current region.
27 !
28 ! Description: none.
29 !
30 ! Input: region = current region
31 !
32 ! Output: region%levels%patch%tilePlag = Tileplag variables
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PLAG_AllocateMemoryTile.F90,v 1.3 2008/12/06 08:44:32 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2002 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE plag_allocatememorytile( region )
45 
46  USE moddatatypes
47  USE modpartlag, ONLY : t_plag_input, t_tile_plag
48  USE modbndpatch, ONLY : t_patch
49  USE moddatastruct, ONLY : t_region, t_level
50  USE modglobal, ONLY : t_global
51  USE moderror
52  USE modparameters
53  USE modmpi
55  IMPLICIT NONE
56 
57 ! ... parameters
58  TYPE(t_region) :: region
59 
60 ! ... loop variables
61  INTEGER :: icont, ilev, ipatch
62 
63 ! ... local variables
64  CHARACTER(CHRLEN) :: rcsidentstring
65 
66  INTEGER :: bctype, errorflag, n1, n2, ncont, ncv, ndv, ntile
67 
68  TYPE(t_patch), POINTER :: ppatch
69  TYPE(t_tile_plag), POINTER :: ptileplag
70  TYPE(t_global), POINTER :: global
71 
72 !******************************************************************************
73 
74  rcsidentstring = '$RCSfile: PLAG_AllocateMemoryTile.F90,v $ $Revision: 1.3 $'
75 
76  global => region%global
77 
78  CALL registerfunction( global, 'PLAG_AllocateMemoryTile',&
79  'PLAG_AllocateMemoryTile.F90' )
80 
81  IF ( global%myProcid == masterproc .AND. &
82  global%verbLevel > verbose_none ) THEN
83  WRITE(stdout,'(A,3X,A)') solver_name,'Allocating tile memory for PLAG...'
84  END IF ! global%verbLevel
85 
86 ! loop over all grid levels ---------------------------------------------------
87 
88  DO ilev=1,region%nGridLevels
89  DO ipatch=1,region%nPatches
90 
91  ppatch => region%levels(ilev)%patches(ipatch)
92  bctype = ppatch%bcType
93  ncont = region%plagInput%nCont
94 
95  IF ( bctype>=bc_injection .AND. bctype<=bc_injection+bc_range ) THEN
96  n1 = abs(ppatch%l1end -ppatch%l1beg ) + 1
97  n2 = abs(ppatch%l2end -ppatch%l2beg ) + 1
98  ntile = n1*n2
99 
100  ptileplag => ppatch%tilePlag
101 
102  ptileplag%nCv = cv_tile_last + ncont
103  ptileplag%nDv = dv_tile_last
104 
105  ncv = ptileplag%nCv
106  ndv = ptileplag%nDv
107 
108  ALLOCATE( ptileplag%nPclsInjc(ntile),stat=errorflag )
109  global%error = errorflag
110  IF (global%error /= err_none) THEN
111  CALL errorstop( global, err_allocate,__line__,'pTilePlag%nPclsInjc' )
112  END IF ! global%error
113 
114  ALLOCATE( ptileplag%cv(ncv,ntile),stat=errorflag )
115  global%error = errorflag
116  IF (global%error /= err_none) THEN
117  CALL errorstop( global, err_allocate,__line__,'pTilePlag%cv' )
118  END IF ! global%error
119 
120  ALLOCATE( ptileplag%cvOld(ncv,ntile),stat=errorflag )
121  global%error = errorflag
122  IF (global%error /= err_none) THEN
123  CALL errorstop( global, err_allocate,__line__,'pTilePlag%cvOld' )
124  END IF ! global%error
125 
126  ALLOCATE( ptileplag%dv(ndv,ntile),stat=errorflag )
127  global%error = errorflag
128  IF (global%error /= err_none) THEN
129  CALL errorstop( global, err_allocate,__line__,'pTilePlag%dv' )
130  END IF ! global%error
131 
132  ALLOCATE( ptileplag%rhs(ncv,ntile),stat=errorflag )
133  global%error = errorflag
134  IF (global%error /= err_none) THEN
135  CALL errorstop( global, err_allocate,__line__,'pTilePlag%rhs' )
136  END IF ! global%error
137 
138  ALLOCATE( ptileplag%rhsSum(ncv,ntile),stat=errorflag )
139  global%error = errorflag
140  IF (global%error /= err_none) THEN
141  CALL errorstop( global, err_allocate,__line__,'pTilePlag%rhsSum' )
142  END IF ! global%error
143 
144  ALLOCATE( ptileplag%cvTileMass(ncont),stat=errorflag )
145  global%error = errorflag
146  IF (global%error /= err_none) THEN
147  CALL errorstop( global, err_allocate,__line__,'pTilePlag%cvTileMass' )
148  END IF ! global%error
149 
150  DO icont = 1, ncont
151  ptileplag%cvTileMass(icont) = cv_tile_last +icont
152  END DO ! iCont
153 
154  ENDIF ! bcType
155 
156  ENDDO ! iPatch
157 
158  ENDDO ! iLev
159 
160 ! finalize
161 
162  CALL deregisterfunction( global )
163 
164 END SUBROUTINE plag_allocatememorytile
165 
166 !******************************************************************************
167 !
168 ! RCS Revision history:
169 !
170 ! $Log: PLAG_AllocateMemoryTile.F90,v $
171 ! Revision 1.3 2008/12/06 08:44:32 mtcampbe
172 ! Updated license.
173 !
174 ! Revision 1.2 2008/11/19 22:17:45 mtcampbe
175 ! Added Illinois Open Source License/Copyright
176 !
177 ! Revision 1.1 2004/12/01 20:56:51 fnajjar
178 ! Initial revision after changing case
179 !
180 ! Revision 1.1 2002/10/25 14:13:59 f-najjar
181 ! Initial Import of Rocpart
182 !
183 !
184 !******************************************************************************
185 
186 
187 
188 
189 
190 
191 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine plag_allocatememorytile(region)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469