Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SPEC_RFLU_AllocateMemoryTStep.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 species related to time stepping.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Region pointer
31 !
32 ! Output: None.
33 !
34 ! Notes: None.
35 !
36 !******************************************************************************
37 !
38 ! $Id: SPEC_RFLU_AllocateMemoryTStep.F90,v 1.7 2008/12/06 08:44:40 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2003-2004 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE spec_rflu_allocatememorytstep(pRegion)
45 
46  USE moddatatypes
47  USE moderror
48  USE modparameters
49  USE modglobal, ONLY: t_global
50  USE modbndpatch, ONLY: t_patch
51  USE modgrid, ONLY: t_grid
52  USE moddatastruct, ONLY: t_region
53  USE modmixture, ONLY: t_mixt_input
54  USE modmpi
55 
57 
58  IMPLICIT NONE
59 
60 ! ******************************************************************************
61 ! Definitions and declarations
62 ! ******************************************************************************
63 
64 ! ==============================================================================
65 ! Arguments
66 ! ==============================================================================
67 
68  TYPE(t_region), POINTER :: pregion
69 
70 ! ==============================================================================
71 ! Locals
72 ! ==============================================================================
73 
74  CHARACTER(CHRLEN) :: rcsidentstring
75  INTEGER :: errorflag,ipatch,nbfaces,nbfacestot,nspecies
76  TYPE(t_global), POINTER :: global
77  TYPE(t_grid), POINTER :: pgrid
78  TYPE(t_mixt_input), POINTER :: pmixtinput
79  TYPE(t_patch), POINTER :: ppatch
80 
81 ! ******************************************************************************
82 ! Start
83 ! ******************************************************************************
84 
85  rcsidentstring = '$RCSfile: SPEC_RFLU_AllocateMemoryTStep.F90,v $ $Revision: 1.7 $'
86 
87  global => pregion%global
88 
89  CALL registerfunction(global,'SPEC_RFLU_AllocateMemoryTStep',&
90  'SPEC_RFLU_AllocateMemoryTStep.F90')
91 
92 ! ******************************************************************************
93 ! Set pointers and variables
94 ! ******************************************************************************
95 
96  pgrid => pregion%grid
97  pmixtinput => pregion%mixtInput
98 
99  nspecies = pregion%specInput%nSpecies
100 
101 ! ******************************************************************************
102 ! Allocate memory
103 ! ******************************************************************************
104 
105 ! ==============================================================================
106 ! Compute number of boundary faces for later use
107 ! ==============================================================================
108 
109  nbfaces = 0
110  nbfacestot = 0
111 
112  DO ipatch = 1,pgrid%nPatches
113  ppatch => pregion%patches(ipatch)
114 
115  nbfaces = nbfaces + ppatch%nBTris + ppatch%nBQuads
116  nbfacestot = nbfacestot + ppatch%nBTrisTot + ppatch%nBQuadsTot
117  END DO ! iPatch
118 
119 ! ==============================================================================
120 ! Old state vector
121 ! ==============================================================================
122 
123  ALLOCATE(pregion%spec%cvOld(nspecies,pgrid%nCellsTot),stat=errorflag)
124  global%error = errorflag
125  IF (global%error /= err_none) THEN
126  CALL errorstop(global,err_allocate,__line__,'pRegion%spec%cvOld')
127  END IF ! global%error
128 
129 ! ==============================================================================
130 ! Residuals
131 ! ==============================================================================
132 
133  ALLOCATE(pregion%spec%rhs(nspecies,pgrid%nCellsTot),stat=errorflag)
134  global%error = errorflag
135  IF (global%error /= err_none) THEN
136  CALL errorstop(global,err_allocate,__line__,'pRegion%spec%rhs')
137  END IF ! global%error
138 
139  ALLOCATE(pregion%spec%diss(nspecies,pgrid%nCellsTot),stat=errorflag)
140  global%error = errorflag
141  IF (global%error /= err_none) THEN
142  CALL errorstop(global,err_allocate,__line__,'pRegion%spec%diss')
143  END IF ! global%error
144 
145  IF ( global%flowType == flow_unsteady ) THEN
146  ALLOCATE(pregion%spec%rhsSum(nspecies,pgrid%nCellsTot),stat=errorflag)
147  global%error = errorflag
148  IF (global%error /= err_none) THEN
149  CALL errorstop(global,err_allocate,__line__,'pRegion%spec%rhsSum')
150  END IF ! global%error
151  ELSE
152  nullify(pregion%spec%rhsSum)
153  END IF ! global%flowType
154 
155 ! ==============================================================================
156 ! Gradients
157 ! ==============================================================================
158 
159 ! ------------------------------------------------------------------------------
160 ! Cell gradients
161 ! ------------------------------------------------------------------------------
162 
163  IF ( pmixtinput%spaceOrder > 1 ) THEN
164  ALLOCATE(pregion%spec%gradCell(xcoord:zcoord,nspecies,pgrid%nCellsTot), &
165  stat=errorflag)
166  global%error = errorflag
167  IF ( global%error /= err_none ) THEN
168  CALL errorstop(global,err_allocate,__line__,'pRegion%spec%gradCell')
169  END IF ! global%error
170  ELSE
171  nullify(pregion%spec%gradCell)
172  END IF ! pMixtInput%spaceOrder
173 
174 ! ------------------------------------------------------------------------------
175 ! Face gradients
176 ! ------------------------------------------------------------------------------
177 
178  IF ( pmixtinput%flowModel == flow_navst ) THEN
179  ALLOCATE(pregion%spec%gradFace(xcoord:zcoord,nspecies,pgrid%nFaces), &
180  stat=errorflag)
181  global%error = errorflag
182  IF ( global%error /= err_none ) THEN
183  CALL errorstop(global,err_allocate,__line__,'pRegion%spec%gradFace')
184  END IF ! global%error
185  ELSE
186  nullify(pregion%spec%gradFace)
187  END IF ! pMixtInput%flowModel
188 
189  IF ( pgrid%nPatches > 0 ) THEN
190  DO ipatch = 1,pregion%grid%nPatches
191  ppatch => pregion%patches(ipatch)
192 
193  IF ( rflu_decideneedbgradface(pregion,ppatch) .EQV. .true. ) THEN
194  ALLOCATE(ppatch%spec%gradFace(xcoord:zcoord,nspecies,ppatch%nBFaces), &
195  stat=errorflag)
196  global%error = errorflag
197  IF ( global%error /= err_none ) THEN
198  CALL errorstop(global,err_allocate,__line__,'pPatch%spec%gradFace')
199  END IF ! global%error
200  ELSE
201  nullify(ppatch%spec%gradFace)
202  END IF ! RFLU_DecideNeedBGradFace
203  END DO ! iPatch
204  END IF ! pGrid%nPatches
205 
206 ! ******************************************************************************
207 ! End
208 ! ******************************************************************************
209 
210  CALL deregisterfunction(global)
211 
212 END SUBROUTINE spec_rflu_allocatememorytstep
213 
214 !******************************************************************************
215 !
216 ! RCS Revision history:
217 !
218 ! $Log: SPEC_RFLU_AllocateMemoryTStep.F90,v $
219 ! Revision 1.7 2008/12/06 08:44:40 mtcampbe
220 ! Updated license.
221 !
222 ! Revision 1.6 2008/11/19 22:17:52 mtcampbe
223 ! Added Illinois Open Source License/Copyright
224 !
225 ! Revision 1.5 2006/10/20 21:34:33 mparmar
226 ! Bug fix in allocation of pPatch%spec%gradFace
227 !
228 ! Revision 1.4 2006/08/19 15:40:27 mparmar
229 ! Moved region%spec%bGradFace to patch%spec%gradFace
230 !
231 ! Revision 1.3 2006/04/07 15:19:24 haselbac
232 ! Removed tabs
233 !
234 ! Revision 1.2 2004/01/29 22:59:38 haselbac
235 ! Added allocation of cell and face gradients
236 !
237 ! Revision 1.1 2003/11/25 21:08:37 haselbac
238 ! Initial revision
239 !
240 !******************************************************************************
241 
242 
243 
244 
245 
246 
247 
LOGICAL function rflu_decideneedbgradface(pRegion, pPatch)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine spec_rflu_allocatememorytstep(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469