Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PERI_InitSolution.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: calls routines for initialisation of PERI solutions
26 !
27 ! Description: initial solution depends on the periodic flow case selected
28 !
29 ! Input: iReg = index of current region
30 ! region = data of current region
31 !
32 ! Output: solution to start simulation
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PERI_InitSolution.F90,v 1.5 2008/12/06 08:44:36 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2001 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE peri_initsolution( regions,iReg ) ! PUBLIC
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY : t_region
48  USE modglobal, ONLY : t_global
49  USE modperiodic, ONLY : t_peri_input
50 #ifdef RFLO
52 
53 #include "Indexing.h"
54 #endif
56  USE moderror
57  USE modmpi
58  USE modparameters
60  IMPLICIT NONE
61 
62 ! ... parameters
63  TYPE(t_region), POINTER :: regions(:)
64  INTEGER :: ireg
65 
66 ! ... loop variables
67  INTEGER :: ir, j, k
68 
69 ! ... local variables
70  CHARACTER(CHRLEN) :: rcsidentstring
71  TYPE(t_global), POINTER :: global
72  TYPE(t_peri_input), POINTER :: input
73 
74  INTEGER :: ilev, ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend
75  INTEGER :: inoff, ijnoff, ijkn
76  REAL(RFREAL) :: maxy, miny, maxz, minz, sndmax, rcvmax, sndmin, rcvmin
77  REAL(RFREAL) :: delta, pidel
78  REAL(RFREAL), POINTER :: xyz(:,:)
79 
80 !******************************************************************************
81 
82  rcsidentstring = '$RCSfile: PERI_InitSolution.F90,v $'
83 
84  global => regions(ireg)%global
85  CALL registerfunction( global,'PERI_InitSolution',&
86  'PERI_InitSolution.F90' )
87 
88 ! get initial solution depending on kind of periodic flow ---------------------
89 
90  IF ((regions(ireg)%periInput%flowKind == peri_flow_cpr) .OR. &
91  (regions(ireg)%periInput%flowKind == peri_flow_channel)) THEN
92 
93 ! - compute channel halfwidth
94 
95  maxy = -1000000._rfreal
96  miny = 1000000._rfreal
97  maxz = -1000000._rfreal
98  minz = 1000000._rfreal
99 
100 #ifdef RFLO
101  DO ir = 1,global%nRegions
102  IF (regions(ir)%procid==global%myProcid .AND. & ! region active and
103  regions(ir)%active==active) THEN ! on my processor
104 
105  ilev = regions(ir)%currLevel
106  CALL rflo_getdimensphysnodes( regions(ir),ilev,ipnbeg,ipnend, &
107  jpnbeg,jpnend,kpnbeg,kpnend )
108  CALL rflo_getnodeoffset( regions(ir),ilev,inoff,ijnoff )
109 
110  xyz => regions(ir)%levels(ilev)%grid%xyz
111 #endif
112 #ifdef RFLU
113  DO ireg = lbound(regions,1),ubound(regions,1)
114 
115  xyz => regions(ir)%grid%xyz
116 #endif
117 
118  input => regions(ir)%periInput
119 
120  IF (input%flowKind==peri_flow_cpr .OR. &
121  input%flowKind==peri_flow_channel) THEN
122 #ifdef RFLO
123  DO j = jpnbeg, jpnend
124  ijkn = indijk(1 ,j ,1 ,inoff,ijnoff)
125  maxy = max( maxy, xyz(ycoord,ijkn) )
126  miny = min( miny, xyz(ycoord,ijkn) )
127  ENDDO
128 
129  DO k = kpnbeg, kpnend
130  ijkn = indijk(1 ,1 ,k ,inoff,ijnoff)
131  maxz = max( maxz, xyz(zcoord,ijkn) )
132  minz = min( minz, xyz(zcoord,ijkn) )
133  ENDDO
134 #endif
135 #ifdef RFLU
136  DO ijkn = 1, regions(ir)%grid%nVert
137  maxy = max( maxy, xyz(ycoord,ijkn) )
138  miny = min( miny, xyz(ycoord,ijkn) )
139  maxz = max( maxz, xyz(zcoord,ijkn) )
140  minz = min( minz, xyz(zcoord,ijkn) )
141  ENDDO
142 #endif
143  ENDIF ! flowKind
144 #ifdef RFLO
145  ENDIF ! region active and my processor
146 #endif
147  ENDDO ! ir
148 
149 #ifndef MPI
150  delta = 0.5_rfreal*(maxy - miny) ! channel half width
151  IF (abs( global%refLength - delta ) > &
152  max( global%refLength,1._rfreal )*peri_real_small) THEN
153  CALL errorstop( global,err_peri_input,__line__, &
154  'maxY-minY in the region /= length scale delta' )
155  ENDIF
156 #endif
157 #ifdef MPI
158  sndmax = maxy
159  sndmin = miny
160  CALL mpi_allreduce( sndmax,rcvmax,1,mpi_double_precision,mpi_max, &
161  global%mpiComm, global%mpierr )
162  CALL mpi_allreduce( sndmin,rcvmin,1,mpi_double_precision,mpi_min, &
163  global%mpiComm, global%mpierr )
164  maxy = rcvmax
165  miny = rcvmin
166 
167  sndmax = maxz
168  sndmin = minz
169  CALL mpi_allreduce( sndmax,rcvmax,1,mpi_double_precision,mpi_max, &
170  global%mpiComm, global%mpierr )
171  CALL mpi_allreduce( sndmin,rcvmin,1,mpi_double_precision,mpi_min, &
172  global%mpiComm, global%mpierr )
173  maxz = rcvmax
174  minz = rcvmin
175 #endif
176 
177 ! - save minY and maxY in permanent data and get y and z dimensions
178  input => regions(ireg)%periInput
179  input%minmax(1) = miny
180  input%minmax(2) = maxy
181  delta = 0.5_rfreal*(maxy - miny) ! channel half width
182  pidel = maxz - minz ! channel span
183 
184 ! - check delta
185  IF (abs(global%refLength - delta) > &
186  global%refLength*peri_real_small) THEN
187  CALL errorstop( global,err_peri_input,__line__, &
188  'length scale delta is not consistent with the grid' )
189  ENDIF
190 
191  ENDIF
192 
193  IF (regions(ireg)%periInput%flowKind == peri_flow_cpr) THEN
194 
195 ! - check span dimension
196  IF (abs( global%pi*global%refLength - pidel ) > &
197  max( global%refLength,1._rfreal )*peri_real_small) THEN
198  CALL errorstop( global,err_peri_input,__line__, &
199  'spanwise dimension is not consistent with the grid' )
200  ENDIF
201 
202  CALL peri_cocprinitsolution( regions(ireg) )
203 
204  ELSEIF (regions(ireg)%periInput%flowKind == peri_flow_channel) THEN
205 
206 ! - check span dimension
207  IF (abs( global%pi*global%refLength - pidel ) > &
208  max( global%refLength,1._rfreal )*peri_real_small) THEN
209  CALL errorstop( global,err_peri_input,__line__, &
210  'spanwise dimension is not consistent with the grid' )
211  ENDIF
212 
213  CALL peri_cocnlinitsolution( regions(ireg) )
214 
215  ELSEIF (regions(ireg)%periInput%flowKind == peri_flow_bola) THEN
216 
217 ! CALL PERI_BolaInitSolution( regions(iReg) )
218 
219  ENDIF
220 
221  global%moduleVar(1) = regions(ireg)%periInput%meanPgrad
222 
223 ! finalize --------------------------------------------------------
224 
225  CALL deregisterfunction( global )
226 
227 END SUBROUTINE peri_initsolution
228 
229 !******************************************************************************
230 !
231 ! RCS Revision history:
232 !
233 ! $Log: PERI_InitSolution.F90,v $
234 ! Revision 1.5 2008/12/06 08:44:36 mtcampbe
235 ! Updated license.
236 !
237 ! Revision 1.4 2008/11/19 22:17:49 mtcampbe
238 ! Added Illinois Open Source License/Copyright
239 !
240 ! Revision 1.3 2004/06/11 21:49:40 wasistho
241 ! prepared for RFLU
242 !
243 ! Revision 1.2 2004/06/09 01:09:24 wasistho
244 ! prepared for RFLU
245 !
246 ! Revision 1.1 2004/06/08 23:56:56 wasistho
247 ! changed nomenclature
248 !
249 ! Revision 1.6 2003/10/20 00:42:06 wasistho
250 ! modified dimension check
251 !
252 ! Revision 1.5 2003/10/17 20:27:26 wasistho
253 ! fixed the computation of delta
254 !
255 ! Revision 1.4 2003/05/15 02:57:05 jblazek
256 ! Inlined index function.
257 !
258 ! Revision 1.3 2003/04/03 20:58:54 wasistho
259 ! normal extent in one region ifnot MPI
260 !
261 ! Revision 1.2 2003/04/03 00:35:17 wasistho
262 ! include channel grid check
263 !
264 ! Revision 1.1.1.1 2003/03/29 03:36:30 wasistho
265 ! install ROCPERI
266 !
267 !
268 !
269 !******************************************************************************
270 
271 
272 
273 
274 
275 
276 
**********************************************************************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 jpnbeg
j indices k indices k
Definition: Indexing.h:6
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
**********************************************************************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 kpnbeg
subroutine peri_cocnlinitsolution(region)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine peri_cocprinitsolution(region)
**********************************************************************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 jpnend
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
subroutine input(X, NNODE, NDC, NCELL, NFCE, NBPTS, NBFACE, ITYP, NPROP, XBNDY, XFAR, YFAR, ZFAR)
**********************************************************************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 ipnbeg
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 rflo_getdimensphysnodes(region, iLev, ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend)
j indices j
Definition: Indexing.h:6
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
**********************************************************************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 ipnend
subroutine peri_initsolution(regions, iReg)