Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_AllocateMemoryPost.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 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
31 !
32 ! Output: region%plag = plag variables
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PLAG_AllocateMemoryPost.F90,v 1.5 2008/12/06 08:45:07 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2003 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE plag_allocatememorypost( region, iReg )
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY : t_region, t_level
48  USE modglobal, ONLY : t_global
49  USE modpartlag, ONLY : t_plag, t_plag_input
50  USE moderror
51  USE modparameters
52  USE modmpi
54  IMPLICIT NONE
55 
56 ! ... parameters
57  TYPE(t_region) :: region
58 
59  INTEGER, INTENT(IN) :: ireg
60 
61 ! ... loop variables
62  INTEGER :: icont, ilev
63 
64 ! ... local variables
65  CHARACTER(CHRLEN) :: rcsidentstring
66 
67  INTEGER :: errorflag, kdnend, naiv, narv, ncont, ncv, ndv, npclsmax, ntv
68 
69  TYPE(t_level), POINTER :: plevel
70  TYPE(t_plag), POINTER :: pplag
71  TYPE(t_global), POINTER :: global
72 
73 !******************************************************************************
74 
75  rcsidentstring = '$RCSfile: PLAG_AllocateMemoryPost.F90,v $ $Revision: 1.5 $'
76 
77  global => region%global
78 
79  CALL registerfunction( global, 'PLAG_AllocateMemoryPost',&
80  'PLAG_AllocateMemoryPost.F90' )
81 
82  IF ( global%myProcid == masterproc .AND. &
83  global%verbLevel > verbose_none ) THEN
84  WRITE(stdout,'(A,3X,A)') solver_name,'Allocating memory for PLAG...'
85  END IF ! global%verbLevel
86 
87 ! Loop over all grid levels ---------------------------------------------------
88 
89  DO ilev=1,region%nGridLevels
90 
91  plevel => region%levels(ilev)
92  pplag => region%levels(ilev)%plag
93 
94 ! - Get particle dimensions ---------------------------------------------------
95 
96  npclsmax = region%plagInput%nPclsMax
97  ncont = region%plagInput%nCont
98 
99  IF ( ireg == 1 ) &
100  print*,' PLAG_AllocateMemoryPost: nPclsMax = ',npclsmax
101 
102 ! - Set pointers --------------------------------------------------------------
103 
104  pplag%nCv = cv_plag_last + ncont
105  pplag%nDv = dv_plag_last + ncont
106  pplag%nTv = tv_plag_last
107  pplag%nAiv = aiv_plag_last
108  pplag%nArv = arv_plag_last
109 
110  naiv = pplag%nAiv
111  narv = pplag%nArv
112 
113  ncv = pplag%nCv
114  ndv = pplag%nDv
115  ntv = pplag%nTv
116 
117  IF ( global%myProcid == masterproc .AND. &
118  global%verbLevel > verbose_none ) THEN
119  WRITE(stdout,1015) ' nPclsMax',npclsmax
120  WRITE(stdout,1010) ' nCont ',ncont
121  WRITE(stdout,1010) ' nAiv ',naiv
122  WRITE(stdout,1010) ' nArv ',narv
123  WRITE(stdout,1010) ' nCv ',ncv
124  WRITE(stdout,1010) ' nDv ',ndv
125  WRITE(stdout,1010) ' nTv ',ntv
126  END IF ! global%verbLevel
127 
128 ! - Lagrangian particles variables --------------------------------------------
129 
130  ALLOCATE( pplag%aiv(naiv,npclsmax),stat=errorflag )
131  global%error = errorflag
132  IF (global%error /= err_none) THEN
133  CALL errorstop( global, err_allocate,__line__ ,'pPlag%aiv' )
134  END IF ! global%error
135 
136  ALLOCATE( pplag%arv(narv,npclsmax),stat=errorflag )
137  global%error = errorflag
138  IF (global%error /= err_none) THEN
139  CALL errorstop( global, err_allocate,__line__ ,'pPlag%arv' )
140  END IF ! global%error
141 
142  ALLOCATE( pplag%cv (ncv,npclsmax),stat=errorflag )
143  global%error = errorflag
144  IF (global%error /= err_none) THEN
145  CALL errorstop( global, err_allocate,__line__ ,'pPlag%cv' )
146  END IF ! global%error
147 
148  ALLOCATE( pplag%dv (ndv,npclsmax),stat=errorflag )
149  global%error = errorflag
150  IF (global%error /= err_none) THEN
151  CALL errorstop( global, err_allocate,__line__ ,'pPlag%dv' )
152  END IF ! global%error
153 
154  ALLOCATE( pplag%tv (ntv,npclsmax),stat=errorflag )
155  global%error = errorflag
156  IF (global%error /= err_none) THEN
157  CALL errorstop( global, err_allocate,__line__ ,'pPlag%tv' )
158  END IF ! global%error
159 
160 ! - Lagrangian particles mass and volume indices ------------------------------
161 
162  ALLOCATE( pplag%cvPlagMass(ncont),stat=errorflag )
163  global%error = errorflag
164  IF (global%error /= err_none) THEN
165  CALL errorstop( global, err_allocate,__line__ ,'pPlag%cvPlagMass' )
166  END IF ! global%error
167 
168  ALLOCATE( pplag%dvPlagVolu(ncont),stat=errorflag )
169  global%error = errorflag
170  IF (global%error /= err_none) THEN
171  CALL errorstop( global, err_allocate,__line__ ,'pPlag%dvPlagVolu' )
172  END IF ! global%error
173 
174  DO icont = 1, ncont
175  pplag%cvPlagMass(icont) = cv_plag_last +icont
176  pplag%dvPlagVolu(icont) = dv_plag_last +icont
177  END DO ! iCont
178 
179  ENDDO ! iLev
180 
181 ! finalize
182 
183  IF ( global%myProcid == masterproc .AND. &
184  global%verbLevel > verbose_none ) THEN
185  WRITE(stdout,'(A,3X,A)') solver_name,'Allocating memory for PLAG done...'
186  END IF ! global%verbLevel
187 
188  CALL deregisterfunction( global )
189 
190 1010 FORMAT(a,' = ',i2)
191 1015 FORMAT(a,' = ',i7)
192 
193 END SUBROUTINE plag_allocatememorypost
194 
195 !******************************************************************************
196 !
197 ! RCS Revision history:
198 !
199 ! $Log: PLAG_AllocateMemoryPost.F90,v $
200 ! Revision 1.5 2008/12/06 08:45:07 mtcampbe
201 ! Updated license.
202 !
203 ! Revision 1.4 2008/11/19 22:18:17 mtcampbe
204 ! Added Illinois Open Source License/Copyright
205 !
206 ! Revision 1.3 2007/03/06 23:27:44 fnajjar
207 ! Renamed nPclsTot to nPclsMax
208 !
209 ! Revision 1.2 2005/02/16 14:50:19 fnajjar
210 ! Cosmetic change to include verbosity at end of routine
211 !
212 ! Revision 1.1 2004/12/01 22:00:46 fnajjar
213 ! Initial revision after changing case
214 !
215 ! Revision 1.1.1.1 2003/05/06 16:14:38 fnajjar
216 ! Import of postprocessing tool for Rocpart
217 !
218 !******************************************************************************
219 
220 
221 
222 
223 
224 
225 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine plag_allocatememorypost(region, iReg)
virtual std::ostream & print(std::ostream &os) const
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
RT a() const
Definition: Line_2.h:140