Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_RFLU_CorrectMixtProperties.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: Correct the mixture properties using higher-order
26 ! interpolation schemed onto particle locations
27 !
28 ! Description: none.
29 !
30 ! Input: pRegion = current region.
31 !
32 ! Output: region%levels%plag%dv
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PLAG_RFLU_CorrectMixtProperties.F90,v 1.4 2008/12/06 08:44:35 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2005 by the University of Illinois
41 !
42 !******************************************************************************
43 
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY : t_region
48  USE modglobal, ONLY : t_global
49  USE modgrid, ONLY: t_grid
50  USE modpartlag, ONLY : t_plag, t_plag_input
51  USE modmixture, ONLY : t_mixt
52  USE moderror
53  USE modparameters
55 
56  USE modinterfaces, ONLY: mixtperf_r_m, &
58 
59  IMPLICIT NONE
60 
61 ! ******************************************************************************
62 ! Declarations and definitions
63 ! ******************************************************************************
64 
65 ! ==============================================================================
66 ! Arguments
67 ! ==============================================================================
68 
69  TYPE(t_region), POINTER :: pregion
70 
71 ! ==============================================================================
72 ! Locals
73 ! ==============================================================================
74 
75  CHARACTER(CHRLEN) :: rcsidentstring
76  INTEGER :: icg,indmol,intrplmixtmodel,ipcl,npcls
77  INTEGER, POINTER, DIMENSION(:,:) :: paiv
78 
79  REAL(RFREAL) :: dx,dy,dz,gc,mm,p,r
80  REAL(RFREAL), POINTER, DIMENSION(:,:) :: pcv,pdv,pdvmixt,pgvmixt
81  REAL(RFREAL), POINTER, DIMENSION(:,:,:) :: pgrad
82 
83  TYPE(t_global), POINTER :: global
84  TYPE(t_grid), POINTER :: pgrid
85  TYPE(t_plag), POINTER :: pplag
86  TYPE(t_mixt), POINTER :: pmixt
87 
88 ! ******************************************************************************
89 ! Start
90 ! ******************************************************************************
91 
92  rcsidentstring = '$RCSfile: PLAG_RFLU_CorrectMixtProperties.F90,v $ $Revision: 1.4 $'
93 
94  global => pregion%global
95 
96  CALL registerfunction( global, 'PLAG_RFLU_CorrectMixtProperties',&
97  'PLAG_RFLU_CorrectMixtProperties.F90' )
98 
99 ! ******************************************************************************
100 ! Set variables and pointers
101 ! ******************************************************************************
102 
103  pmixt => pregion%mixt
104  pgrid => pregion%grid
105  pplag => pregion%plag
106 
107  pdvmixt => pmixt%dv
108  pgvmixt => pmixt%gv
109 
110  npcls = pregion%plag%nPcls
111  indmol = pregion%mixtInput%indMol
112 
113  intrplmixtmodel = pregion%plagInput%intrplMixtModel
114 
115 ! ******************************************************************************
116 ! Set pointers for mixture
117 ! ******************************************************************************
118 
119  pdvmixt => pmixt%dv
120  pgvmixt => pmixt%gv
121 
122  pgrad => pregion%mixt%gradCell
123 
124 ! ******************************************************************************
125 ! Set pointers for discrete particles
126 ! ******************************************************************************
127 
128  paiv => pplag%aiv
129  pcv => pplag%cv
130  pdv => pplag%dv
131 
132 ! ******************************************************************************
133 ! Check that have primitive state vector
134 ! ******************************************************************************
135 
136  IF ( pmixt%cvState /= cv_mixt_state_duvwp ) THEN
137  CALL errorstop(global,err_cv_state_invalid,__line__)
138  END IF ! pMixt%cvState
139 
140 ! ******************************************************************************
141 ! Trap error for inconsistent input deck
142 ! ******************************************************************************
143 
144  IF ( intrplmixtmodel /= zeroth_order .AND. &
145  pregion%mixtInput%spaceOrder == 1 ) THEN
146  CALL errorstop(global,err_plag_intrplmodel,__line__)
147  END IF ! intrplMixtModel
148 
149 ! ******************************************************************************
150 ! Correct discrete particle dv
151 ! ******************************************************************************
152 
153  SELECT CASE ( intrplmixtmodel )
154  CASE ( zeroth_order )
155  CASE ( first_order )
156  DO ipcl = 1, npcls
157  icg = paiv(aiv_plag_icells,ipcl)
158 
159  dx = pcv(cv_plag_xpos,ipcl) - pgrid%cofg(xcoord,icg)
160  dy = pcv(cv_plag_ypos,ipcl) - pgrid%cofg(ycoord,icg)
161  dz = pcv(cv_plag_zpos,ipcl) - pgrid%cofg(zcoord,icg)
162 
163  pdv(dv_plag_uvelmixt,ipcl) = pdv(dv_plag_uvelmixt,ipcl) &
164  + pgrad(xcoord,grc_mixt_xvel,icg)*dx &
165  + pgrad(ycoord,grc_mixt_xvel,icg)*dy &
166  + pgrad(zcoord,grc_mixt_xvel,icg)*dz
167  pdv(dv_plag_vvelmixt,ipcl) = pdv(dv_plag_vvelmixt,ipcl) &
168  + pgrad(xcoord,grc_mixt_yvel,icg)*dx &
169  + pgrad(ycoord,grc_mixt_yvel,icg)*dy &
170  + pgrad(zcoord,grc_mixt_yvel,icg)*dz
171  pdv(dv_plag_wvelmixt,ipcl) = pdv(dv_plag_wvelmixt,ipcl) &
172  + pgrad(xcoord,grc_mixt_zvel,icg)*dx &
173  + pgrad(ycoord,grc_mixt_zvel,icg)*dy &
174  + pgrad(zcoord,grc_mixt_zvel,icg)*dz
175  pdv(dv_plag_presmixt,ipcl) = pdv(dv_plag_presmixt,ipcl) &
176  + pgrad(xcoord,grc_mixt_pres,icg)*dx &
177  + pgrad(ycoord,grc_mixt_pres,icg)*dy &
178  + pgrad(zcoord,grc_mixt_pres,icg)*dz
179  pdv(dv_plag_densmixt,ipcl) = pdv(dv_plag_densmixt,ipcl) &
180  + pgrad(xcoord,grc_mixt_dens,icg)*dx &
181  + pgrad(ycoord,grc_mixt_dens,icg)*dy &
182  + pgrad(zcoord,grc_mixt_dens,icg)*dz
183  END DO ! iPcl
184 
185  SELECT CASE ( pregion%mixtInput%gasModel )
186  CASE ( gas_model_tcperf,gas_model_mixt_tcperf )
187  DO ipcl = 1,npcls
188  icg = paiv(aiv_plag_icells,ipcl)
189 
190  mm = pgvmixt(gv_mixt_mol,indmol*icg)
191  gc = mixtperf_r_m(mm)
192 
193  r = pdv(dv_plag_densmixt,ipcl)
194  p = pdv(dv_plag_presmixt,ipcl)
195 
196  pdv(dv_plag_tempmixt,ipcl) = mixtperf_t_dpr(r,p,gc)
197  END DO ! iPcl
198  CASE default
199  CALL errorstop( global,err_reached_default,__line__ )
200  END SELECT ! pRegion%mixtInput%gasModel
201 
202  CASE ( second_order )
203  CALL errorstop( global,err_reached_default,__line__ )
204  CASE default
205  CALL errorstop( global,err_reached_default,__line__ )
206  END SELECT ! intrplMixtModel
207 
208 ! ******************************************************************************
209 ! End
210 ! ******************************************************************************
211 
212  CALL deregisterfunction( global )
213 
214 END SUBROUTINE plag_rflu_correctmixtproperties
215 
216 !******************************************************************************
217 !
218 ! RCS Revision history:
219 !
220 ! $Log: PLAG_RFLU_CorrectMixtProperties.F90,v $
221 ! Revision 1.4 2008/12/06 08:44:35 mtcampbe
222 ! Updated license.
223 !
224 ! Revision 1.3 2008/11/19 22:17:47 mtcampbe
225 ! Added Illinois Open Source License/Copyright
226 !
227 ! Revision 1.2 2006/04/07 15:19:24 haselbac
228 ! Removed tabs
229 !
230 ! Revision 1.1 2005/11/30 22:26:54 fnajjar
231 ! Initial version
232 !
233 !******************************************************************************
234 
235 
236 
237 
238 
239 
240 
subroutine plag_rflu_correctmixtproperties(pRegion)
unsigned char r() const
Definition: Color.h:68
real(rfreal) function mixtperf_r_m(M)
Definition: MixtPerf_R.F90:54
NT dx
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
real(rfreal) function mixtperf_t_dpr(D, P, R)
Definition: MixtPerf_T.F90:85
RT dz() const
Definition: Direction_3.h:133
NT dy
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469