Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PERI_DerivedInputValues.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 values derived from user input.
26 !
27 ! Description: Global and user input parameters are used to derive derived
28 ! variables which are mostly components of periInput data type
29 ! (region%periInput) as rocperi data structure does not have
30 ! its own global data type. Derivations for CPR are based on 1D
31 ! analysis can be found in AIAA-86-1447 (Traineau, Hervat and
32 ! Kuentsmann). Derivations for channel flow follow Dean`s and
33 ! theoretical correlations.
34 !
35 ! Input: regions = Input parameters for all regions.
36 !
37 ! Output: regions = Derived variables stored as periInput data.
38 !
39 ! Notes: none.
40 !
41 !******************************************************************************
42 !
43 ! $Id: PERI_DerivedInputValues.F90,v 1.5 2008/12/06 08:44:36 mtcampbe Exp $
44 !
45 ! Copyright: (c) 2001 by the University of Illinois
46 !
47 !******************************************************************************
48 
49 SUBROUTINE peri_derivedinputvalues( regions )
50 
51  USE moddatatypes
52  USE moddatastruct, ONLY : t_region
53  USE modglobal, ONLY : t_global
54  USE modperiodic, ONLY : t_peri_input
55  USE modbndpatch, ONLY : t_patch
56  USE moderror
57  USE modparameters
59  IMPLICIT NONE
60 
61 ! ... parameters
62  TYPE(t_region), POINTER :: regions(:)
63 
64 ! ... loop variables
65  INTEGER :: ireg
66 
67 ! ... local variables
68  CHARACTER(CHRLEN) :: rcsidentstring
69  TYPE(t_global), POINTER :: global
70  TYPE(t_peri_input), POINTER :: input
71  TYPE(t_patch), POINTER :: patches(:)
72 
73 ! ... cpr local variables
74  REAL(RFREAL) :: rgas, gamma, gogampls, cpreps, headpres, headtemp, headsv
75  REAL(RFREAL) :: minj, denom, choklen, delta, mfrat, phi, meanpgrad
76 
77 ! ... channel local variables
78  REAL(RFREAL) :: ucubulk, skinfriction, tauwall
79  LOGICAL :: pgtauwall
80 
81 !******************************************************************************
82 
83  rcsidentstring = '$RCSfile: PERI_DerivedInputValues.F90,v $'
84 
85  global => regions(1)%global
86  CALL registerfunction( global,'PERI_DerivedInputValues',&
87  'PERI_DerivedInputValues.F90' )
88 
89  pgtauwall = .false.
90 
91 #ifdef RFLO
92  DO ireg=1,global%nRegions
93 
94  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
95  regions(ireg)%active==active) THEN ! on my processor
96 
97  patches => regions(ireg)%levels(1)%patches(:)
98 #endif
99 #ifdef RFLU
100  DO ireg = lbound(regions,1),ubound(regions,1)
101 
102  patches => regions(ireg)%patches(:)
103 #endif
104 
105  input => regions(ireg)%periInput
106  IF (input%flowKind==peri_flow_cpr) THEN
107 
108 ! ----- get cpr head end pressure and temperature
109 
110  input%headPres = global%refPressure
111  gamma = global%refGamma
112  rgas = global%refCp*(1._rfreal - 1._rfreal/gamma)
113  input%headTemp = global%refPressure/global%refDensity/rgas
114 
115 ! ----- derive initial mean pressure gradient from 1D analysis
116 
117  gogampls = gamma / (gamma + 1._rfreal)
118  cpreps = input%cprEpsilon
119  headpres = input%headPres
120  headtemp = input%headTemp
121  headsv = sqrt( gamma*rgas*headtemp )
122  IF (patches(3)%bcType >= bc_injection .AND. &
123  patches(3)%bcType <= bc_injection+ &
124  bc_range) THEN
125  minj = patches(3)%mixt%vals(bcdat_inject_mfrate,0)
126  ELSE
127  CALL errorstop( regions(ireg)%global,err_peri_cprbc,__line__, &
128  'cpr injection bc should be on patch 3 and 4' )
129  ENDIF
130  denom = headsv*minj*sqrt( 2._rfreal*(gamma+1._rfreal) )
131  choklen = headpres*gamma/denom
132  delta = global%refLength
133  mfrat = 1._rfreal/cpreps/choklen
134  phi = sqrt(1._rfreal - mfrat*mfrat)
135  meanpgrad= -gogampls*mfrat/phi*headpres/(choklen*delta) ! dP/dx
136 
137 ! ----- cpr mean pressure gradient (in 'slow' coordinate)
138  meanpgrad= meanpgrad/cpreps ! dP/dx_s
139 
140 ! ----- assign number of cpr variables and cpr mean values to permanent data str.
141 
142  input%nVar = cpr_nvar
143  input%minjRate = minj
144  input%meanPgrad = meanpgrad
145  input%bulkmFlux = 2._rfreal*delta*minj/cpreps
146 
147  ELSEIF (input%flowKind==peri_flow_channel) THEN
148 
149 ! ----- meaning global reference parameters
150 ! global%refDensity = wall density
151 ! global%refRenum = bulk Reynolds number
152 ! global%refVelocity= estimate bulk velocity
153 ! global%refLength = half channel height
154 
155  IF (global%refRenum > cnl_critreyn) THEN !turbulent
156 ! ------- uc/ubulk, from Dean`s correlation:
157  ucubulk = 1.28_rfreal*(2._rfreal*global%refRenum)**(-0.0116_rfreal)
158  skinfriction = 0.073_rfreal*(2._rfreal*global%refRenum)**(-0.25_rfreal)
159  ELSE ! laminar
160 ! ------- uc/ubulk, from laminar correlation:
161  ucubulk = 1.5_rfreal
162  skinfriction = 6._rfreal/(global%refRenum*ucubulk*ucubulk)
163  ENDIF
164 
165 ! ----- initial estimate physical parameters:
166  input%cnlCvel = ucubulk*global%refVelocity
167  input%cnlUtau = global%refVelocity*(0.5_rfreal*skinfriction)**0.5_rfreal
168  tauwall = global%refDensity*input%cnlUtau**2._rfreal
169  input%cnlRetau= input%cnlUtau/global%refVelocity*global%refRenum
170 
171 ! ----- initial pressure gradient and reference mass flux:
172  input%meanPgrad = -tauwall/global%refLength
173  input%bulkmFlux = 2._rfreal*global%refLength*global%refVelocity* &
174  global%refDensity
175 
176 ! ----- pressure gradient computation method:
177  IF (input%pgradType == cnl_pgrad_tauwall) pgtauwall = .true.
178 
179  ELSEIF (input%flowKind==peri_flow_bola) THEN
180 
181  ENDIF ! flowKind
182 
183 #ifdef RFLO
184  ENDIF ! region active and my processor
185 #endif
186  ENDDO ! iReg
187 
188 ! global pressure gradient computation method:
189 
190 #ifdef RFLO
191  DO ireg=1,global%nRegions
192 
193  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
194  regions(ireg)%active==active) THEN ! on my processor
195 #endif
196 #ifdef RFLU
197  DO ireg = lbound(regions,1),ubound(regions,1)
198 #endif
199 
200  input => regions(ireg)%periInput
201  IF (input%flowKind==peri_flow_channel) THEN
202  IF (pgtauwall) input%pgradType = cnl_pgrad_tauwall
203  ENDIF ! flowKind
204 #ifdef RFLO
205  ENDIF ! region active and my processor
206 #endif
207  ENDDO ! iReg
208 
209 ! Channel halfwidth delta and bulk mass flux are overruled in PERI_InitSolution
210 ! with the actual values.
211 
212 ! finalize --------------------------------------------------------------------
213 
214  CALL deregisterfunction( global )
215 
216 END SUBROUTINE peri_derivedinputvalues
217 
218 !******************************************************************************
219 !
220 ! RCS Revision history:
221 !
222 ! $Log: PERI_DerivedInputValues.F90,v $
223 ! Revision 1.5 2008/12/06 08:44:36 mtcampbe
224 ! Updated license.
225 !
226 ! Revision 1.4 2008/11/19 22:17:49 mtcampbe
227 ! Added Illinois Open Source License/Copyright
228 !
229 ! Revision 1.3 2006/08/19 15:40:09 mparmar
230 ! Renamed patch variables
231 !
232 ! Revision 1.2 2004/06/11 21:49:40 wasistho
233 ! prepared for RFLU
234 !
235 ! Revision 1.1 2004/06/08 23:56:56 wasistho
236 ! changed nomenclature
237 !
238 ! Revision 1.5 2003/10/14 21:26:18 wasistho
239 ! replace Uc by Ub in uTau = f(Cf) formulation
240 !
241 ! Revision 1.4 2003/09/18 01:57:13 wasistho
242 ! added ijksplit and pgradType in PERI_PgradUpdate
243 !
244 ! Revision 1.3 2003/04/03 00:33:01 wasistho
245 ! correct initial mflux channel flow
246 !
247 ! Revision 1.2 2003/04/02 01:48:48 wasistho
248 ! minimize CPR user input
249 !
250 ! Revision 1.1.1.1 2003/03/29 03:36:30 wasistho
251 ! install ROCPERI
252 !
253 !
254 !
255 !******************************************************************************
256 
257 
258 
259 
260 
261 
262 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double sqrt(double d)
Definition: double.h:73
subroutine input(X, NNODE, NDC, NCELL, NFCE, NBPTS, NBFACE, ITYP, NPROP, XBNDY, XFAR, YFAR, ZFAR)
RT delta(int i) const
Definition: Direction_2.h:159
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine peri_derivedinputvalues(regions)
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom