Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PERI_coCnlInitSolutionFlo.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_coCnlInitSolutionFlo.F90,v 1.4 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 #include "Indexing.h"
55 
56 ! ... parameters
57  TYPE (t_region) :: region
58 
59 ! ... loop variables
60  INTEGER :: i, j, k, n
61 
62 ! ... local variables
63  CHARACTER(CHRLEN) :: rcsidentstring
64  TYPE(t_global), POINTER :: global
65 
66  INTEGER :: ilev, ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend
67  INTEGER :: icoff, ijcoff, inoff, ijnoff, ijkc, ijkcr, ijkn, ijkn1
68  INTEGER :: icorner(8)
69  REAL(RFREAL), POINTER :: xyz(:,:), cv(:,:), dv(:,:)
70  REAL(RFREAL) :: rgas, yp, ym, yc, dy, muel, refmeanpgrad, delta
71  REAL(RFREAL) :: rho, pres, vm, eo, xyzcell(3), twopi
72  REAL(RFREAL) :: lambda,ampl,umax,nxwav,nywav,nzwav,span,extn,fy,yscale,ywaves
73 
74 !******************************************************************************
75 
76  rcsidentstring = '$RCSfile: PERI_coCnlInitSolutionFlo.F90,v $ $Revision: 1.4 $'
77 
78  global => region%global
79  CALL registerfunction( global,'PERI_CoCnlInitSolution',&
80  'PERI_coCnlInitSolutionFlo.F90' )
81 
82 ! get parameters and pointers ----------------------------------------------
83 
84  ilev = region%currLevel
85  CALL rflo_getdimensphys( region,ilev,ipcbeg,ipcend, &
86  jpcbeg,jpcend,kpcbeg,kpcend )
87  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
88  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
89 
90  xyz => region%levels(ilev)%grid%xyz
91  cv => region%levels(ilev)%mixt%cv
92  dv => region%levels(ilev)%mixt%dv
93 
94  IF ((global%flowType==flow_unsteady .AND. &
95  global%currentTime < peri_real_small) .OR. &
96  (global%flowType==flow_steady .AND. global%currentIter==0)) THEN
97 
98 ! - get parameters and set conservative variables
99 
100  delta = global%refLength
101  muel = global%refVisc
102  rho = global%refDensity
103  pres = global%refPressure
104  refmeanpgrad = region%periInput%meanPgrad
105  cv(cv_mixt_dens,:) = rho
106  cv(cv_mixt_ymom,:) = 0._rfreal
107  cv(cv_mixt_zmom,:) = 0._rfreal
108 
109  DO k = kpcbeg, kpcbeg
110  DO i = ipcbeg, ipcbeg
111  DO j = jpcbeg-region%nDumCells, jpcend+region%nDumCells
112  ijkc = indijk( i , j , k ,icoff,ijcoff)
113  ijkn = indijk( i , j , k ,inoff,ijnoff)
114  ijkn1 = indijk( i , j+1, k ,inoff,ijnoff)
115  dy = xyz(ycoord,ijkn1)-xyz(ycoord,ijkn)
116  yp = xyz(ycoord,ijkn1)
117  ym = xyz(ycoord,ijkn)
118  yc = 0.5_rfreal*(xyz(ycoord,ijkn1)+xyz(ycoord,ijkn))
119  IF (dy < 0._rfreal) THEN
120  CALL errorstop( region%global,err_peri_geo,__line__, &
121  'grid contains negative spacing' )
122  ENDIF
123 
124  dv(dv_mixt_uvel,ijkc) = -0.5_rfreal/muel*refmeanpgrad* &
125  (delta*delta - yc*yc)
126 
127  cv(cv_mixt_xmom,ijkc) = dv(dv_mixt_uvel,ijkc)*rho
128 
129  vm = sqrt( cv(cv_mixt_xmom,ijkc)*cv(cv_mixt_xmom,ijkc) + &
130  cv(cv_mixt_ymom,ijkc)*cv(cv_mixt_ymom,ijkc) + &
131  cv(cv_mixt_zmom,ijkc)*cv(cv_mixt_zmom,ijkc))/rho
132  eo = mixtperf_eo_dgpvm(rho,global%refGamma,pres,vm)
133  cv(cv_mixt_ener,ijkc) = rho*eo
134  END DO
135  DO j = 1, region%nDumCells
136  ijkn = indijk( i , jpcbeg , k ,inoff,ijnoff)
137  ijkn1 = indijk( i , jpcend+1 , k ,inoff,ijnoff)
138  yp = xyz(ycoord,ijkn1)
139  ym = xyz(ycoord,ijkn)
140  ijkcr = indijk( i , jpcbeg+j-1, k ,icoff,ijcoff)
141  ijkc = indijk( i , jpcbeg-j , k ,icoff,ijcoff)
142  IF (ym == region%periInput%minmax(1)) THEN
143  cv(cv_mixt_xmom,ijkc) = -cv(cv_mixt_xmom,ijkcr)
144  ENDIF
145  ijkcr = indijk( i , jpcend-j+1, k ,icoff,ijcoff)
146  ijkc = indijk( i , jpcend+j , k ,icoff,ijcoff)
147  IF (yp == region%periInput%minmax(2)) THEN
148  cv(cv_mixt_xmom,ijkc) = -cv(cv_mixt_xmom,ijkcr)
149  ENDIF
150  END DO
151  END DO
152  END DO
153 
154  DO k = kpcbeg-region%nDumCells, kpcend+region%nDumCells
155  DO j = jpcbeg-region%nDumCells, jpcend+region%nDumCells
156  DO i = ipcbeg-region%nDumCells, ipcend+region%nDumCells
157  ijkc = indijk( i , j , k ,icoff,ijcoff)
158  ijkcr = indijk(ipcbeg, j ,kpcbeg ,icoff,ijcoff)
159  cv(cv_mixt_dens,ijkc) = cv(cv_mixt_dens,ijkcr)
160  cv(cv_mixt_xmom,ijkc) = cv(cv_mixt_xmom,ijkcr)
161  cv(cv_mixt_ymom,ijkc) = cv(cv_mixt_ymom,ijkcr)
162  cv(cv_mixt_zmom,ijkc) = cv(cv_mixt_zmom,ijkcr)
163  cv(cv_mixt_ener,ijkc) = cv(cv_mixt_ener,ijkcr)
164  END DO
165  END DO
166  END DO
167 
168 ! - add perturbations
169 
170  lambda = 5._rfreal
171  ampl = 0.3_rfreal
172  umax = -0.5_rfreal/muel*refmeanpgrad*delta*delta
173  nxwav = 3._rfreal
174  nywav = 2._rfreal
175  nzwav = 2._rfreal
176  span = xyz(zcoord,indijk( ipcbeg,jpcbeg,kpcend+1,inoff,ijnoff ))- &
177  xyz(zcoord,indijk( ipcbeg,jpcbeg,kpcbeg ,inoff,ijnoff ))
178  extn = xyz(xcoord,indijk( ipcend+1,jpcbeg,kpcbeg,inoff,ijnoff ))- &
179  xyz(xcoord,indijk( ipcbeg ,jpcbeg,kpcbeg,inoff,ijnoff ))
180  twopi = 2._rfreal*global%pi
181 
182  DO k = kpcbeg-region%nDumCells, kpcend+region%nDumCells
183  DO j = jpcbeg , jpcend
184  DO i = ipcbeg-region%nDumCells, ipcend+region%nDumCells
185  ijkc = indijk( i , j , k ,icoff,ijcoff)
186  icorner(1) = indijk( i , j , k ,inoff,ijnoff)
187  icorner(2) = indijk( i+1 , j , k ,inoff,ijnoff)
188  icorner(3) = indijk( i , j+1 , k ,inoff,ijnoff)
189  icorner(4) = indijk( i+1 , j+1 , k ,inoff,ijnoff)
190  icorner(5) = indijk( i , j , k+1 ,inoff,ijnoff)
191  icorner(6) = indijk( i+1 , j , k+1 ,inoff,ijnoff)
192  icorner(7) = indijk( i , j+1 , k+1 ,inoff,ijnoff)
193  icorner(8) = indijk( i+1 , j+1 , k+1 ,inoff,ijnoff)
194 
195  xyzcell(:) = 0._rfreal
196  DO n=1,8
197  xyzcell(1) = xyzcell(1) + xyz(xcoord,icorner(n))
198  xyzcell(2) = xyzcell(2) + xyz(ycoord,icorner(n))
199  xyzcell(3) = xyzcell(3) + xyz(zcoord,icorner(n))
200  ENDDO
201  xyzcell(1) = 0.125_rfreal*xyzcell(1)
202  xyzcell(2) = 0.125_rfreal*xyzcell(2)
203  xyzcell(3) = 0.125_rfreal*xyzcell(3)
204 
205 ! ------- X and Z momentum components
206 
207  yscale = (delta - abs( xyzcell(2) ))/delta
208  ywaves = sin( nywav*yscale*twopi )
209  fy = ampl*(lambda*yscale)**2/ &
210  (1._rfreal + (lambda*yscale)**4) ! normal envelope
211  fy = ywaves*fy ! normal oscillations
212 
213  cv(cv_mixt_xmom,ijkc) = cv(cv_mixt_xmom,ijkc) + &
214  cv(cv_mixt_dens,ijkc)*umax* &
215  ( fy*sin( nxwav*xyzcell(1)/extn*twopi )+ &
216  fy*cos( nzwav*xyzcell(3)/span*twopi ) )
217 ! cv(CV_MIXT_ZMOM,ijkC) = cv(CV_MIXT_ZMOM,ijkC) + &
218 ! cv(CV_MIXT_DENS,ijkC)*umax* &
219 ! ( fy*SIN( nXwav*xyzCell(1)/extn*twopi )+ &
220 ! fy*COS( nZwav*xyzCell(3)/span*twopi ) )
221 
222 ! ------- Y momentum component
223 
224  yscale = xyzcell(2)/delta
225  ywaves = sin( nywav/2*yscale*twopi )
226  yscale = (delta - abs( xyzcell(2) ))/delta
227  fy = ampl*(lambda*yscale)**2/ &
228  (1._rfreal + (lambda*yscale)**4) ! normal envelope
229  fy = ywaves*fy ! normal oscillations
230 
231  cv(cv_mixt_ymom,ijkc) = cv(cv_mixt_ymom,ijkc) + &
232  cv(cv_mixt_dens,ijkc)*umax* &
233  ( fy*cos( nxwav*xyzcell(1)/extn*twopi )+ &
234  fy*cos( nzwav*xyzcell(3)/span*twopi ) )
235 
236  END DO
237  END DO
238  END DO
239 
240  ELSE
241 
242 ! - previous pressure gradient is read from main solution file
243 
244  region%periInput%meanPgrad = global%moduleVar(1)
245  write(*,*) region%procId,' channel MeanPgrad ', region%periInput%meanPgrad
246 
247  ENDIF
248 
249 ! finalize --------------------------------------------------------
250 
251  CALL deregisterfunction( global )
252 
253 END SUBROUTINE peri_cocnlinitsolution
254 
255 !******************************************************************************
256 !
257 ! RCS Revision history:
258 !
259 ! $Log: PERI_coCnlInitSolutionFlo.F90,v $
260 ! Revision 1.4 2008/12/06 08:44:36 mtcampbe
261 ! Updated license.
262 !
263 ! Revision 1.3 2008/11/19 22:17:49 mtcampbe
264 ! Added Illinois Open Source License/Copyright
265 !
266 ! Revision 1.2 2005/04/27 19:42:11 wasistho
267 ! modified cnl initial sinusoidal perturbations
268 !
269 ! Revision 1.1 2004/06/08 23:56:56 wasistho
270 ! changed nomenclature
271 !
272 ! Revision 1.5 2004/04/01 03:38:23 wasistho
273 ! modified channel initial perturbations
274 !
275 ! Revision 1.4 2004/03/31 00:43:21 wasistho
276 ! corrected variable extn
277 !
278 ! Revision 1.3 2004/03/30 21:22:18 wasistho
279 ! add perturbation on initial laminar channel flow
280 !
281 ! Revision 1.2 2003/05/15 02:57:05 jblazek
282 ! Inlined index function.
283 !
284 ! Revision 1.1.1.1 2003/03/29 03:36:30 wasistho
285 ! install ROCPERI
286 !
287 !
288 !
289 !******************************************************************************
290 
291 
292 
293 
294 
295 
296 
real(rfreal) function mixtperf_eo_dgpvm(D, G, P, Vm)
Definition: MixtPerf_E.F90:55
j indices k indices k
Definition: Indexing.h:6
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE kpcbeg
subroutine peri_cocnlinitsolution(region)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double sqrt(double d)
Definition: double.h:73
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE jpcbeg
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ipcend
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ipcbeg
NT & sin
blockLoc i
Definition: read.cpp:79
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE icorner
const NT & n
RT delta(int i) const
Definition: Direction_2.h:159
j indices j
Definition: Indexing.h:6
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE jpcend
NT dy
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
NT & cos
subroutine rflo_getdimensphys(region, iLev, ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend)