Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_RFLU_AllocMemTStep.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 Lagrangian particles related to time stepping.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Region pointer
31 ! pPlag Pointer to particle data structure
32 !
33 ! Output: None.
34 !
35 ! Notes: None.
36 !
37 !******************************************************************************
38 !
39 ! $Id: PLAG_RFLU_AllocMemTStep.F90,v 1.8 2008/12/06 08:44:35 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2004 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE plag_rflu_allocmemtstep(pRegion,pPlag)
46 
47  USE moddatatypes
48  USE moderror
49  USE modparameters
50  USE modglobal, ONLY: t_global
51  USE modgrid, ONLY: t_grid
52  USE moddatastruct, ONLY: t_region
53  USE modpartlag, ONLY: t_plag
54  USE modmpi
55 
56  IMPLICIT NONE
57 
58 ! ******************************************************************************
59 ! Definitions and declarations
60 ! ******************************************************************************
61 
62 ! ==============================================================================
63 ! Arguments
64 ! ==============================================================================
65 
66  TYPE(t_region), POINTER :: pregion
67  TYPE(t_plag), POINTER :: pplag
68 
69 ! ==============================================================================
70 ! Locals
71 ! ==============================================================================
72 
73  CHARACTER(CHRLEN) :: rcsidentstring
74  INTEGER :: errorflag,ipcl,ivar,naiv,narv,ncv,npclsmax
75  TYPE(t_grid), POINTER :: pgrid
76  TYPE(t_global), POINTER :: global
77 
78 ! ******************************************************************************
79 ! Start
80 ! ******************************************************************************
81 
82  rcsidentstring = '$RCSfile: PLAG_RFLU_AllocMemTStep.F90,v $ $Revision: 1.8 $'
83 
84  global => pregion%global
85 
86  CALL registerfunction(global,'PLAG_RFLU_AllocMemTStep',&
87  'PLAG_RFLU_AllocMemTStep.F90')
88 
89 ! ******************************************************************************
90 ! Set pointers and variables
91 ! ******************************************************************************
92 
93  pgrid => pregion%grid
94 
95  npclsmax = pregion%plag%nPclsMax
96 
97  naiv = pplag%nAiv
98  narv = pplag%nArv
99 
100  ncv = pplag%nCv
101 
102 ! ******************************************************************************
103 ! Allocate memory
104 ! ******************************************************************************
105 
106 ! ==============================================================================
107 ! Old state vector
108 ! ==============================================================================
109 
110  ALLOCATE(pplag%cvOld(ncv,npclsmax),stat=errorflag)
111  global%error = errorflag
112  IF (global%error /= err_none) THEN
113  CALL errorstop(global,err_allocate,__line__,'pPlag%cvOld')
114  END IF ! global%error
115 
116 ! ==============================================================================
117 ! Additional variables
118 ! ==============================================================================
119 
120  ALLOCATE(pplag%aivOld(naiv,npclsmax),stat=errorflag)
121  global%error = errorflag
122  IF (global%error /= err_none) THEN
123  CALL errorstop(global,err_allocate,__line__,'pPlag%aivOld')
124  END IF ! global%error
125 
126  ALLOCATE(pplag%arvOld(narv,npclsmax),stat=errorflag)
127  global%error = errorflag
128  IF (global%error /= err_none) THEN
129  CALL errorstop(global,err_allocate,__line__,'pPlag%arvOld')
130  END IF ! global%error
131 
132 ! ==============================================================================
133 ! Residuals
134 ! ==============================================================================
135 
136  ALLOCATE(pplag%rhs(ncv,npclsmax),stat=errorflag)
137  global%error = errorflag
138  IF (global%error /= err_none) THEN
139  CALL errorstop(global,err_allocate,__line__,'pPlag%rhs')
140  END IF ! global%error
141 
142  ALLOCATE(pplag%rhsSum(ncv,npclsmax),stat=errorflag)
143  global%error = errorflag
144  IF (global%error /= err_none) THEN
145  CALL errorstop(global,err_allocate,__line__,'pPlag%rhsSum')
146  END IF ! global%error
147 
148 ! ******************************************************************************
149 ! Initialize memory
150 ! ******************************************************************************
151 
152  DO ipcl = 1,npclsmax
153  DO ivar = 1,ncv
154  pplag%cvOld(ivar,ipcl) = 0.0_rfreal
155  pplag%rhs(ivar,ipcl) = 0.0_rfreal
156  pplag%rhsSum(ivar,ipcl) = 0.0_rfreal
157  END DO ! iVar
158 
159  DO ivar = 1,naiv
160  pplag%aivOld(ivar,ipcl) = 0
161  END DO ! iVar
162 
163  DO ivar = 1,narv
164  pplag%arvOld(ivar,ipcl) = 0
165  END DO ! iVar
166  END DO ! iPcl
167 
168 ! ******************************************************************************
169 ! End
170 ! ******************************************************************************
171 
172  CALL deregisterfunction(global)
173 
174 END SUBROUTINE plag_rflu_allocmemtstep
175 
176 !******************************************************************************
177 !
178 ! RCS Revision history:
179 !
180 ! $Log: PLAG_RFLU_AllocMemTStep.F90,v $
181 ! Revision 1.8 2008/12/06 08:44:35 mtcampbe
182 ! Updated license.
183 !
184 ! Revision 1.7 2008/11/19 22:17:47 mtcampbe
185 ! Added Illinois Open Source License/Copyright
186 !
187 ! Revision 1.6 2007/03/06 23:15:32 fnajjar
188 ! Renamed nPclsTot to nPclsMax
189 !
190 ! Revision 1.5 2006/04/07 15:19:24 haselbac
191 ! Removed tabs
192 !
193 ! Revision 1.4 2004/07/28 18:58:13 fnajjar
194 ! Included new definition for nPclsTot from dynamic memory reallocation
195 !
196 ! Revision 1.3 2004/07/16 20:09:39 fnajjar
197 ! Bug fix to initialize cvOld instead of cv
198 !
199 ! Revision 1.2 2004/03/08 23:02:28 fnajjar
200 ! Added initialization section within DO-loop construct
201 !
202 ! Revision 1.1 2004/02/26 21:00:39 haselbac
203 ! Initial revision
204 !
205 !******************************************************************************
206 
207 
208 
209 
210 
211 
212 
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
subroutine plag_rflu_allocmemtstep(pRegion, pPlag)