Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SPEC_RFLU_DeallocateMemoryTStep.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: Deallocate 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_DeallocateMemoryTStep.F90,v 1.6 2008/12/06 08:44:40 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2003-2004 by the University of Illinois
41 !
42 !******************************************************************************
43 
45 
46  USE moddatatypes
47  USE moderror
48  USE modparameters
49  USE modglobal, ONLY: t_global
50  USE modgrid, ONLY: t_grid
51  USE moddatastruct, ONLY: t_region
52  USE modmixture, ONLY: t_mixt_input
53  USE modbndpatch, ONLY: t_patch
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
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_DeallocateMemoryTStep.F90,v $ $Revision: 1.6 $'
86 
87  global => pregion%global
88 
89  CALL registerfunction(global,'SPEC_RFLU_DeallocateMemoryTStep',&
90  'SPEC_RFLU_DeallocateMemoryTStep.F90')
91 
92 ! ******************************************************************************
93 ! Set pointers
94 ! ******************************************************************************
95 
96  pgrid => pregion%grid
97  pmixtinput => pregion%mixtInput
98 
99 ! ******************************************************************************
100 ! Allocate memory
101 ! ******************************************************************************
102 
103 ! ==============================================================================
104 ! Old state vector
105 ! ==============================================================================
106 
107  DEALLOCATE(pregion%spec%cvOld,stat=errorflag)
108  global%error = errorflag
109  IF ( global%error /= err_none ) THEN
110  CALL errorstop(global,err_deallocate,__line__,'pRegion%spec%cvOld')
111  END IF ! global%error
112 
113 ! ==============================================================================
114 ! Residuals
115 ! ==============================================================================
116 
117  DEALLOCATE(pregion%spec%rhs,stat=errorflag)
118  global%error = errorflag
119  IF ( global%error /= err_none ) THEN
120  CALL errorstop(global,err_deallocate,__line__,'pRegion%spec%rhs')
121  END IF ! global%error
122 
123  DEALLOCATE(pregion%spec%diss,stat=errorflag)
124  global%error = errorflag
125  IF ( global%error /= err_none ) THEN
126  CALL errorstop(global,err_deallocate,__line__,'pRegion%spec%diss')
127  END IF ! global%error
128 
129  IF ( global%flowType == flow_unsteady ) THEN
130  DEALLOCATE(pregion%spec%rhsSum,stat=errorflag)
131  global%error = errorflag
132  IF ( global%error /= err_none ) THEN
133  CALL errorstop(global,err_deallocate,__line__,'pRegion%spec%rhsSum')
134  END IF ! global%error
135  END IF ! global%flowType
136 
137 ! ==============================================================================
138 ! Gradients
139 ! ==============================================================================
140 
141 ! ------------------------------------------------------------------------------
142 ! Cell gradients
143 ! ------------------------------------------------------------------------------
144 
145  IF ( pmixtinput%spaceOrder > 1 ) THEN
146  DEALLOCATE(pregion%spec%gradCell,stat=errorflag)
147  global%error = errorflag
148  IF ( global%error /= err_none ) THEN
149  CALL errorstop(global,err_deallocate,__line__,'pRegion%spec%gradCell')
150  END IF ! global%error
151  END IF ! pMixtInput%spaceOrder
152 
153 ! ------------------------------------------------------------------------------
154 ! Face gradients
155 ! ------------------------------------------------------------------------------
156 
157  IF ( pmixtinput%flowModel == flow_navst ) THEN
158  DEALLOCATE(pregion%spec%gradFace,stat=errorflag)
159  global%error = errorflag
160  IF ( global%error /= err_none ) THEN
161  CALL errorstop(global,err_deallocate,__line__,'pRegion%spec%gradFace')
162  END IF ! global%error
163  END IF ! pMixtInput%flowModel
164 
165  IF ( pgrid%nPatches > 0 ) THEN
166  DO ipatch = 1,pregion%grid%nPatches
167  ppatch => pregion%patches(ipatch)
168 
169  IF ( rflu_decideneedbgradface(pregion,ppatch) .EQV. .true. ) THEN
170  DEALLOCATE(ppatch%spec%gradFace,stat=errorflag)
171  global%error = errorflag
172  IF ( global%error /= err_none ) THEN
173  CALL errorstop(global,err_deallocate,__line__,'pPatch%spec%gradFace')
174  END IF ! global%error
175  END IF ! RFLU_DecideNeedBGradFace
176  END DO ! iPatch
177  END IF ! pGrid%nPatches
178 
179 
180 ! ******************************************************************************
181 ! End
182 ! ******************************************************************************
183 
184  CALL deregisterfunction(global)
185 
186 END SUBROUTINE spec_rflu_deallocatememorytstep
187 
188 !******************************************************************************
189 !
190 ! RCS Revision history:
191 !
192 ! $Log: SPEC_RFLU_DeallocateMemoryTStep.F90,v $
193 ! Revision 1.6 2008/12/06 08:44:40 mtcampbe
194 ! Updated license.
195 !
196 ! Revision 1.5 2008/11/19 22:17:52 mtcampbe
197 ! Added Illinois Open Source License/Copyright
198 !
199 ! Revision 1.4 2006/08/19 15:40:28 mparmar
200 ! Moved region%mixt%bGradFace to patch%mixt%gradFace
201 !
202 ! Revision 1.3 2006/04/07 15:19:24 haselbac
203 ! Removed tabs
204 !
205 ! Revision 1.2 2004/01/29 22:59:41 haselbac
206 ! Added deallocation of cell and face gradients
207 !
208 ! Revision 1.1 2003/11/25 21:08:37 haselbac
209 ! Initial revision
210 !
211 !******************************************************************************
212 
213 
214 
215 
216 
217 
218 
LOGICAL function rflu_decideneedbgradface(pRegion, pPatch)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine spec_rflu_deallocatememorytstep(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469