Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_CalcDerivedVariables.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: update PLAG derived variables (dv) arrays.
26 !
27 ! Description: none.
28 !
29 ! Input: region = current region.
30 !
31 ! Output: region%levels%plag%dv
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: PLAG_CalcDerivedVariables.F90,v 1.3 2008/12/06 08:44:33 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2002 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE plag_calcderivedvariables( region )
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
47  USE modglobal, ONLY : t_global
48  USE modpartlag, ONLY : t_plag, t_plag_input
49  USE moderror
50  USE modparameters
52  IMPLICIT NONE
53 
54 ! ... parameters
55  TYPE(t_region), INTENT(INOUT), TARGET :: region
56 
57 ! ... loop variables
58  INTEGER :: icont, ipcls
59 
60 ! ... local variables
61  CHARACTER(CHRLEN) :: rcsidentstring
62 
63 #ifdef RFLO
64  INTEGER :: ilev
65 #endif
66  INTEGER :: ncont, npcls
67  INTEGER, POINTER, DIMENSION(:) :: pcvplagmass, pdvplagvolu
68  INTEGER, POINTER, DIMENSION(:,:) :: paiv
69 
70  REAL(RFREAL) :: heatcapsum, masssum, masssumr, &
71  onethird, pi, pir, volusum
72  REAL(RFREAL), POINTER, DIMENSION(:) :: pdens, pmixtvol, pspcheat
73  REAL(RFREAL), POINTER, DIMENSION(:,:) :: pcv, pdv
74 
75  TYPE(t_plag) , POINTER :: pplag
76  TYPE(t_global), POINTER :: global
77 
78 !******************************************************************************
79 
80  rcsidentstring = '$RCSfile: PLAG_CalcDerivedVariables.F90,v $ $Revision: 1.3 $'
81 
82  global => region%global
83 
84  CALL registerfunction( global, 'PLAG_CalcDerivedVariables',&
85  'PLAG_CalcDerivedVariables.F90' )
86 
87 ! Get dimensions --------------------------------------------------------------
88 
89  onethird = 1.0_rfreal/3.0_rfreal
90  pi = global%pi
91  pir = 1.0_rfreal/pi
92 
93 #ifdef RFLO
94  ilev = region%currLevel
95  npcls = region%levels(ilev)%plag%nPcls
96 #endif
97 #ifdef RFLU
98  npcls = region%plag%nPcls
99 #endif
100  ncont = region%plagInput%nCont
101 
102 ! Set pointers ----------------------------------------------------------------
103 
104 #ifdef RFLO
105  pmixtvol => region%levels(ilev)%grid%vol
106  pplag => region%levels(ilev)%plag
107 #endif
108 #ifdef RFLU
109  pmixtvol => region%grid%vol
110  pplag => region%plag
111 #endif
112 
113  paiv => pplag%aiv
114  pcv => pplag%cv
115  pdv => pplag%dv
116 
117  pcvplagmass => pplag%cvPlagMass
118  pdvplagvolu => pplag%dvPlagVolu
119 
120  pdens => region%plagInput%dens
121  pspcheat => region%plagInput%spht
122 
123 ! Calculate derived variables for Lagrangian field ----------------------------
124 
125  DO ipcls = 1, npcls
126 
127 !- Compute particle mass ------------------------------------------------------
128 
129  masssum = sum( pcv(pplag%cvPlagMass(:),ipcls) )
130  masssumr = 1.0_rfreal/masssum
131 
132 !- Compute particle volume for each constituent -------------------------------
133 
134  DO icont = 1, ncont
135  pdv(pdvplagvolu(icont),ipcls) = pcv(pcvplagmass(icont),ipcls) / &
136  pdens(icont)
137  END DO ! iCont
138 
139 !- Compute particle volume ----------------------------------------------------
140 
141  volusum = sum( pdv(pdvplagvolu(:),ipcls) )
142 
143 !- Compute particle heat capacity ---------------------------------------------
144 
145  heatcapsum = sum(pcv(pcvplagmass(:),ipcls) * pspcheat(:) )
146 
147 !- Extract derived variables --------------------------------------------------
148 
149  pdv(dv_plag_uvel,ipcls) = pcv(cv_plag_xmom,ipcls) * masssumr
150  pdv(dv_plag_vvel,ipcls) = pcv(cv_plag_ymom,ipcls) * masssumr
151  pdv(dv_plag_wvel,ipcls) = pcv(cv_plag_zmom,ipcls) * masssumr
152 
153  pdv(dv_plag_dens,ipcls) = masssum/volusum
154  pdv(dv_plag_diam,ipcls) = (6.0_rfreal*pir*volusum)**onethird
155  pdv(dv_plag_area,ipcls) = (9.0_rfreal*pi *volusum/16.0_rfreal)**onethird
156 
157  pdv(dv_plag_spht,ipcls) = heatcapsum * masssumr
158  pdv(dv_plag_temp,ipcls) = ( pcv(cv_plag_ener,ipcls)*masssumr &
159  - 0.5_rfreal*(pdv(dv_plag_uvel,ipcls)**2 &
160  +pdv(dv_plag_vvel,ipcls)**2 &
161  +pdv(dv_plag_wvel,ipcls)**2 ) )/ &
162  pdv(dv_plag_spht,ipcls)
163 
164  pdv(dv_plag_volu,ipcls) = volusum
165  END DO ! iPcls
166 
167 ! finalize --------------------------------------------------------------------
168 
169  CALL deregisterfunction( global )
170 
171 END SUBROUTINE plag_calcderivedvariables
172 
173 !******************************************************************************
174 !
175 ! RCS Revision history:
176 !
177 ! $Log: PLAG_CalcDerivedVariables.F90,v $
178 ! Revision 1.3 2008/12/06 08:44:33 mtcampbe
179 ! Updated license.
180 !
181 ! Revision 1.2 2008/11/19 22:17:45 mtcampbe
182 ! Added Illinois Open Source License/Copyright
183 !
184 ! Revision 1.1 2004/12/01 20:57:01 fnajjar
185 ! Initial revision after changing case
186 !
187 ! Revision 1.6 2004/03/26 21:27:03 fnajjar
188 ! Set particle volume in dv array
189 !
190 ! Revision 1.5 2004/03/02 21:50:03 jferry
191 ! Changed name of DV_PLAG_HTCP to DV_PLAG_SPHT
192 !
193 ! Revision 1.4 2004/02/06 21:18:20 fnajjar
194 ! Initial Integration of Rocpart with Rocflu
195 !
196 ! Revision 1.3 2003/01/16 20:15:11 f-najjar
197 ! Removed iRegionGlobal
198 !
199 ! Revision 1.2 2002/12/03 19:55:37 f-najjar
200 ! Fixed subroutine string name in RegisterFunction
201 !
202 ! Revision 1.1 2002/10/25 14:14:44 f-najjar
203 ! Initial Import of Rocpart
204 !
205 !
206 !******************************************************************************
207 
208 
209 
210 
211 
212 
213 
Tfloat sum() const
Return the sum of all the pixel values in an image.
Definition: CImg.h:13022
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
static const double pi
Definition: smooth_medial.C:43
subroutine plag_calcderivedvariables(region)
subroutine deregisterfunction(global)
Definition: ModError.F90:469