Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PERI_coCnlInitSolutionFlu.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 channel flow solution
26 !
27 ! Description: initial solution is laminar channel flow
28 !
29 ! Input: region = data of current region
30 !
31 ! Output: channel solution to start simulation
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: PERI_coCnlInitSolutionFlu.F90,v 1.5 2008/12/06 08:44:36 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE peri_cocnlinitsolution( region )
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
47  USE modglobal, ONLY : t_global
49  USE moderror
50  USE modparameters
52  IMPLICIT NONE
53 
54 ! ... parameters
55  TYPE (t_region) :: region
56 
57 ! ... loop variables
58  INTEGER :: ijkc, ijkv
59 
60 ! ... local variables
61  CHARACTER(CHRLEN) :: rcsidentstring
62  TYPE(t_global), POINTER :: global
63 
64  INTEGER :: ijkcr, ijkn, ijkn1
65  REAL(RFREAL), POINTER :: xyz(:,:), cofg(:,:), cv(:,:)
66  REAL(RFREAL) :: rgas, yc, muel, refmeanpgrad, delta
67  REAL(RFREAL) :: rho, pres, vm, eo, xyzcell(3), twopi, xmin, xmax, zmin, zmax
68  REAL(RFREAL) :: lambda,ampl,umax,nxwav,nywav,nzwav,span,extn,fy,yscale,ywaves
69 
70 !******************************************************************************
71 
72  rcsidentstring = '$RCSfile: PERI_coCnlInitSolutionFlu.F90,v $ $Revision: 1.5 $'
73 
74  global => region%global
75  CALL registerfunction( global,'PERI_CoCnlInitSolution',&
76  'PERI_coCnlInitSolutionFlu.F90' )
77 
78 ! get parameters and pointers ----------------------------------------------
79 
80  xyz => region%grid%xyz
81  cofg => region%grid%cofg
82  cv => region%mixt%cv
83 
84  IF ((global%flowType==flow_unsteady .AND. &
85  global%currentTime < peri_real_small) .OR. &
86  (global%flowType==flow_steady .AND. global%currentIter==0)) THEN
87 
88 ! - get parameters and set conservative variables
89 
90  delta = global%refLength
91  muel = global%refVisc
92  rho = global%refDensity
93  pres = global%refPressure
94  refmeanpgrad = region%periInput%meanPgrad
95  cv(cv_mixt_dens,:) = rho
96  cv(cv_mixt_ymom,:) = 0._rfreal
97  cv(cv_mixt_zmom,:) = 0._rfreal
98 
99  DO ijkc = 1, region%grid%nCellsTot
100 
101  yc = cofg(ycoord,ijkc)
102  cv(cv_mixt_xmom,ijkc) = -0.5_rfreal/muel*refmeanpgrad* &
103  (delta*delta - yc*yc)*rho
104 
105  vm = sqrt( cv(cv_mixt_xmom,ijkc)*cv(cv_mixt_xmom,ijkc) + &
106  cv(cv_mixt_ymom,ijkc)*cv(cv_mixt_ymom,ijkc) + &
107  cv(cv_mixt_zmom,ijkc)*cv(cv_mixt_zmom,ijkc))/rho
108  eo = mixtperf_eo_dgpvm(rho,global%refGamma,pres,vm)
109  cv(cv_mixt_ener,ijkc) = rho*eo
110  END DO
111 
112 ! - add perturbations, first define xMin/Max, zMin/Max
113 
114  xmin = 100000._rfreal
115  xmax = -100000._rfreal
116  zmin = 100000._rfreal
117  zmax = -100000._rfreal
118  DO ijkv = 1,region%grid%nVertTot
119  xmin = min( xmin, xyz(xcoord,ijkv) )
120  xmax = max( xmax, xyz(xcoord,ijkv) )
121  zmin = min( zmin, xyz(zcoord,ijkv) )
122  zmax = max( zmax, xyz(zcoord,ijkv) )
123  ENDDO
124 
125  lambda = 5._rfreal
126  ampl = 0.2_rfreal
127  umax = -0.5_rfreal/muel*refmeanpgrad*delta*delta
128  nxwav = 4._rfreal
129  nywav = 2._rfreal
130  nzwav = 2._rfreal
131  span = zmax-zmin
132  extn = xmax-xmin
133  twopi = 2._rfreal*global%pi
134 
135  DO ijkc = 1,region%grid%nCellsTot
136 
137 ! --- X and Z momentum components
138 
139  xyzcell(1:3) = cofg(xcoord:zcoord,ijkc)
140 
141  yscale = (delta - abs( xyzcell(2) ))/delta
142  ywaves = sin( nywav*yscale*twopi )
143  fy = ampl*(lambda*yscale)**2/ &
144  (1._rfreal + (lambda*yscale)**4) ! normal envelope
145  fy = ywaves*fy ! normal oscillations
146 
147  cv(cv_mixt_xmom,ijkc) = cv(cv_mixt_xmom,ijkc) + &
148  cv(cv_mixt_dens,ijkc)*umax* &
149  ( fy*sin( nxwav*xyzcell(1)/extn*twopi )+ &
150  fy*sin( nzwav*xyzcell(3)/span*twopi ) )
151  cv(cv_mixt_zmom,ijkc) = cv(cv_mixt_zmom,ijkc) + &
152  cv(cv_mixt_dens,ijkc)*umax* &
153  ( fy*sin( nxwav*xyzcell(1)/extn*twopi )+ &
154  fy*sin( nzwav*xyzcell(3)/span*twopi ) )
155 
156 ! --- Y momentum component
157 
158 ! yscale = xyzCell(2)/delta
159 ! ywaves = SIN( nYwav/2*yscale*twopi )
160 ! yscale = (delta - ABS( xyzCell(2) ))/delta
161 ! fy = ampl*(lambda*yscale)**2/ &
162 ! (1._RFREAL + (lambda*yscale)**4) ! normal envelope
163 ! fy = ywaves*fy ! normal oscillations
164 
165 ! cv(CV_MIXT_YMOM,ijkC) = cv(CV_MIXT_YMOM,ijkC) + &
166 ! cv(CV_MIXT_DENS,ijkC)*umax* &
167 ! ( fy*COS( nXwav*xyzCell(1)/extn*twopi )+ &
168 ! fy*COS( nZwav*xyzCell(3)/span*twopi ) )
169 
170  END DO
171 
172  ELSE
173 
174 ! - previous pressure gradient is read from main solution file
175 
176  region%periInput%meanPgrad = global%moduleVar(1)
177  write(*,*) global%myProcId,' channel MeanPgrad ', region%periInput%meanPgrad
178 
179  ENDIF
180 
181 ! finalize --------------------------------------------------------
182 
183  CALL deregisterfunction( global )
184 
185 END SUBROUTINE peri_cocnlinitsolution
186 
187 !******************************************************************************
188 !
189 ! RCS Revision history:
190 !
191 ! $Log: PERI_coCnlInitSolutionFlu.F90,v $
192 ! Revision 1.5 2008/12/06 08:44:36 mtcampbe
193 ! Updated license.
194 !
195 ! Revision 1.4 2008/11/19 22:17:49 mtcampbe
196 ! Added Illinois Open Source License/Copyright
197 !
198 ! Revision 1.3 2004/06/17 20:03:14 wasistho
199 ! compiled with RFLU
200 !
201 ! Revision 1.2 2004/06/17 00:50:09 wasistho
202 ! prepared for RFLU
203 !
204 ! Revision 1.1 2004/06/09 01:10:26 wasistho
205 ! changed nomenclature
206 !
207 !
208 !
209 !******************************************************************************
210 
211 
212 
213 
214 
215 
216 
real(rfreal) function mixtperf_eo_dgpvm(D, G, P, Vm)
Definition: MixtPerf_E.F90:55
double xmax() const
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
subroutine peri_cocnlinitsolution(region)
double xmin() const
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double zmin() const
double sqrt(double d)
Definition: double.h:73
NT & sin
double zmax() const
RT delta(int i) const
Definition: Direction_2.h:159
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
subroutine deregisterfunction(global)
Definition: ModError.F90:469