Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModDeallocateMemory.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: Suite of routines to deallocate memory.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 !*******************************************************************************
32 !
33 ! $Id: RFLU_ModDeallocateMemory.F90,v 1.11 2008/12/06 08:44:21 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2004 by the University of Illinois
36 !
37 !*******************************************************************************
38 
40 
41  USE moddatatypes
42  USE moderror
43  USE modglobal, ONLY: t_global
44  USE modparameters
45  USE modgrid, ONLY: t_grid
46  USE modbndpatch, ONLY: t_patch
47  USE moddatastruct, ONLY: t_region
48  USE modmixture, ONLY: t_mixt_input
49  USE modmpi
50 
52 
53  IMPLICIT NONE
54 
55  PRIVATE
56  PUBLIC :: rflu_deallocatememorygspeeds, &
65 
66 ! ******************************************************************************
67 ! Declarations and definitions
68 ! ******************************************************************************
69 
70  CHARACTER(CHRLEN) :: RCSIdentString = &
71  '$RCSfile: RFLU_ModDeallocateMemory.F90,v $ $Revision: 1.11 $'
72 
73 ! ******************************************************************************
74 ! Routines
75 ! ******************************************************************************
76 
77  CONTAINS
78 
79 
80 
81 
82 
83 ! ******************************************************************************
84 !
85 ! Purpose: Deallocate memory for grid speeds.
86 !
87 ! Description: None.
88 !
89 ! Input:
90 ! pRegion Region pointer
91 !
92 ! Output: None.
93 !
94 ! Notes: None.
95 !
96 ! ******************************************************************************
97 
98 SUBROUTINE rflu_deallocatememorygspeeds(pRegion)
99 
100  IMPLICIT NONE
101 
102 ! ******************************************************************************
103 ! Definitions and declarations
104 ! ******************************************************************************
105 
106 ! ==============================================================================
107 ! Arguments
108 ! ==============================================================================
109 
110  TYPE(t_region), POINTER :: pregion
111 
112 ! ==============================================================================
113 ! Locals
114 ! ==============================================================================
115 
116  INTEGER :: errorflag,ipatch
117  TYPE(t_grid), POINTER :: pgrid
118  TYPE(t_mixt_input), POINTER :: pmixtinput
119  TYPE(t_patch), POINTER :: ppatch
120  TYPE(t_global), POINTER :: global
121 
122 ! ******************************************************************************
123 ! Start
124 ! ******************************************************************************
125 
126  global => pregion%global
127 
128  CALL registerfunction(global,'RFLU_DeallocateMemoryGSpeeds',&
129  'RFLU_ModDeallocateMemory.F90')
130 
131 ! ******************************************************************************
132 ! Set pointers
133 ! ******************************************************************************
134 
135  pgrid => pregion%grid
136  pmixtinput => pregion%mixtInput
137 
138 ! ******************************************************************************
139 ! Deallocate memory
140 ! ******************************************************************************
141 
142 ! ==============================================================================
143 ! Grid motion active
144 ! ==============================================================================
145 
146  IF ( pmixtinput%moveGrid .EQV. .true. ) THEN
147 
148 ! ------------------------------------------------------------------------------
149 ! Interior faces
150 ! ------------------------------------------------------------------------------
151 
152  DEALLOCATE(pgrid%gs,stat=errorflag)
153  global%error = errorflag
154  IF ( global%error /= err_none ) THEN
155  CALL errorstop(global,err_deallocate,__line__,'pGrid%gs')
156  END IF ! global%error
157 
158 ! ------------------------------------------------------------------------------
159 ! Patch faces
160 ! ------------------------------------------------------------------------------
161 
162  IF ( pgrid%nPatches > 0 ) THEN
163  DO ipatch = 1,pgrid%nPatches
164  ppatch => pregion%patches(ipatch)
165 
166  DEALLOCATE(ppatch%gs,stat=errorflag)
167  global%error = errorflag
168  IF ( global%error /= err_none ) THEN
169  CALL errorstop(global,err_deallocate,__line__,'pPatch%gs')
170  END IF ! global%error
171  END DO ! iPatch
172  END IF ! pGrid%nPatches
173 
174 ! ==============================================================================
175 ! Grid motion not active
176 ! ==============================================================================
177 
178  ELSE
179 
180 ! ------------------------------------------------------------------------------
181 ! Interior faces
182 ! ------------------------------------------------------------------------------
183 
184  DEALLOCATE(pgrid%gs,stat=errorflag)
185  global%error = errorflag
186  IF ( global%error /= err_none ) THEN
187  CALL errorstop(global,err_deallocate,__line__,'pGrid%gs')
188  END IF ! global%error
189 
190 ! ------------------------------------------------------------------------------
191 ! Patch faces
192 ! ------------------------------------------------------------------------------
193 
194  IF ( pgrid%nPatches > 0 ) THEN
195  DO ipatch = 1,pgrid%nPatches
196  ppatch => pregion%patches(ipatch)
197 
198  DEALLOCATE(ppatch%gs,stat=errorflag)
199  global%error = errorflag
200  IF ( global%error /= err_none ) THEN
201  CALL errorstop(global,err_deallocate,__line__,'pPatch%gs')
202  END IF ! global%error
203  END DO ! iPatch
204  END IF ! pGrid%nPatches
205  END IF ! pMixtInput%moveGrid
206 
207 ! ******************************************************************************
208 ! End
209 ! ******************************************************************************
210 
211  CALL deregisterfunction(global)
212 
213 END SUBROUTINE rflu_deallocatememorygspeeds
214 
215 
216 
217 
218 
219 
220 ! ******************************************************************************
221 !
222 ! Purpose: Deallocate memory for mixture solution.
223 !
224 ! Description: None.
225 !
226 ! Input:
227 ! pRegion Region pointer
228 !
229 ! Output: None.
230 !
231 ! Notes: None.
232 !
233 ! ******************************************************************************
234 
235 SUBROUTINE rflu_deallocatememorysol(pRegion)
236 
237  IMPLICIT NONE
238 
239 ! ******************************************************************************
240 ! Definitions and declarations
241 ! ******************************************************************************
242 
243 ! ==============================================================================
244 ! Arguments
245 ! ==============================================================================
246 
247  TYPE(t_region), POINTER :: pregion
248 
249 ! ==============================================================================
250 ! Locals
251 ! ==============================================================================
252 
253  CHARACTER(CHRLEN) :: rcsidentstring
254  TYPE(t_global), POINTER :: global
255 
256 ! ******************************************************************************
257 ! Start
258 ! ******************************************************************************
259 
260  global => pregion%global
261 
262  CALL registerfunction(global,'RFLU_DeallocateMemorySol',&
263  'RFLU_ModDeallocateMemory.F90')
264 
265 ! ******************************************************************************
266 ! Allocate memory
267 ! ******************************************************************************
268 
269  CALL rflu_deallocatememorysolcv(pregion)
270  CALL rflu_deallocatememorysoldv(pregion)
271  CALL rflu_deallocatememorysolgv(pregion)
272  CALL rflu_deallocatememorysoltv(pregion)
273 
274 ! ******************************************************************************
275 ! End
276 ! ******************************************************************************
277 
278  CALL deregisterfunction(global)
279 
280 END SUBROUTINE rflu_deallocatememorysol
281 
282 
283 
284 
285 
286 
287 ! ******************************************************************************
288 !
289 ! Purpose: Deallocate memory for conserved variables of mixture.
290 !
291 ! Description: None.
292 !
293 ! Input:
294 ! pRegion Region pointer
295 !
296 ! Output: None.
297 !
298 ! Notes: None.
299 !
300 ! ******************************************************************************
301 
302 SUBROUTINE rflu_deallocatememorysolcv(pRegion)
303 
304  IMPLICIT NONE
305 
306 ! ******************************************************************************
307 ! Definitions and declarations
308 ! ******************************************************************************
309 
310 ! ==============================================================================
311 ! Arguments
312 ! ==============================================================================
313 
314  TYPE(t_region), POINTER :: pregion
315 
316 ! ==============================================================================
317 ! Locals
318 ! ==============================================================================
319 
320  CHARACTER(CHRLEN) :: rcsidentstring
321  INTEGER :: errorflag
322  TYPE(t_global), POINTER :: global
323  TYPE(t_grid), POINTER :: pgrid
324 
325 ! ******************************************************************************
326 ! Start
327 ! ******************************************************************************
328 
329  global => pregion%global
330 
331  CALL registerfunction(global,'RFLU_DeallocateMemorySolCv',&
332  'RFLU_ModDeallocateMemory.F90')
333 
334 ! ******************************************************************************
335 ! Set pointers
336 ! ******************************************************************************
337 
338  pgrid => pregion%grid
339 
340 ! ******************************************************************************
341 ! Deallocate memory
342 ! ******************************************************************************
343 
344  DEALLOCATE(pregion%mixt%cv,stat=errorflag)
345  global%error = errorflag
346  IF (global%error /= err_none) THEN
347  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%cv')
348  END IF ! global%error
349 
350  DEALLOCATE(pregion%mixt%cvInfo,stat=errorflag)
351  global%error = errorflag
352  IF (global%error /= err_none) THEN
353  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%cvInfo')
354  END IF ! global%error
355 
356 ! ******************************************************************************
357 ! End
358 ! ******************************************************************************
359 
360  CALL deregisterfunction(global)
361 
362 END SUBROUTINE rflu_deallocatememorysolcv
363 
364 
365 
366 
367 
368 
369 ! ******************************************************************************
370 !
371 ! Purpose: Deallocate memory for dependent variables of mixture.
372 !
373 ! Description: None.
374 !
375 ! Input:
376 ! pRegion Region pointer
377 !
378 ! Output: None.
379 !
380 ! Notes: None.
381 !
382 ! ******************************************************************************
383 
384 SUBROUTINE rflu_deallocatememorysoldv(pRegion)
385 
386  IMPLICIT NONE
387 
388 ! ******************************************************************************
389 ! Definitions and declarations
390 ! ******************************************************************************
391 
392 ! ==============================================================================
393 ! Arguments
394 ! ==============================================================================
395 
396  TYPE(t_region), POINTER :: pregion
397 
398 ! ==============================================================================
399 ! Locals
400 ! ==============================================================================
401 
402  CHARACTER(CHRLEN) :: rcsidentstring
403  INTEGER :: errorflag
404  TYPE(t_global), POINTER :: global
405 
406 ! ******************************************************************************
407 ! Start
408 ! ******************************************************************************
409 
410  global => pregion%global
411 
412  CALL registerfunction(global,'RFLU_DeallocateMemorySolDv',&
413  'RFLU_ModDeallocateMemory.F90')
414 
415 ! ******************************************************************************
416 ! Deallocate memory
417 ! ******************************************************************************
418 
419  DEALLOCATE(pregion%mixt%dv,stat=errorflag)
420  global%error = errorflag
421  IF (global%error /= err_none) THEN
422  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%dv')
423  END IF ! global%error
424 
425 ! ******************************************************************************
426 ! End
427 ! ******************************************************************************
428 
429  CALL deregisterfunction(global)
430 
431 END SUBROUTINE rflu_deallocatememorysoldv
432 
433 
434 
435 
436 
437 
438 ! ******************************************************************************
439 !
440 ! Purpose: Deallocate memory for gas variables of mixture.
441 !
442 ! Description: None.
443 !
444 ! Input:
445 ! pRegion Region pointer
446 !
447 ! Output: None.
448 !
449 ! Notes: None.
450 !
451 ! ******************************************************************************
452 
453 SUBROUTINE rflu_deallocatememorysolgv(pRegion)
454 
455  IMPLICIT NONE
456 
457 ! ******************************************************************************
458 ! Definitions and declarations
459 ! ******************************************************************************
460 
461 ! ==============================================================================
462 ! Arguments
463 ! ==============================================================================
464 
465  TYPE(t_region), POINTER :: pregion
466 
467 ! ==============================================================================
468 ! Locals
469 ! ==============================================================================
470 
471  INTEGER :: errorflag
472  TYPE(t_global), POINTER :: global
473 
474 ! ******************************************************************************
475 ! Start
476 ! ******************************************************************************
477 
478  global => pregion%global
479 
480  CALL registerfunction(global,'RFLU_DeallocateMemorySolGv',&
481  'RFLU_ModDeallocateMemory.F90')
482 
483 ! ******************************************************************************
484 ! Deallocate memory
485 ! ******************************************************************************
486 
487  DEALLOCATE(pregion%mixt%gv,stat=errorflag)
488  global%error = errorflag
489  IF (global%error /= err_none) THEN
490  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%gv')
491  END IF ! global%error
492 
493 ! ******************************************************************************
494 ! End
495 ! ******************************************************************************
496 
497  CALL deregisterfunction(global)
498 
499 END SUBROUTINE rflu_deallocatememorysolgv
500 
501 
502 
503 
504 
505 ! ******************************************************************************
506 !
507 ! Purpose: Deallocate memory for transport variables of mixture.
508 !
509 ! Description: None.
510 !
511 ! Input:
512 ! pRegion Region pointer
513 !
514 ! Output: None.
515 !
516 ! Notes: None.
517 !
518 ! ******************************************************************************
519 
520 SUBROUTINE rflu_deallocatememorysoltv(pRegion)
521 
522  IMPLICIT NONE
523 
524 ! ******************************************************************************
525 ! Definitions and declarations
526 ! ******************************************************************************
527 
528 ! ==============================================================================
529 ! Arguments
530 ! ==============================================================================
531 
532  TYPE(t_region), POINTER :: pregion
533 
534 ! ==============================================================================
535 ! Locals
536 ! ==============================================================================
537 
538  INTEGER :: errorflag
539  TYPE(t_mixt_input), POINTER :: pmixtinput
540  TYPE(t_global), POINTER :: global
541 
542 ! ******************************************************************************
543 ! Start
544 ! ******************************************************************************
545 
546  global => pregion%global
547 
548  CALL registerfunction(global,'RFLU_DeallocateMemorySolTv',&
549  'RFLU_ModDeallocateMemory.F90')
550 
551 ! ******************************************************************************
552 ! Set pointers
553 ! ******************************************************************************
554 
555  pmixtinput => pregion%mixtInput
556 
557 ! ******************************************************************************
558 ! Deallocate memory
559 ! ******************************************************************************
560 
561  IF ( pmixtinput%computeTv .EQV. .true. ) THEN
562  DEALLOCATE(pregion%mixt%tv,stat=errorflag)
563  global%error = errorflag
564  IF (global%error /= err_none) THEN
565  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%tv')
566  END IF ! global%error
567  END IF ! pMixtInput%computeTv
568 
569 ! ******************************************************************************
570 ! End
571 ! ******************************************************************************
572 
573  CALL deregisterfunction(global)
574 
575 END SUBROUTINE rflu_deallocatememorysoltv
576 
577 
578 
579 
580 
581 
582 ! ******************************************************************************
583 !
584 ! Purpose: Deallocate memory for mixture time-stepping.
585 !
586 ! Description: None.
587 !
588 ! Input:
589 ! pRegion Region pointer
590 !
591 ! Output: None.
592 !
593 ! Notes: None.
594 !
595 ! ******************************************************************************
596 
597 SUBROUTINE rflu_deallocatememorytstep(pRegion)
598 
599  USE rflu_modoles
600 
601  IMPLICIT NONE
602 
603 ! ******************************************************************************
604 ! Definitions and declarations
605 ! ******************************************************************************
606 
607 ! ==============================================================================
608 ! Arguments
609 ! ==============================================================================
610 
611  TYPE(t_region), POINTER :: pregion
612 
613 ! ==============================================================================
614 ! Locals
615 ! ==============================================================================
616 
617  INTEGER :: errorflag,ipatch,nbfaces,nbfacestot
618  TYPE(t_grid), POINTER :: pgrid,pgridold,pgridold2
619  TYPE(t_mixt_input), POINTER :: pmixtinput
620  TYPE(t_patch), POINTER :: ppatch
621  TYPE(t_global), POINTER :: global
622 
623 ! ******************************************************************************
624 ! Start
625 ! ******************************************************************************
626 
627  global => pregion%global
628 
629  CALL registerfunction(global,'RFLU_DeallocateMemoryTStep',&
630  'RFLU_ModDeallocateMemory.F90')
631 
632 ! ******************************************************************************
633 ! Set pointers
634 ! ******************************************************************************
635 
636  pgrid => pregion%grid
637  pgridold => pregion%gridOld
638  pgridold2 => pregion%gridOld2
639  pmixtinput => pregion%mixtInput
640 
641 ! ******************************************************************************
642 ! Deallocate memory
643 ! ******************************************************************************
644 
645 ! ==============================================================================
646 ! Old solutions
647 ! ==============================================================================
648 
649  DEALLOCATE(pregion%mixt%cvOld,stat=errorflag)
650  global%error = errorflag
651  IF (global%error /= err_none) THEN
652  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%cvOld')
653  END IF ! global%error
654 
655  IF ( global%solverType == solv_implicit_nk ) THEN
656  DEALLOCATE(pregion%mixt%cvOld1,stat=errorflag)
657  global%error = errorflag
658  IF (global%error /= err_none) THEN
659  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%cvOld1')
660  END IF ! global%error
661 
662  DEALLOCATE(pregion%mixt%cvOld2,stat=errorflag)
663  global%error = errorflag
664  IF (global%error /= err_none) THEN
665  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%cvOld2')
666  END IF ! global%error
667  END IF ! global%solverType
668 
669 ! ==============================================================================
670 ! Time step
671 ! ==============================================================================
672 
673  DEALLOCATE(pregion%dt,stat=errorflag)
674  global%error = errorflag
675  IF (global%error /= err_none) THEN
676  CALL errorstop(global,err_deallocate,__line__,'pRegion%dt')
677  END IF ! global%error
678 
679 ! ==============================================================================
680 ! Residuals
681 ! ==============================================================================
682 
683  DEALLOCATE(pregion%mixt%rhs,stat=errorflag)
684  global%error = errorflag
685  IF (global%error /= err_none) THEN
686  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%rhs')
687  END IF ! global%error
688 
689  DEALLOCATE(pregion%mixt%diss,stat=errorflag)
690  global%error = errorflag
691  IF (global%error /= err_none) THEN
692  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%diss')
693  END IF ! global%error
694 
695  IF ( global%flowType == flow_unsteady ) THEN
696  DEALLOCATE(pregion%mixt%rhsSum,stat=errorflag)
697  global%error = errorflag
698  IF (global%error /= err_none) THEN
699  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%rhsSum')
700  END IF ! global%error
701  END IF ! global%flowType
702 
703 ! ==============================================================================
704 ! Gradients
705 ! ==============================================================================
706 
707 ! ------------------------------------------------------------------------------
708 ! Cell gradients
709 ! ------------------------------------------------------------------------------
710 
711  IF ( (pmixtinput%spaceDiscr == discr_upw_roe ) .OR. &
712  (pmixtinput%spaceDiscr == discr_upw_hllc ) .OR. &
713  (pmixtinput%spaceDiscr == discr_upw_ausmplus) ) THEN
714  IF ( pmixtinput%spaceOrder > 1 ) THEN
715  DEALLOCATE(pregion%mixt%gradCell,stat=errorflag)
716  global%error = errorflag
717  IF (global%error /= err_none) THEN
718  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%gradCell')
719  END IF ! global%error
720  END IF ! pMixtInput%spaceOrder
721  ELSE IF ( pmixtinput%spaceDiscr == discr_opt_les ) THEN
722  DEALLOCATE(pregion%mixt%gradCell,stat=errorflag)
723  global%error = errorflag
724  IF (global%error /= err_none) THEN
725  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%gradCell')
726  END IF ! global%error
727  END IF ! pMixtInput%spaceDiscr
728 
729 ! ------------------------------------------------------------------------------
730 ! Face gradients
731 ! ------------------------------------------------------------------------------
732 
733  IF ( pmixtinput%flowModel == flow_navst ) THEN
734  DEALLOCATE(pregion%mixt%gradFace,stat=errorflag)
735  global%error = errorflag
736  IF ( global%error /= err_none ) THEN
737  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%gradFace')
738  END IF ! global%error
739  END IF ! pMixtInput%flowModel
740 
741  IF ( pgrid%nPatches > 0 ) THEN
742  DO ipatch = 1,pregion%grid%nPatches
743  ppatch => pregion%patches(ipatch)
744 
745  IF ( rflu_decideneedbgradface(pregion,ppatch) .EQV. .true. ) THEN
746  DEALLOCATE(ppatch%mixt%gradFace,stat=errorflag)
747  global%error = errorflag
748  IF ( global%error /= err_none ) THEN
749  CALL errorstop(global,err_deallocate,__line__,'pPatch%mixt%gradFace')
750  END IF ! global%error
751  END IF ! RFLU_DecideNeedBGradFace
752  END DO ! iPatch
753  END IF ! pGrid%nPatches
754 
755 ! ==============================================================================
756 ! Grid motion. NOTE grid speeds are allocated separately because they are
757 ! written into grid file, and hence they need to be allocated in pre- and
758 ! postprocessors also.
759 ! ==============================================================================
760 
761  IF ( pmixtinput%moveGrid .EQV. .true. ) THEN
762 
763 ! ------------------------------------------------------------------------------
764 ! Residual
765 ! ------------------------------------------------------------------------------
766 
767  DEALLOCATE(pgrid%rhs,stat=errorflag)
768  global%error = errorflag
769  IF ( global%error /= err_none ) THEN
770  CALL errorstop(global,err_deallocate,__line__,'pGrid%rhs')
771  END IF ! global%error
772 
773 ! ------------------------------------------------------------------------------
774 ! Displacement
775 ! ------------------------------------------------------------------------------
776 
777  IF ( pmixtinput%moveGridType /= movegrid_type_xyz ) THEN
778  DEALLOCATE(pgrid%disp,stat=errorflag)
779  global%error = errorflag
780  IF ( global%error /= err_none ) THEN
781  CALL errorstop(global,err_deallocate,__line__,'pGrid%disp')
782  END IF ! global%error
783  END IF ! pMixtInput%moveGridType
784 
785 ! ------------------------------------------------------------------------------
786 ! Old coordinates
787 ! ------------------------------------------------------------------------------
788 
789  DEALLOCATE(pgridold%xyz,stat=errorflag)
790  global%error = errorflag
791  IF ( global%error /= err_none ) THEN
792  CALL errorstop(global,err_deallocate,__line__,'pRegion%gridOld%xyz')
793  END IF ! global%error
794 
795  IF ( global%solverType == solv_implicit_nk ) THEN
796  DEALLOCATE(pgridold2%xyz,stat=errorflag)
797  global%error = errorflag
798  IF ( global%error /= err_none ) THEN
799  CALL errorstop(global,err_deallocate,__line__,'pRegion%gridOld2%xyz')
800  END IF ! global%error
801  END IF ! global%solverType
802 
803 ! ------------------------------------------------------------------------------
804 ! Old volume
805 ! ------------------------------------------------------------------------------
806 
807  DEALLOCATE(pgridold%vol,stat=errorflag)
808  global%error = errorflag
809  IF ( global%error /= err_none ) THEN
810  CALL errorstop(global,err_deallocate,__line__,'pRegion%gridOld%vol')
811  END IF ! global%error
812 
813  IF ( global%solverType == solv_implicit_nk ) THEN
814  DEALLOCATE(pgridold2%vol,stat=errorflag)
815  global%error = errorflag
816  IF ( global%error /= err_none ) THEN
817  CALL errorstop(global,err_deallocate,__line__,'pRegion%gridOld2%vol')
818  END IF ! global%error
819  END IF ! global%solverType
820 
821 #ifndef GENX
822 ! ------------------------------------------------------------------------------
823 ! Patch displacements. NOTE allocate here only if not running inside GENX,
824 ! because when running inside GENX allocate displacements also for virtual
825 ! vertices.
826 ! ------------------------------------------------------------------------------
827 
828  IF ( pgrid%nPatches > 0 ) THEN
829  DO ipatch = 1,pgrid%nPatches
830  ppatch => pregion%patches(ipatch)
831 
832  DEALLOCATE(ppatch%dXyz,stat=errorflag)
833  global%error = errorflag
834  IF ( global%error /= err_none ) THEN
835  CALL errorstop(global,err_deallocate,__line__,'pPatch%dXyz')
836  END IF ! global%error
837 
838  END DO ! iPatch
839  END IF ! pGrid%nPatches
840 #endif
841  END IF ! pMixtInput%moveGrid
842 
843 #ifdef STATS
844 ! ==============================================================================
845 ! Time averaged statistics
846 ! ==============================================================================
847 
848  IF ( (global%flowType == flow_unsteady) .AND. &
849  (global%doStat == active) ) THEN
850  DEALLOCATE(pregion%mixt%tav,stat=errorflag)
851  global%error = errorflag
852  IF ( global%error /= err_none ) THEN
853  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%tav')
854  END IF ! global%error
855  END IF ! global%flowType
856 #endif
857 
858 ! ==============================================================================
859 ! Optimal LES
860 ! ==============================================================================
861 
862  IF ( pmixtinput%spaceDiscr == discr_opt_les ) THEN
863  CALL rflu_destroystencilsweightsoles(pregion)
864  END IF ! pMixtInput%spaceDiscr
865 
866 ! ==============================================================================
867 ! Substantial derivative
868 ! ==============================================================================
869 
870  DEALLOCATE(pregion%mixt%sd,stat=errorflag)
871  global%error = errorflag
872  IF ( global%error /= err_none ) THEN
873  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%sd')
874  END IF ! global%error
875 
876 ! ******************************************************************************
877 ! End
878 ! ******************************************************************************
879 
880  CALL deregisterfunction(global)
881 
882 END SUBROUTINE rflu_deallocatememorytstep
883 
884 
885 
886 
887 
888 
889 ! ******************************************************************************
890 !
891 ! Purpose: Deallocate memory for mixture time-stepping for compressible fluid.
892 !
893 ! Description: None.
894 !
895 ! Input:
896 ! pRegion Region pointer
897 !
898 ! Output: None.
899 !
900 ! Notes: None.
901 !
902 ! ******************************************************************************
903 
904 SUBROUTINE rflu_deallocatememorytstep_c(pRegion)
905 
906  IMPLICIT NONE
907 
908 ! ******************************************************************************
909 ! Definitions and declarations
910 ! ******************************************************************************
911 
912 ! ==============================================================================
913 ! Arguments
914 ! ==============================================================================
915 
916  TYPE(t_region), POINTER :: pregion
917 
918 ! ==============================================================================
919 ! Locals
920 ! ==============================================================================
921 
922  INTEGER :: errorflag,ipatch
923  TYPE(t_grid), POINTER :: pgrid
924  TYPE(t_patch), POINTER :: ppatch
925  TYPE(t_global), POINTER :: global
926 
927 ! ******************************************************************************
928 ! Start
929 ! ******************************************************************************
930 
931  global => pregion%global
932 
933  CALL registerfunction(global,'RFLU_DeallocateMemoryTStep_C',&
934  'RFLU_ModDeallocateMemory.F90')
935 
936 ! ******************************************************************************
937 ! Set pointers
938 ! ******************************************************************************
939 
940  pgrid => pregion%grid
941 
942 ! ******************************************************************************
943 ! Deallocate memory
944 ! ******************************************************************************
945 
946 ! ==============================================================================
947 ! Mass fluxes
948 ! ==============================================================================
949 
950  DEALLOCATE(pregion%mixt%mfMixt,stat=errorflag)
951  global%error = errorflag
952  IF ( global%error /= err_none ) THEN
953  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%mfMixt')
954  END IF ! global%error
955 
956  IF ( pregion%grid%nPatches > 0 ) THEN
957  DO ipatch = 1,pregion%grid%nPatches
958  ppatch => pregion%patches(ipatch)
959 
960  DEALLOCATE(ppatch%mfMixt,stat=errorflag)
961  global%error = errorflag
962  IF ( global%error /= err_none ) THEN
963  CALL errorstop(global,err_deallocate,__line__,'pPatch%mfMixt')
964  END IF ! global%error
965  END DO ! iPatch
966  END IF ! pRegion%grid%nPatches
967 
968 ! ******************************************************************************
969 ! End
970 ! ******************************************************************************
971 
972  CALL deregisterfunction(global)
973 
974 END SUBROUTINE rflu_deallocatememorytstep_c
975 
976 
977 
978 
979 
980 
981 ! ******************************************************************************
982 !
983 ! Purpose: Deallocate memory for mixture time-stepping for incompressible fluid.
984 !
985 ! Description: None.
986 !
987 ! Input:
988 ! pRegion Region pointer
989 !
990 ! Output: None.
991 !
992 ! Notes: None.
993 !
994 ! ******************************************************************************
995 
996 SUBROUTINE rflu_deallocatememorytstep_i(pRegion)
997 
998  IMPLICIT NONE
999 
1000 ! ******************************************************************************
1001 ! Definitions and declarations
1002 ! ******************************************************************************
1003 
1004 ! ==============================================================================
1005 ! Arguments
1006 ! ==============================================================================
1007 
1008  TYPE(t_region), POINTER :: pregion
1009 
1010 ! ==============================================================================
1011 ! Locals
1012 ! ==============================================================================
1013 
1014  INTEGER :: errorflag,ipatch
1015  TYPE(t_grid), POINTER :: pgrid
1016  TYPE(t_patch), POINTER :: ppatch
1017  TYPE(t_global), POINTER :: global
1018 
1019 ! ******************************************************************************
1020 ! Start
1021 ! ******************************************************************************
1022 
1023  global => pregion%global
1024 
1025  CALL registerfunction(global,'RFLU_DeallocateMemoryTStep_I',&
1026  'RFLU_ModDeallocateMemory.F90')
1027 
1028 ! ******************************************************************************
1029 ! Set pointers
1030 ! ******************************************************************************
1031 
1032  pgrid => pregion%grid
1033 
1034 ! ******************************************************************************
1035 ! Deallocate memory
1036 ! ******************************************************************************
1037 
1038 ! ==============================================================================
1039 ! Face velocities
1040 ! ==============================================================================
1041 
1042  DEALLOCATE(pregion%mixt%vfMixt,stat=errorflag)
1043  global%error = errorflag
1044  IF ( global%error /= err_none ) THEN
1045  CALL errorstop(global,err_deallocate,__line__,'pRegion%mixt%vfMixt')
1046  END IF ! global%error
1047 
1048  IF ( pregion%grid%nPatches > 0 ) THEN
1049  DO ipatch = 1,pregion%grid%nPatches
1050  ppatch => pregion%patches(ipatch)
1051 
1052  DEALLOCATE(ppatch%vfMixt,stat=errorflag)
1053  global%error = errorflag
1054  IF ( global%error /= err_none ) THEN
1055  CALL errorstop(global,err_deallocate,__line__,'pPatch%vfMixt')
1056  END IF ! global%error
1057  END DO ! iPatch
1058  END IF ! pRegion%grid%nPatches
1059 
1060 ! ******************************************************************************
1061 ! End
1062 ! ******************************************************************************
1063 
1064  CALL deregisterfunction(global)
1065 
1066 END SUBROUTINE rflu_deallocatememorytstep_i
1067 
1068 
1069 
1070 
1071 
1072 ! ******************************************************************************
1073 ! End
1074 ! ******************************************************************************
1075 
1076 END MODULE rflu_moddeallocatememory
1077 
1078 
1079 ! ******************************************************************************
1080 !
1081 ! RCS Revision history:
1082 !
1083 ! $Log: RFLU_ModDeallocateMemory.F90,v $
1084 ! Revision 1.11 2008/12/06 08:44:21 mtcampbe
1085 ! Updated license.
1086 !
1087 ! Revision 1.10 2008/11/19 22:17:32 mtcampbe
1088 ! Added Illinois Open Source License/Copyright
1089 !
1090 ! Revision 1.9 2006/11/01 15:50:00 haselbac
1091 ! Changed so implicit-solver arrays dealt with properly
1092 !
1093 ! Revision 1.8 2006/08/19 15:39:03 mparmar
1094 ! Moved region%mixt%bGradFace to patch%mixt%gradFace
1095 !
1096 ! Revision 1.7 2006/02/08 21:03:47 hdewey2
1097 ! Added old2 quantities
1098 !
1099 ! Revision 1.6 2005/09/22 17:11:04 hdewey2
1100 ! Added deallocation of cvOld1 and cvOld2 for transient implicit solver.
1101 !
1102 ! Revision 1.5 2005/07/14 21:43:26 haselbac
1103 ! Added AUSM flux function to memory deallocation IF statement
1104 !
1105 ! Revision 1.4 2004/12/19 15:47:08 haselbac
1106 ! Added memory deallocation for incompressible solver
1107 !
1108 ! Revision 1.3 2004/10/19 19:38:48 haselbac
1109 ! Updated for GEN3
1110 !
1111 ! Revision 1.2 2004/07/30 22:47:36 jferry
1112 ! Implemented Equilibrium Eulerian method for Rocflu
1113 !
1114 ! Revision 1.1 2004/03/19 21:15:19 haselbac
1115 ! Initial revision
1116 !
1117 ! ******************************************************************************
1118 
1119 
1120 
1121 
1122 
1123 
1124 
1125 
1126 
1127 
1128 
1129 
1130 
1131 
1132 
subroutine, public rflu_deallocatememorytstep(pRegion)
subroutine, public rflu_deallocatememorysol(pRegion)
subroutine, public rflu_deallocatememorysolgv(pRegion)
subroutine, public rflu_deallocatememorygspeeds(pRegion)
LOGICAL function rflu_decideneedbgradface(pRegion, pPatch)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine, public rflu_deallocatememorytstep_i(pRegion)
subroutine, public rflu_deallocatememorysolcv(pRegion)
subroutine, public rflu_deallocatememorysoldv(pRegion)
subroutine, public rflu_deallocatememorytstep_c(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, public rflu_deallocatememorysoltv(pRegion)
subroutine, public rflu_destroystencilsweightsoles(pRegion)