Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_CECellsDeallocateData.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 variables associated with buffer datastructure
26 ! of the corner and edge cells for all active regions.
27 !
28 ! Description: none.
29 !
30 ! Input: regions = all regions,
31 ! iReg = region number.
32 !
33 ! Output: region%level%cornerCells(:)%bufferExchPlag = corner cell buffers
34 ! region%level%edgeCells(:)%bufferExchPlag = edge cell buffers
35 !
36 ! Notes: none.
37 !
38 !******************************************************************************
39 !
40 ! $Id: PLAG_CECellsDeallocateData.F90,v 1.3 2008/12/06 08:44:32 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2003 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE plag_cecellsdeallocatedata( regions, iReg )
47 
48  USE moddatatypes
50  USE moddatastruct, ONLY : t_region, t_level
51  USE modglobal, ONLY : t_global
52  USE moderror
53  USE modparameters
55  USE modmpi
56 
57  IMPLICIT NONE
58 
59 ! ... parameters
60  TYPE(t_region), POINTER :: regions(:)
61 
62  INTEGER, INTENT(IN) :: ireg
63 
64 ! ... loop variables
65  INTEGER :: icorner, iedge, ilev, ijk
66 
67 ! ... local variables
68  CHARACTER(CHRLEN) :: rcsidentstring
69 
70  INTEGER :: errorflag, ngridlevels
71 
72  TYPE(t_region), POINTER :: pregion
73  TYPE(t_level), POINTER :: plevel
74  TYPE(t_buffer_plag), POINTER :: pcorncellsxbuff, pedgecellsxbuff
75  TYPE(t_plag), POINTER :: pplag
76  TYPE(t_global), POINTER :: global
77 
78 !******************************************************************************
79 
80  rcsidentstring = '$RCSfile: PLAG_CECellsDeallocateData.F90,v $ $Revision: 1.3 $'
81 
82  global => regions(ireg)%global
83 
84  CALL registerfunction( global, 'PLAG_CECellsDeAllocateData',&
85  'PLAG_CECellsDeallocateData.F90' )
86 
87  IF ( global%myProcid == masterproc .AND. &
88  global%verbLevel > verbose_none ) THEN
89  WRITE(stdout,'(A,3X,A)') solver_name, &
90  'Deallocating Corner-Edge Cells Data Buffers for PLAG...'
91  END IF ! global%verbLevel
92 
93 ! Set pointer -----------------------------------------------------------------
94 
95  pregion => regions(ireg)
96 
97 ! Get dimensions --------------------------------------------------------------
98 
99  ngridlevels = pregion%nGridLevels
100 
101 ! Loop over all grid levels ---------------------------------------------------
102 
103  DO ilev=1,ngridlevels
104 
105 ! - Set pointers --------------------------------------------------------------
106 
107  plevel => pregion%levels(ilev)
108  pplag => regions(ireg)%levels(ilev)%plag
109 
110 ! - Corner cells --------------------------------------------------------------
111 
112  DO icorner=1,8
113 
114 ! -- Bypass for noninteracting regions ----------------------------------------
115 
116  IF( .NOT. plevel%cornerCells(icorner)%interact ) goto 1999
117 
118 ! -- Bypass for degenerate corner cells ---------------------------------------
119 
120  IF( plevel%cornerCells(icorner)%degenrt /= degenerat_none ) goto 1999
121 
122 ! -- Set pointer --------------------------------------------------------------
123 
124  DO ijk=1,ubound(plevel%cornerCells(icorner)%cells,1)
125  pcorncellsxbuff => plevel%cornerCells(icorner)%cells(ijk)%bufferExchPlag
126 
127 ! -- Deallocate buffer data ---------------------------------------------------
128 
129  DEALLOCATE( pcorncellsxbuff%aiv,stat=errorflag )
130  global%error = errorflag
131  IF (global%error /= err_none) THEN
132  CALL errorstop( global, err_deallocate,__line__,'pCornCellsXBuff%aiv' )
133  END IF ! global%error
134 
135  DEALLOCATE( pcorncellsxbuff%arv,stat=errorflag )
136  global%error = errorflag
137  IF (global%error /= err_none) THEN
138  CALL errorstop( global, err_deallocate,__line__,'pCornCellsXBuff%arv' )
139  END IF ! global%error
140 
141  DEALLOCATE( pcorncellsxbuff%cv,stat=errorflag )
142  global%error = errorflag
143  IF (global%error /= err_none) THEN
144  CALL errorstop( global, err_deallocate,__line__,'pCornCellsXBuff%cv' )
145  END IF ! global%error
146 
147  DEALLOCATE( pcorncellsxbuff%dv,stat=errorflag )
148  global%error = errorflag
149  IF (global%error /= err_none) THEN
150  CALL errorstop( global, err_deallocate,__line__,'pCornCellsXBuff%dv' )
151  END IF ! global%error
152 
153  DEALLOCATE( pcorncellsxbuff%tv,stat=errorflag )
154  global%error = errorflag
155  IF (global%error /= err_none) THEN
156  CALL errorstop( global, err_deallocate,__line__,'pCornCellsXBuff%tv' )
157  END IF ! global%error
158 
159  DEALLOCATE( pcorncellsxbuff%aivOld,stat=errorflag )
160  global%error = errorflag
161  IF (global%error /= err_none) THEN
162  CALL errorstop( global, err_deallocate,__line__,'pCornCellsXBuff%aivOld' )
163  END IF ! global%error
164 
165  DEALLOCATE( pcorncellsxbuff%arvOld,stat=errorflag )
166  global%error = errorflag
167  IF (global%error /= err_none) THEN
168  CALL errorstop( global, err_deallocate,__line__,'pCornCellsXBuff%arvOld' )
169  END IF ! global%error
170 
171  DEALLOCATE( pcorncellsxbuff%cvOld,stat=errorflag )
172  global%error = errorflag
173  IF (global%error /= err_none) THEN
174  CALL errorstop( global, err_deallocate,__line__,'pCornCellsXBuff%cvOld' )
175  END IF ! global%error
176 
177  DEALLOCATE( pcorncellsxbuff%rhs,stat=errorflag )
178  global%error = errorflag
179  IF (global%error /= err_none) THEN
180  CALL errorstop( global, err_deallocate,__line__,'pCornCellsXBuff%rhs' )
181  END IF ! global%error
182 
183  DEALLOCATE( pcorncellsxbuff%rhsSum,stat=errorflag )
184  global%error = errorflag
185  IF (global%error /= err_none) THEN
186  CALL errorstop( global, err_deallocate,__line__,'pCornCellsXBuff%rhsSum' )
187  END IF ! global%error
188  ENDDO ! ijk
189 
190 1999 CONTINUE
191 
192  ENDDO ! iCorner
193 
194 ! - Edge cells ----------------------------------------------------------------
195 
196  DO iedge=1,12
197 
198 ! -- Bypass for noninteracting regions ----------------------------------------
199 
200  IF( .NOT. plevel%edgeCells(iedge)%interact ) goto 2999
201 
202 ! -- Bypass for degenerate edge cells -----------------------------------------
203 
204  IF( plevel%edgeCells(iedge)%degenrt /= degenerat_none ) goto 2999
205 
206 ! -- Set pointer --------------------------------------------------------------
207 
208  DO ijk=1,ubound(plevel%edgeCells(iedge)%cells,1)
209  pedgecellsxbuff => plevel%edgeCells(iedge)%cells(ijk)%bufferExchPlag
210 
211 ! -- Deallocate buffer data ---------------------------------------------------
212 
213  DEALLOCATE( pedgecellsxbuff%aiv,stat=errorflag )
214  global%error = errorflag
215  IF (global%error /= err_none) THEN
216  CALL errorstop( global, err_deallocate,__line__,'pEdgeCellsXBuff%aiv' )
217  END IF ! global%error
218 
219  DEALLOCATE( pedgecellsxbuff%arv,stat=errorflag )
220  global%error = errorflag
221  IF (global%error /= err_none) THEN
222  CALL errorstop( global, err_deallocate,__line__,'pEdgeCellsXBuff%arv' )
223  END IF ! global%error
224 
225  DEALLOCATE( pedgecellsxbuff%cv,stat=errorflag )
226  global%error = errorflag
227  IF (global%error /= err_none) THEN
228  CALL errorstop( global, err_deallocate,__line__,'pEdgeCellsXBuff%cv' )
229  END IF ! global%error
230 
231  DEALLOCATE( pedgecellsxbuff%dv,stat=errorflag )
232  global%error = errorflag
233  IF (global%error /= err_none) THEN
234  CALL errorstop( global, err_deallocate,__line__,'pEdgeCellsXBuff%dv' )
235  END IF ! global%error
236 
237  DEALLOCATE( pedgecellsxbuff%tv,stat=errorflag )
238  global%error = errorflag
239  IF (global%error /= err_none) THEN
240  CALL errorstop( global, err_deallocate,__line__,'pEdgeCellsXBuff%tv' )
241  END IF ! global%error
242 
243  DEALLOCATE( pedgecellsxbuff%aivOld,stat=errorflag )
244  global%error = errorflag
245  IF (global%error /= err_none) THEN
246  CALL errorstop( global, err_deallocate,__line__,'pEdgeCellsXBuff%aivOld' )
247  END IF ! global%error
248 
249  DEALLOCATE( pedgecellsxbuff%arvOld,stat=errorflag )
250  global%error = errorflag
251  IF (global%error /= err_none) THEN
252  CALL errorstop( global, err_deallocate,__line__,'pEdgeCellsXBuff%arvOld' )
253  END IF ! global%error
254 
255  DEALLOCATE( pedgecellsxbuff%cvOld,stat=errorflag )
256  global%error = errorflag
257  IF (global%error /= err_none) THEN
258  CALL errorstop( global, err_deallocate,__line__,'pEdgeCellsXBuff%cvOld' )
259  END IF ! global%error
260 
261  DEALLOCATE( pedgecellsxbuff%rhs,stat=errorflag )
262  global%error = errorflag
263  IF (global%error /= err_none) THEN
264  CALL errorstop( global, err_deallocate,__line__,'pEdgeCellsXBuff%rhs' )
265  END IF ! global%error
266 
267  DEALLOCATE( pedgecellsxbuff%rhsSum,stat=errorflag )
268  global%error = errorflag
269  IF (global%error /= err_none) THEN
270  CALL errorstop( global, err_deallocate,__line__,'pEdgeCellsXBuff%rhsSum' )
271  END IF ! global%error
272  ENDDO ! ijk
273 
274 2999 CONTINUE
275 
276  ENDDO ! iEdge
277 
278  ENDDO ! iLev
279 
280 ! finalize --------------------------------------------------------------------
281 
282  CALL deregisterfunction( global )
283 
284 END SUBROUTINE plag_cecellsdeallocatedata
285 
286 !******************************************************************************
287 !
288 ! RCS Revision history:
289 !
290 ! $Log: PLAG_CECellsDeallocateData.F90,v $
291 ! Revision 1.3 2008/12/06 08:44:32 mtcampbe
292 ! Updated license.
293 !
294 ! Revision 1.2 2008/11/19 22:17:45 mtcampbe
295 ! Added Illinois Open Source License/Copyright
296 !
297 ! Revision 1.1 2004/12/01 20:57:08 fnajjar
298 ! Initial revision after changing case
299 !
300 ! Revision 1.2 2004/11/29 19:24:17 fnajjar
301 ! Added bypass statement for dengerate cells
302 !
303 ! Revision 1.1 2003/11/12 21:37:59 fnajjar
304 ! Initial import of Corner-Edge cells Infrastructure
305 !
306 !******************************************************************************
307 
308 
309 
310 
311 
312 
313 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine plag_cecellsdeallocatedata(regions, iReg)
**********************************************************************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 icorner
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469