Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_ModRkInit.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: Suite of routines to initialize Runge-Kutta schemes.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 !*******************************************************************************
32 !
33 ! $Id: PLAG_ModRkInit.F90,v 1.8 2009/03/02 00:19:36 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2005 by the University of Illinois
36 !
37 !*******************************************************************************
38 
40 
41  USE modglobal, ONLY: t_global
42  USE modparameters
43  USE moddatatypes
44  USE modglobal, ONLY: t_global
45  USE modgrid, ONLY: t_grid
47  USE modbndpatch, ONLY: t_patch
48  USE moddatastruct, ONLY: t_region
49  USE moderror
50 
53 
54  IMPLICIT NONE
55 
56  PRIVATE
57  PUBLIC :: plag_injctilerkinit, &
59 
60 ! ******************************************************************************
61 ! Declarations and definitions
62 ! ******************************************************************************
63 
64  CHARACTER(CHRLEN) :: RCSIdentString = &
65  '$RCSfile: PLAG_ModRkInit.F90,v $ $Revision: 1.8 $'
66 
67 ! ******************************************************************************
68 ! Routines
69 ! ******************************************************************************
70 
71  CONTAINS
72 
73 
74 
75 
76 !******************************************************************************
77 !
78 ! Purpose: Initialize Runge-Kutta scheme for Integer variables.
79 !
80 ! Description: None.
81 !
82 ! Input:
83 ! region Region data
84 ! iStage Runge-Kutta stage
85 ! icBeg Beginning index for cell update
86 ! icEnd Ending index for cell update
87 ! ivBeg Beginning index for variable update
88 ! ivEnd Ending index for variable update
89 ! aiv Integer variables
90 ! aivOld Old integer variables
91 !
92 ! Output:
93 ! ivOld Old integer variables
94 !
95 ! Notes: None.
96 !
97 !******************************************************************************
98 
99 SUBROUTINE plag_rkinitgenericint(region,iStage,icBeg,icEnd,ivBeg,ivEnd,&
100  aiv,aivold)
101 
102 ! *****************************************************************************
103 ! Definitions and declarations
104 ! *****************************************************************************
105 
106 ! =============================================================================
107 ! Arguments
108 ! =============================================================================
109 
110  INTEGER, INTENT(IN) :: icbeg,icend,istage,ivbeg,ivend
111  INTEGER, DIMENSION(:,:), POINTER :: aiv,aivold
112  TYPE(t_region) :: region
113 
114 ! =============================================================================
115 ! Locals
116 ! =============================================================================
117 
118  CHARACTER(CHRLEN) :: rcsidentstring
119  INTEGER :: ic,iv
120  TYPE(t_global), POINTER :: global
121 
122 ! *****************************************************************************
123 ! Start
124 ! *****************************************************************************
125 
126  rcsidentstring = '$RCSfile: PLAG_ModRkInit.F90,v $ $Revision: 1.8 $'
127 
128  global => region%global
129 
130  CALL registerfunction(global,'PLAG_RkInitGenericInt',&
131  'PLAG_ModRkInit.F90')
132 
133 ! *****************************************************************************
134 ! Initialize Runge-Kutta scheme
135 ! *****************************************************************************
136 
137  SELECT CASE ( global%rkScheme )
138  CASE ( rk_scheme_4_classical )
139  IF ( istage == 1 ) THEN
140  DO ic = icbeg,icend
141  DO iv = ivbeg,ivend
142  aivold(iv,ic) = aiv(iv,ic)
143  END DO ! iv
144  END DO ! ic
145  END IF ! iStage
146  CASE ( rk_scheme_3_wray )
147  DO ic = icbeg,icend
148  DO iv = ivbeg,ivend
149  aivold(iv,ic) = aiv(iv,ic)
150  END DO ! iv
151  END DO ! ic
152  CASE default
153  CALL errorstop(global,err_reached_default,__line__)
154  END SELECT ! global%rkScheme
155 
156 ! *****************************************************************************
157 ! End
158 ! *****************************************************************************
159 
160  CALL deregisterfunction(global)
161 
162 END SUBROUTINE plag_rkinitgenericint
163 
164 
165 
166 
167 
168 !******************************************************************************
169 !
170 ! Purpose: Initialize Runge-Kutta scheme for Real variables.
171 !
172 ! Description: None.
173 !
174 ! Input:
175 ! region Region data
176 ! iStage Runge-Kutta stage
177 ! icBeg Beginning index for cell update
178 ! icEnd Ending index for cell update
179 ! ivBeg Beginning index for variable update
180 ! ivEnd Ending index for variable update
181 ! rv Real variables
182 ! rvOld Old real variables
183 !
184 ! Output:
185 ! rvOld Old real variables
186 !
187 ! Notes: None.
188 !
189 !******************************************************************************
190 
191 SUBROUTINE plag_rkinitgenericreal(region,iStage,icBeg,icEnd,ivBeg,ivEnd,&
192  rv,rvold)
193 
194 ! *****************************************************************************
195 ! Definitions and declarations
196 ! *****************************************************************************
197 
198 ! =============================================================================
199 ! Arguments
200 ! =============================================================================
201 
202  INTEGER, INTENT(IN) :: icbeg,icend,istage,ivbeg,ivend
203  REAL(RFREAL), DIMENSION(:,:), POINTER :: rv,rvold
204  TYPE(t_region) :: region
205 
206 ! =============================================================================
207 ! Locals
208 ! =============================================================================
209 
210  CHARACTER(CHRLEN) :: rcsidentstring
211  INTEGER :: ic,iv
212  TYPE(t_global), POINTER :: global
213 
214 ! *****************************************************************************
215 ! Start
216 ! *****************************************************************************
217 
218  rcsidentstring = '$RCSfile: PLAG_ModRkInit.F90,v $ $Revision: 1.8 $'
219 
220  global => region%global
221 
222  CALL registerfunction(global,'PLAG_RkInitGenericReal',&
223  'PLAG_ModRkInit.F90')
224 
225 ! *****************************************************************************
226 ! Initialize Runge-Kutta scheme
227 ! *****************************************************************************
228 
229  SELECT CASE ( global%rkScheme )
230  CASE ( rk_scheme_4_classical )
231  IF ( istage == 1 ) THEN
232  DO ic = icbeg,icend
233  DO iv = ivbeg,ivend
234  rvold(iv,ic) = rv(iv,ic)
235  END DO ! iv
236  END DO ! ic
237  END IF ! iStage
238  CASE ( rk_scheme_3_wray )
239  DO ic = icbeg,icend
240  DO iv = ivbeg,ivend
241  rvold(iv,ic) = rv(iv,ic)
242  END DO ! iv
243  END DO ! ic
244  CASE default
245  CALL errorstop(global,err_reached_default,__line__)
246  END SELECT ! global%rkScheme
247 
248 ! *****************************************************************************
249 ! End
250 ! *****************************************************************************
251 
252  CALL deregisterfunction(global)
253 
254 END SUBROUTINE plag_rkinitgenericreal
255 
256 
257 
258 
259 
260 !******************************************************************************
261 !
262 ! Purpose: Driver that initializes primary variables.
263 !
264 ! Description: none.
265 !
266 ! Input: istage = RK stage
267 ! region = data of current region.
268 !
269 ! Output: region%levels%plag%cvOld
270 ! region%levels%plag%aivOld
271 ! region%levels%plag%arvOld
272 !
273 ! Notes: none.
274 !
275 !******************************************************************************
276 
277 SUBROUTINE plag_rkinitprimary( region, iStage )
278 
279 ! *****************************************************************************
280 ! Definitions and declarations
281 ! *****************************************************************************
282 
283 ! =============================================================================
284 ! Arguments
285 ! =============================================================================
286 
287  INTEGER, INTENT(IN) :: istage
288  TYPE(t_region), INTENT(INOUT), TARGET :: region
289 
290 ! =============================================================================
291 ! Locals
292 ! =============================================================================
293 
294  CHARACTER(CHRLEN) :: rcsidentstring
295 
296 #ifdef RFLO
297  INTEGER :: ilev
298 #endif
299  INTEGER :: naiv,narv,ncv,npcls
300  INTEGER, POINTER, DIMENSION(:,:) :: paiv, paivold
301 
302  REAL(RFREAL), POINTER, DIMENSION(:,:) :: parv, parvold, pcv, pcvold
303 
304  TYPE(t_plag), POINTER :: pplag
305  TYPE(t_global), POINTER :: global
306 
307 ! *****************************************************************************
308 ! Start
309 ! *****************************************************************************
310 
311  rcsidentstring = '$RCSfile: PLAG_ModRkInit.F90,v $ $Revision: 1.8 $'
312 
313  global => region%global
314 
315  CALL registerfunction(global,'PLAG_RkInitPrimary',&
316  'PLAG_ModRkInit.F90')
317 
318 !******************************************************************************
319 ! Set pointers
320 !******************************************************************************
321 
322 #ifdef RFLO
323  ilev = region%currLevel
324  pplag => region%levels(ilev)%plag
325 #endif
326 #ifdef RFLU
327  pplag => region%plag
328 #endif
329 
330  paiv => pplag%aiv
331  parv => pplag%arv
332  pcv => pplag%cv
333 
334  paivold => pplag%aivOld
335  parvold => pplag%arvOld
336  pcvold => pplag%cvOld
337 
338 !******************************************************************************
339 ! Get dimensions
340 !******************************************************************************
341 
342 #ifdef RFLO
343  npcls = region%levels(ilev)%plag%nPcls
344 #endif
345 #ifdef RFLU
346  npcls = region%plag%nPcls
347 #endif
348 
349  naiv = pplag%nAiv
350  narv = pplag%nArv
351  ncv = pplag%nCv
352 
353 !******************************************************************************
354 ! Initialize previous solution
355 !******************************************************************************
356 
357  CALL plag_rkinitgenericint( region,istage,1,npcls,1,naiv,paiv,paivold )
358  CALL plag_rkinitgenericreal( region,istage,1,npcls,1,narv,parv,parvold )
359  CALL plag_rkinitgenericreal( region,istage,1,npcls,1,ncv ,pcv ,pcvold )
360 
361 ! *****************************************************************************
362 ! End
363 ! *****************************************************************************
364 
365  CALL deregisterfunction(global)
366 
367 END SUBROUTINE plag_rkinitprimary
368 
369 
370 
371 
372 
373 
374 
375 !******************************************************************************
376 !
377 ! Purpose: Driver that initializes variables for tiles.
378 !
379 ! Description: none.
380 !
381 ! Input: region = current region.
382 ! iStage = current RK stage.
383 !
384 ! Output: region%levels%tilePlag%cvOld
385 !
386 ! Notes: none.
387 !
388 !******************************************************************************
389 
390 SUBROUTINE plag_injctilerkinit( region, iStage )
391 
392 
393 ! *****************************************************************************
394 ! Definitions and declarations
395 ! *****************************************************************************
396 
397 ! =============================================================================
398 ! Arguments
399 ! =============================================================================
400 
401  INTEGER, INTENT(IN) :: istage
402  TYPE(t_region), INTENT(INOUT), TARGET :: region
403 
404 ! =============================================================================
405 ! Locals
406 ! =============================================================================
407 
408  CHARACTER(CHRLEN) :: rcsidentstring
409  INTEGER :: bctype,ipatch,ncv,npatches,ntiles
410 #ifdef RFLO
411  INTEGER :: ilev,n1,n2
412 #endif
413 
414  REAL(RFREAL), POINTER, DIMENSION(:,:) :: pcv, pcvold
415 
416  TYPE(t_patch), POINTER :: ppatch
417  TYPE(t_tile_plag), POINTER :: ptileplag
418  TYPE(t_global), POINTER :: global
419 
420 ! *****************************************************************************
421 ! Start
422 ! *****************************************************************************
423 
424  rcsidentstring = '$RCSfile: PLAG_ModRkInit.F90,v $ $Revision: 1.8 $'
425 
426  global => region%global
427 
428  CALL registerfunction(global,'PLAG_InjcTileRkInit',&
429  'PLAG_ModRkInit.F90')
430 
431 !******************************************************************************
432 ! Get dimensions
433 !******************************************************************************
434 
435 #ifdef RFLO
436  ilev = region%currLevel
437  npatches = region%nPatches
438 #endif
439 #ifdef RFLU
440  npatches = region%grid%nPatches
441 #endif
442 
443 !******************************************************************************
444 ! Loop over patches
445 !******************************************************************************
446 
447  DO ipatch=1,npatches
448 
449 #ifdef RFLO
450  ppatch => region%levels(ilev)%patches(ipatch)
451 #endif
452 #ifdef RFLU
453  ppatch => region%patches(ipatch)
454 #endif
455 
456  bctype = ppatch%bcType
457 
458 ! =============================================================================
459 ! Select injection boundary condition
460 ! =============================================================================
461 
462 #ifdef RFLU
463  IF ( (bctype >= bc_injection .AND. bctype <= bc_injection + bc_range) .OR. &
464  (bctype >= bc_inflow .AND. bctype <= bc_inflow + bc_range) ) THEN
465 #else
466  IF ( (bctype >= bc_injection .AND. bctype <= bc_injection + bc_range)) THEN
467 #endif
468 
469 ! ----------------------------------------------------------------------------
470 ! Get tile dimensions and set pointers
471 ! ----------------------------------------------------------------------------
472 
473 #ifdef RFLO
474  n1 = abs(ppatch%l1end -ppatch%l1beg ) + 1
475  n2 = abs(ppatch%l2end -ppatch%l2beg ) + 1
476  ntiles = n1*n2
477 #endif
478 #ifdef RFLU
479  ntiles = ppatch%nBFaces
480 #endif
481 
482  ptileplag => ppatch%tilePlag
483 
484  ncv = ptileplag%nCv
485 
486  pcv => ptileplag%cv
487  pcvold => ptileplag%cvOld
488 
489 ! ----------------------------------------------------------------------------
490 ! Initialize previous solution
491 ! ----------------------------------------------------------------------------
492 
493  CALL plag_rkinitgenericreal( region,istage,1,ntiles,1,ncv,pcv,pcvold )
494 
495  END IF !bcType
496 
497  END DO ! iPatch
498 
499 ! *****************************************************************************
500 ! End
501 ! *****************************************************************************
502 
503  CALL deregisterfunction(global)
504 
505 END SUBROUTINE plag_injctilerkinit
506 
507 ! ******************************************************************************
508 ! End
509 ! ******************************************************************************
510 
511 END MODULE plag_modrkinit
512 
513 !******************************************************************************
514 !
515 ! RCS Revision history:
516 !
517 ! $Log: PLAG_ModRkInit.F90,v $
518 ! Revision 1.8 2009/03/02 00:19:36 mtcampbe
519 ! Added some ifdefs around Rocflo to disable particle injection on INFLOW
520 ! boundaries and added some checks around MPI tags utilizing a new global
521 ! data item, global%mpiTagMax.
522 !
523 ! Revision 1.7 2008/12/06 08:44:34 mtcampbe
524 ! Updated license.
525 !
526 ! Revision 1.6 2008/11/19 22:17:46 mtcampbe
527 ! Added Illinois Open Source License/Copyright
528 !
529 ! Revision 1.5 2006/09/18 20:30:18 fnajjar
530 ! Activated tile datastructure for inflow bc
531 !
532 ! Revision 1.4 2006/04/07 15:19:23 haselbac
533 ! Removed tabs
534 !
535 ! Revision 1.3 2005/05/26 23:02:05 fnajjar
536 ! Bug fix in setting iLev before defining pPlag pointer
537 !
538 ! Revision 1.2 2005/05/23 18:42:15 fnajjar
539 ! Bug fix to define pointers before setting dimensions
540 !
541 ! Revision 1.1 2005/05/19 16:02:43 fnajjar
542 ! Initial import
543 !
544 !******************************************************************************
545 
546 
547 
548 
549 
550 
551 
552 
553 
554 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
**********************************************************************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 ic
subroutine plag_rkinitgenericint(region, iStage, icBeg, icEnd, ivBeg, ivEnd, aiv, aivOld)
subroutine, public plag_rkinitprimary(region, iStage)
**********************************************************************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 icbeg
subroutine, public plag_injctilerkinit(region, iStage)
subroutine plag_rkinitgenericreal(region, iStage, icBeg, icEnd, ivBeg, ivEnd, rv, rvOld)
**********************************************************************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 icend
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469