Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_DeallocateMemoryPost.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 main variables associated with the Lagrangian
26 ! particles (PLAG) for all active regions on current processor.
27 !
28 ! Description: none.
29 !
30 ! Input: region = current region data
31 ! iReg = current region
32 !
33 ! Output: region%plag = plag variables
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: PLAG_DeallocateMemoryPost.F90,v 1.3 2008/12/06 08:45:07 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2005 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE plag_deallocatememorypost( region, iReg )
46 
47  USE moddatatypes
48  USE moddatastruct, ONLY : t_region, t_level
49  USE modglobal, ONLY : t_global
50  USE modpartlag, ONLY : t_plag, t_plag_input
51  USE moderror
52  USE modparameters
53  USE modmpi
55  IMPLICIT NONE
56 
57 ! ... parameters
58  TYPE(t_region) :: region
59 
60  INTEGER, INTENT(IN) :: ireg
61 
62 ! ... loop variables
63  INTEGER :: icont, ilev
64 
65 ! ... local variables
66  CHARACTER(CHRLEN) :: rcsidentstring
67 
68  INTEGER :: errorflag
69 
70  TYPE(t_level), POINTER :: plevel
71  TYPE(t_plag), POINTER :: pplag
72  TYPE(t_global), POINTER :: global
73 
74 !******************************************************************************
75 
76  rcsidentstring = '$RCSfile: PLAG_DeallocateMemoryPost.F90,v $ $Revision: 1.3 $'
77 
78  global => region%global
79 
80  CALL registerfunction( global, 'PLAG_DeallocateMemoryPost',&
81  'PLAG_DeallocateMemoryPost.F90' )
82 
83  IF ( ireg == 1 .AND. global%myProcid == masterproc .AND. &
84  global%verbLevel > verbose_none ) THEN
85  WRITE(stdout,'(A,3X,A)') solver_name,'Deallocating memory for PLAG...'
86  END IF ! global%verbLevel
87 
88 ! Loop over all grid levels ---------------------------------------------------
89 
90  DO ilev=1,region%nGridLevels
91 
92  plevel => region%levels(ilev)
93  pplag => region%levels(ilev)%plag
94 
95 ! - Lagrangian particles variables --------------------------------------------
96 
97  DEALLOCATE( pplag%aiv,stat=errorflag )
98  global%error = errorflag
99  IF (global%error /= err_none) THEN
100  CALL errorstop( global, err_deallocate,__line__ ,'pPlag%aiv' )
101  END IF ! global%error
102 
103  DEALLOCATE( pplag%arv,stat=errorflag )
104  global%error = errorflag
105  IF (global%error /= err_none) THEN
106  CALL errorstop( global, err_deallocate,__line__ ,'pPlag%arv' )
107  END IF ! global%error
108 
109  DEALLOCATE( pplag%cv,stat=errorflag )
110  global%error = errorflag
111  IF (global%error /= err_none) THEN
112  CALL errorstop( global, err_deallocate,__line__ ,'pPlag%cv' )
113  END IF ! global%error
114 
115  DEALLOCATE( pplag%dv,stat=errorflag )
116  global%error = errorflag
117  IF (global%error /= err_none) THEN
118  CALL errorstop( global, err_deallocate,__line__ ,'pPlag%dv' )
119  END IF ! global%error
120 
121  DEALLOCATE( pplag%tv,stat=errorflag )
122  global%error = errorflag
123  IF (global%error /= err_none) THEN
124  CALL errorstop( global, err_deallocate,__line__ ,'pPlag%tv' )
125  END IF ! global%error
126 
127 ! - Lagrangian particles mass and volume indices ------------------------------
128 
129  DEALLOCATE( pplag%cvPlagMass,stat=errorflag )
130  global%error = errorflag
131  IF (global%error /= err_none) THEN
132  CALL errorstop( global, err_deallocate,__line__ ,'pPlag%cvPlagMass' )
133  END IF ! global%error
134 
135  DEALLOCATE( pplag%dvPlagVolu,stat=errorflag )
136  global%error = errorflag
137  IF (global%error /= err_none) THEN
138  CALL errorstop( global, err_deallocate,__line__ ,'pPlag%dvPlagVolu' )
139  END IF ! global%error
140 
141  ENDDO ! iLev
142 
143 ! finalize
144 
145  IF ( ireg == global%nRegions .AND. global%myProcid == masterproc .AND. &
146  global%verbLevel > verbose_none ) THEN
147  WRITE(stdout,'(A,3X,A)') solver_name,'Deallocating memory for PLAG done...'
148  END IF ! global%verbLevel
149 
150  CALL deregisterfunction( global )
151 
152 END SUBROUTINE plag_deallocatememorypost
153 
154 !******************************************************************************
155 !
156 ! RCS Revision history:
157 !
158 ! $Log: PLAG_DeallocateMemoryPost.F90,v $
159 ! Revision 1.3 2008/12/06 08:45:07 mtcampbe
160 ! Updated license.
161 !
162 ! Revision 1.2 2008/11/19 22:18:18 mtcampbe
163 ! Added Illinois Open Source License/Copyright
164 !
165 ! Revision 1.1 2005/02/16 14:52:40 fnajjar
166 ! Initial import
167 !
168 !******************************************************************************
169 
170 
171 
172 
173 
174 
175 
subroutine plag_deallocatememorypost(region, iReg)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469