Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PERI_coCprInitSolutionFlu.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: Initialisation of CPR solutions
26 !
27 ! Description: IF starts from t=0, set density and pressure as single values
28 ! as function of axial position using 1D compressible relations,
29 ! can be found in AIAA-86-1447 (Traineau, Hervat and Kuentsmann).
30 ! The remaining conservative variables are due to Taylor solution
31 ! which vary in injection normal direction.
32 ! IF restart from t/=0, read solution from main solution file
33 ! and cpr pressure gradient from specific cpr solution file.
34 !
35 ! Input: region = data of current region
36 !
37 ! Output: CPR solution to start simulation
38 !
39 ! Notes: none.
40 !
41 !******************************************************************************
42 !
43 ! $Id: PERI_coCprInitSolutionFlu.F90,v 1.5 2008/12/06 08:44:37 mtcampbe Exp $
44 !
45 ! Copyright: (c) 2001 by the University of Illinois
46 !
47 !******************************************************************************
48 
49 SUBROUTINE peri_cocprinitsolution( region )
50 
51  USE moddatatypes
52  USE moddatastruct, ONLY : t_region
53  USE modglobal, ONLY : t_global
55  USE moderror
56  USE modparameters
58  IMPLICIT NONE
59 
60 ! ... parameters
61  TYPE (t_region) :: region
62 
63 ! ... loop variables
64  INTEGER :: ijkc
65 
66 ! ... local variables
67  CHARACTER(CHRLEN) :: rcsidentstring
68  TYPE(t_global), POINTER :: global
69 
70  INTEGER :: ijkcr, ijkn, ijkn1
71  REAL(RFREAL), POINTER :: xyz(:,:), cofg(:,:), cv(:,:), dv(:,:)
72  REAL(RFREAL) :: pi, gamma, gogampls, delta, minj, mfrat, refmassflux
73  REAL(RFREAL) :: throatmflux, cpreps, headpres, headtemp, headsv, rgas
74  REAL(RFREAL) :: phi, mach, yc, denom, choklen, hvinj
75  REAL(RFREAL) :: rho, pres, vm, eo
76 
77 !******************************************************************************
78 
79  rcsidentstring = '$RCSfile: PERI_coCprInitSolutionFlu.F90,v $ $Revision: 1.5 $'
80 
81  global => region%global
82  CALL registerfunction( global,'PERI_CoCprInitSolution',&
83  'PERI_coCprInitSolutionFlu.F90' )
84 
85 ! get parameters and pointers ----------------------------------------------
86 
87  xyz => region%grid%xyz
88  cofg => region%grid%cofg
89  cv => region%mixt%cv
90  dv => region%mixt%dv
91 
92  pi = global%pi
93  rgas = 287._rfreal
94  gamma = global%refGamma
95  gogampls = gamma / (gamma + 1._rfreal)
96  cpreps = region%periInput%cprEpsilon
97  headpres = region%periInput%headPres
98  headtemp = region%periInput%headTemp
99  delta = global%refLength
100 write(*,*)global%currentTime
101  IF ((global%flowType==flow_unsteady .AND. &
102  global%currentTime < peri_real_small) .OR. &
103  (global%flowType==flow_steady .AND. global%currentIter==0)) THEN
104 
105 ! - first cleanup conservative variables cv
106  cv(:,:) = 0._rfreal
107 write(*,*)headpres,headtemp
108 ! - refMassFlux is the mass flux at the streamwise location x/h=1/cprEpsilon
109  minj = region%periInput%minjRate
110  refmassflux = region%periInput%bulkmFlux
111 
112 ! - bulk averaged mass flux corresponding to CPR sonic conditions
113  throatmflux = 2._rfreal*delta*gamma*headpres/ &
114  sqrt(2._rfreal*gogampls*rgas*headtemp)
115 
116 ! - non dimensinal distance head end to choking location L/h:
117  headsv = sqrt( gamma*rgas*headtemp )
118  denom = headsv*minj*sqrt( 2._rfreal*(gamma+1._rfreal) )
119  choklen = headpres*gamma/denom
120 
121 ! - mfRat is ratio of bulk mass flux to mass flux corresp. to sonic conditions
122  mfrat = refmassflux/throatmflux
123 
124 ! - or mfRat can be defined as axial coordinate normalized by choklen
125  mfrat = 1._rfreal/cpreps/choklen
126 
127 ! - compute nondimensional axial parameter phi defined as
128  phi = sqrt(1._rfreal - mfrat*mfrat)
129 
130 ! - pressure and density axial distribution
131  rho = 0.5_rfreal*headpres*(1._rfreal+phi)/(rgas*headtemp)
132  pres = (1.d0+gamma*phi)*headpres/(1._rfreal+gamma)
133  cv(cv_mixt_dens,:) = rho
134  dv(dv_mixt_pres,:) = pres
135  cv(cv_mixt_zmom,:) = 0._rfreal
136 
137 ! - mach number and head-end injection velocity
138  mach = sqrt((1._rfreal-phi)/(1._rfreal+gamma*phi))
139  hvinj= minj*rgas*headtemp/headpres
140 write(*,*)cv(cv_mixt_dens,1),dv(dv_mixt_pres,1),choklen,mach
141 write(*,*)mfrat,phi,mach,hvinj
142 
143  DO ijkc = 1, region%grid%nCellsTot
144  yc = cofg(ycoord,ijkc)
145 
146  cv(cv_mixt_xmom,ijkc) = minj/rho*0.5_rfreal*pi/cpreps* &
147  cos( 0.5_rfreal*pi*yc/delta )*rho
148  cv(cv_mixt_ymom,ijkc) = -minj/rho*sin( 0.5_rfreal*pi*yc/delta )*rho
149 
150  vm = sqrt( cv(cv_mixt_xmom,ijkc)*cv(cv_mixt_xmom,ijkc) + &
151  cv(cv_mixt_ymom,ijkc)*cv(cv_mixt_ymom,ijkc) + &
152  cv(cv_mixt_zmom,ijkc)*cv(cv_mixt_zmom,ijkc))/rho
153  eo = mixtperf_eo_dgpvm(rho,gamma,pres,vm)
154  cv(cv_mixt_ener,ijkc) = rho*eo
155  END DO
156 
157  ELSE
158 
159 ! - previous pressure gradient is read from main solution file
160 
161  region%periInput%meanPgrad = global%moduleVar(1)
162  write(*,*) global%myProcId,' cprMeanPgrad ', region%periInput%meanPgrad
163 
164  ENDIF
165 
166 ! finalize --------------------------------------------------------
167 
168  CALL deregisterfunction( global )
169 
170 END SUBROUTINE peri_cocprinitsolution
171 
172 !******************************************************************************
173 !
174 ! RCS Revision history:
175 !
176 ! $Log: PERI_coCprInitSolutionFlu.F90,v $
177 ! Revision 1.5 2008/12/06 08:44:37 mtcampbe
178 ! Updated license.
179 !
180 ! Revision 1.4 2008/11/19 22:17:49 mtcampbe
181 ! Added Illinois Open Source License/Copyright
182 !
183 ! Revision 1.3 2004/06/17 20:03:27 wasistho
184 ! compiled with RFLU
185 !
186 ! Revision 1.2 2004/06/17 00:50:28 wasistho
187 ! prepared for RFLU
188 !
189 ! Revision 1.1 2004/06/09 01:10:26 wasistho
190 ! changed nomenclature
191 !
192 !
193 !
194 !******************************************************************************
195 
196 
197 
198 
199 
200 
201 
202 
203 
real(rfreal) function mixtperf_eo_dgpvm(D, G, P, Vm)
Definition: MixtPerf_E.F90:55
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double sqrt(double d)
Definition: double.h:73
subroutine peri_cocprinitsolution(region)
static const double pi
Definition: smooth_medial.C:43
NT & sin
RT delta(int i) const
Definition: Direction_2.h:159
subroutine deregisterfunction(global)
Definition: ModError.F90:469
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom
NT & cos