Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_SetTransportVars.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: Set transport variables.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to region
31 ! icgBeg Beginning cell index
32 ! icgEnd Ending cell index
33 !
34 ! Output: None.
35 !
36 ! Notes: None.
37 !
38 ! ******************************************************************************
39 !
40 ! $Id: RFLU_SetTransportVars.F90,v 1.6 2008/12/06 08:44:13 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2004-2006 by the University of Illinois
43 !
44 ! ******************************************************************************
45 
46 SUBROUTINE rflu_settransportvars(pRegion,icgBeg,icgEnd)
47 
48  USE moddatatypes
49  USE modparameters
50  USE moderror
51  USE modglobal, ONLY: t_global
52  USE moddatastruct, ONLY: t_region
53  USE modgrid, ONLY: t_grid
54 
55  IMPLICIT NONE
56 
57 ! ******************************************************************************
58 ! Definitions and declarations
59 ! ******************************************************************************
60 
61 ! ==============================================================================
62 ! Arguments
63 ! ==============================================================================
64 
65  INTEGER, INTENT(IN) :: icgbeg,icgend
66  TYPE(t_region), POINTER :: pregion
67 
68 ! ==============================================================================
69 ! Locals
70 ! ==============================================================================
71 
72  CHARACTER(CHRLEN) :: rcsidentstring
73  INTEGER :: icg,indcp
74  REAL(RFREAL) :: abstemp,iprlam,iprlamliq,kliq,kgas,kvap,muliq,mugas,muvap,&
75  reftemp,refvisc,refviscliq,suthcoef,s1,s2,s3,s4,term,y,z
76  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcv,pdv,pgv,ptv
77 #ifdef SPEC
78  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcvspec
79 #endif
80  TYPE(t_global), POINTER :: global
81 
82 ! ******************************************************************************
83 ! Start
84 ! ******************************************************************************
85 
86  rcsidentstring = '$RCSfile: RFLU_SetTransportVars.F90,v $ $Revision: 1.6 $'
87 
88  global => pregion%global
89 
90  CALL registerfunction(global,'RFLU_SetTransportVars',&
91  'RFLU_SetTransportVars.F90')
92 
93 ! ******************************************************************************
94 ! Set variables and pointers
95 ! ******************************************************************************
96 
97  pcv => pregion%mixt%cv
98  pdv => pregion%mixt%dv
99  pgv => pregion%mixt%gv
100  ptv => pregion%mixt%tv
101 
102 #ifdef SPEC
103  pcvspec => pregion%spec%cv
104 #endif
105 
106  indcp = pregion%mixtInput%indCp
107 
108  iprlam = 1.0_rfreal/pregion%mixtInput%prLam
109  refvisc = pregion%mixtInput%refVisc
110  reftemp = pregion%mixtInput%refTemp
111  suthcoef = pregion%mixtInput%suthCoef
112 
113 ! ******************************************************************************
114 ! Compute dependent variables
115 ! ******************************************************************************
116 
117  SELECT CASE ( pregion%mixtInput%fluidModel )
118 
119 ! ==============================================================================
120 ! Incompressible fluid model
121 ! ==============================================================================
122 
123  CASE ( fluid_model_incomp )
124 
125 ! ==============================================================================
126 ! Compressible fluid model
127 ! ==============================================================================
128 
129  CASE ( fluid_model_comp )
130  SELECT CASE ( pregion%mixtInput%gasModel )
131 
132 ! ------------------------------------------------------------------------------
133 ! Thermally and calorically perfect or thermally perfect gas
134 ! ------------------------------------------------------------------------------
135 
136  CASE ( gas_model_tcperf, &
137  gas_model_tperf )
138  SELECT CASE ( pregion%mixtInput%viscModel )
139 
140 ! -------- Sutherland model ----------------------------------------------------
141 
142  CASE ( visc_suthr )
143  DO icg = icgbeg,icgend
144  term = sqrt(pdv(dv_mixt_temp,icg)/suthcoef) &
145  *(1.0_rfreal + reftemp/suthcoef)/ &
146  (1.0_rfreal + reftemp/pdv(dv_mixt_temp,icg))
147 
148  ptv(tv_mixt_muel,icg) = term*refvisc
149  ptv(tv_mixt_tcol,icg) = pgv(gv_mixt_cp ,icg*indcp)* &
150  ptv(tv_mixt_muel,icg )*iprlam
151  END DO ! icg
152 
153 ! --------- Constant viscosity model -------------------------------------------
154 
155  CASE ( visc_fixed )
156  DO icg = icgbeg,icgend
157  ptv(tv_mixt_muel,icg) = refvisc
158  ptv(tv_mixt_tcol,icg) = pgv(gv_mixt_cp ,icg*indcp) &
159  *ptv(tv_mixt_muel,icg )*iprlam
160  END DO ! icg
161 
162 ! --------- Antibes model ------------------------------------------------------
163 
164  CASE ( visc_antib )
165  s1 = 110.0_rfreal
166  s2 = 120.0_rfreal
167  s3 = 230.0_rfreal
168  s4 = 1.0_rfreal/reftemp*sqrt(s2/reftemp)*(reftemp+s1)/s3
169 
170  IF ( reftemp <= s2 ) THEN
171  DO icg = icgbeg,icgend
172  abstemp = abs(pdv(dv_mixt_temp,icg))
173 
174  IF ( abstemp < s2 ) THEN
175  term = abstemp/reftemp
176  ELSE
177  term = sqrt(abstemp/s2)*(abstemp/reftemp)*(s3/(abstemp+s1))
178  END IF ! absTemp
179 
180  ptv(tv_mixt_muel,icg) = refvisc*term
181  ptv(tv_mixt_tcol,icg) = pgv(gv_mixt_cp ,icg*indcp) &
182  *ptv(tv_mixt_muel,icg )*iprlam
183  END DO ! icg
184  ELSE
185  DO icg = icgbeg,icgend
186  abstemp = abs(pdv(dv_mixt_temp,icg))
187 
188  IF ( abstemp < s2 ) THEN
189  term = s4
190  ELSE
191  term = sqrt(abstemp/reftemp)*(abstemp/reftemp) &
192  *(reftemp+s1)/(abstemp+s1)
193  END IF ! absTemp
194 
195  ptv(tv_mixt_muel,icg) = term*refvisc
196  ptv(tv_mixt_tcol,icg) = pgv(gv_mixt_cp ,icg*indcp) &
197  *ptv(tv_mixt_muel,icg )*iprlam
198  END DO ! icg
199  END IF ! refTemp
200 
201 ! --------- Default ------------------------------------------------------------
202 
203  CASE default
204  CALL errorstop(global,err_reached_default,__line__)
205  END SELECT ! pRegion%mixtInput%viscModel
206 
207 ! ------------------------------------------------------------------------------
208 ! Gas-liquid mixture fluid model
209 ! ------------------------------------------------------------------------------
210 
211  CASE ( gas_model_mixt_gasliq )
212 #ifdef SPEC
213  DO icg = icgbeg,icgend
214 
215 ! --------- Use Sutherland formula for gas -------------------------------------
216 
217  term = sqrt(pdv(dv_mixt_temp,icg)/suthcoef) &
218  *(1.0_rfreal + reftemp/suthcoef)/ &
219  (1.0_rfreal + reftemp/pdv(dv_mixt_temp,icg))
220 
221  mugas = term*refvisc
222  kgas = pregion%specInput%specType(1)%pMaterial%spht*mugas*iprlam
223 
224 ! --------- Use Sutherland formula for vapor -----------------------------------
225 
226  term = sqrt(pdv(dv_mixt_temp,icg)/suthcoef) &
227  *(1.0_rfreal + reftemp/suthcoef)/ &
228  (1.0_rfreal + reftemp/pdv(dv_mixt_temp,icg))
229 
230  muvap = term*refvisc
231  kvap = pregion%specInput%specType(2)%pMaterial%spht*muvap*iprlam
232 
233 ! --------- Compute liquid viscosity and conductivity --------------------------
234 
235  refviscliq = 1.0e-02_rfreal ! NOTE hard-coded for now
236  z = reftemp/pdv(dv_mixt_temp,icg)
237  y = -1.704_rfreal -5.306_rfreal*z + 7.003_rfreal*z*z
238 
239  muliq = refviscliq*exp(y)
240  kliq = 0.585_rfreal
241 
242 ! --------- Compute mixture viscosity and conductivity --------------------------
243 
244  ptv(tv_mixt_muel,icg) = &
245  ((pcv(cv_mixt_dens,icg)- pcvspec(1,icg) &
246  - pcvspec(2,icg))*muliq + pcvspec(1,icg)*mugas &
247  + pcvspec(2,icg)*muvap)/pcv(cv_mixt_dens,icg)
248  ptv(tv_mixt_tcol,icg) = &
249  ((pcv(cv_mixt_dens,icg)- pcvspec(1,icg) &
250  - pcvspec(2,icg))*kliq + pcvspec(1,icg)*kgas &
251  + pcvspec(2,icg)*kvap)/pcv(cv_mixt_dens,icg)
252  END DO ! icg
253 #else
254  CALL errorstop(global,err_reached_default,__line__)
255 #endif
256 
257 ! ------------------------------------------------------------------------------
258 ! Default
259 ! ------------------------------------------------------------------------------
260 
261  CASE default
262  CALL errorstop(global,err_reached_default,__line__)
263  END SELECT ! pRegion%mixtInput%gasModel
264 
265 ! ==============================================================================
266 ! Default
267 ! ==============================================================================
268 
269  CASE default
270  CALL errorstop(global,err_reached_default,__line__)
271  END SELECT ! pRegion%mixtInput%fluidModel
272 
273 ! ******************************************************************************
274 ! End
275 ! ******************************************************************************
276 
277  CALL deregisterfunction(global)
278 
279 END SUBROUTINE rflu_settransportvars
280 
281 ! ******************************************************************************
282 !
283 ! RCS Revision history:
284 !
285 ! $Log: RFLU_SetTransportVars.F90,v $
286 ! Revision 1.6 2008/12/06 08:44:13 mtcampbe
287 ! Updated license.
288 !
289 ! Revision 1.5 2008/11/19 22:17:26 mtcampbe
290 ! Added Illinois Open Source License/Copyright
291 !
292 ! Revision 1.4 2006/04/07 15:19:16 haselbac
293 ! Removed tabs
294 !
295 ! Revision 1.3 2006/03/26 20:21:45 haselbac
296 ! Added support for GL model
297 !
298 ! Revision 1.2 2005/04/15 15:06:22 haselbac
299 ! Added range arguments, removed pGrid declaration
300 !
301 ! Revision 1.1 2004/11/14 20:02:49 haselbac
302 ! Initial revision
303 !
304 ! ******************************************************************************
305 
306 
307 
308 
309 
310 
311 
void int int REAL REAL * y
Definition: read.cpp:74
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double sqrt(double d)
Definition: double.h:73
void int int int REAL REAL REAL * z
Definition: write.cpp:76
subroutine rflu_settransportvars(pRegion, icgBeg, icgEnd)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469