Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModGridSpeedUtils.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: Collection of utility routines for manipulating grid speeds.
26 !
27 ! Description: None
28 !
29 ! Notes: None.
30 !
31 ! ******************************************************************************
32 !
33 ! $Id: RFLU_ModGridSpeedUtils.F90,v 1.7 2008/12/06 08:44:22 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2004 by the University of Illinois
36 !
37 ! ******************************************************************************
38 
40 
41  USE moddatatypes
42  USE modparameters
43  USE moddatastruct, ONLY: t_region
44  USE modglobal, ONLY: t_global
45  USE modgrid, ONLY: t_grid
46  USE modbndpatch, ONLY: t_patch
47  USE moderror
48 
49  IMPLICIT NONE
50 
51  PRIVATE
52  PUBLIC :: rflu_decideneedgridspeeds, &
59 
60  CONTAINS
61 
62 
63 
64 
65 
66 
67 
68 ! ******************************************************************************
69 !
70 ! Purpose: Decide whether need grid speeds.
71 !
72 ! Description: None.
73 !
74 ! Input:
75 ! pRegion Pointer to region data
76 !
77 ! Output: None.
78 !
79 ! Notes: None.
80 !
81 ! ******************************************************************************
82 
83  LOGICAL FUNCTION rflu_decideneedgridspeeds(pRegion)
84 
85  IMPLICIT NONE
86 
87 ! ******************************************************************************
88 ! Declarations and definitions
89 ! ******************************************************************************
90 
91 ! ==============================================================================
92 ! Arguments
93 ! ==============================================================================
94 
95  TYPE(t_region), POINTER :: pregion
96 
97 ! ******************************************************************************
98 ! Decide whether need grid speeds
99 ! ******************************************************************************
100 
101  rflu_decideneedgridspeeds = .false.
102 
103  IF ( pregion%mixtInput%moveGrid .EQV. .true. ) THEN
105  END IF ! pRegion%mixtInput%moveGrid
106 
107 ! ******************************************************************************
108 ! End
109 ! ******************************************************************************
110 
111  END FUNCTION rflu_decideneedgridspeeds
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 ! ******************************************************************************
122 !
123 ! Purpose: Descale grid speed for single face.
124 !
125 ! Description: None.
126 !
127 ! Input:
128 ! pRegion Pointer to region data
129 ! fs Scaled grid speed
130 !
131 ! Output:
132 ! fs Descaled grid speed
133 !
134 ! Notes: None.
135 !
136 ! ******************************************************************************
137 
138  FUNCTION rflu_descalegridspeed(pRegion,fs)
139 
140  IMPLICIT NONE
141 
142 ! ******************************************************************************
143 ! Declarations and definitions
144 ! ******************************************************************************
145 
146  REAL(RFREAL) :: rflu_descalegridspeed
147 
148 ! ==============================================================================
149 ! Arguments
150 ! ==============================================================================
151 
152  REAL(RFREAL), INTENT(INOUT) :: fs
153  TYPE(t_region), POINTER :: pregion
154 
155 ! ******************************************************************************
156 ! Scale grid speed
157 ! ******************************************************************************
158 
159  rflu_descalegridspeed = fs/pregion%grid%fsScaleFactor
160 
161 ! ******************************************************************************
162 ! End
163 ! ******************************************************************************
164 
165  END FUNCTION rflu_descalegridspeed
166 
167 
168 
169 
170 
171 
172 ! ******************************************************************************
173 !
174 ! Purpose: Descale grid speeds for faces and boundary patches.
175 !
176 ! Description: None.
177 !
178 ! Input:
179 ! pRegion Pointer to region data
180 !
181 ! Output: None.
182 !
183 ! Notes: None.
184 !
185 ! ******************************************************************************
186 
187  SUBROUTINE rflu_descalegridspeeds(pRegion)
188 
189  IMPLICIT NONE
190 
191 ! ******************************************************************************
192 ! Declarations and definitions
193 ! ******************************************************************************
194 
195 ! ==============================================================================
196 ! Arguments
197 ! ==============================================================================
198 
199  TYPE(t_region), POINTER :: pregion
200 
201 ! ==============================================================================
202 ! Locals
203 ! ==============================================================================
204 
205  INTEGER :: ifg,ifl,ipatch
206  REAL(RFREAL) :: scalefactor
207  TYPE(t_grid), POINTER :: pgrid
208  TYPE(t_patch), POINTER :: ppatch
209 
210 ! *****************************************************************************
211 ! Set pointers and variables
212 ! *****************************************************************************
213 
214  pgrid => pregion%grid
215 
216  scalefactor = 1.0_rfreal/pgrid%fsScaleFactor
217 
218 ! ******************************************************************************
219 ! Scale grid speeds
220 ! ******************************************************************************
221 
222  DO ifg = lbound(pgrid%gs,1),ubound(pgrid%gs,1)
223  pgrid%gs(ifg) = scalefactor*pgrid%gs(ifg)
224  END DO ! ifg
225 
226  DO ipatch = 1,pgrid%nPatches
227  ppatch => pregion%patches(ipatch)
228 
229  DO ifl = lbound(ppatch%gs,1),ubound(ppatch%gs,1)
230  ppatch%gs(ifl) = scalefactor*ppatch%gs(ifl)
231  END DO ! ifl
232  END DO ! iPatch
233 
234 ! ******************************************************************************
235 ! End
236 ! ******************************************************************************
237 
238  END SUBROUTINE rflu_descalegridspeeds
239 
240 
241 
242 
243 
244 
245 ! ******************************************************************************
246 !
247 ! Purpose: Initialize grid speed scale factor.
248 !
249 ! Description: None.
250 !
251 ! Input:
252 ! pRegion Pointer to region data
253 !
254 ! Output: None.
255 !
256 ! Notes:
257 ! 1. Needed for steady flows without grid motion so that calls to scaling
258 ! routines work properly.
259 !
260 ! ******************************************************************************
261 
262  SUBROUTINE rflu_initgridspeedscalefactor(pRegion)
263 
264  IMPLICIT NONE
265 
266 ! ******************************************************************************
267 ! Declarations and definitions
268 ! ******************************************************************************
269 
270 ! ==============================================================================
271 ! Arguments
272 ! ==============================================================================
273 
274  TYPE(t_region), POINTER :: pregion
275 
276 
277 ! ******************************************************************************
278 ! Initialize scaling factor
279 ! ******************************************************************************
280 
281  pregion%grid%fsScaleFactor = 1.0_rfreal
282 
283 ! ******************************************************************************
284 ! End
285 ! ******************************************************************************
286 
287  END SUBROUTINE rflu_initgridspeedscalefactor
288 
289 
290 
291 
292 
293 
294 
295 ! ******************************************************************************
296 !
297 ! Purpose: Scale grid speed for single face.
298 !
299 ! Description: None.
300 !
301 ! Input:
302 ! pRegion Pointer to region data
303 ! fs Descaled grid speed
304 !
305 ! Output:
306 ! fs Scaled grid speed
307 !
308 ! Notes: None.
309 !
310 ! ******************************************************************************
311 
312  FUNCTION rflu_scalegridspeed(pRegion,fs)
313 
314  IMPLICIT NONE
315 
316 ! ******************************************************************************
317 ! Declarations and definitions
318 ! ******************************************************************************
319 
320  REAL(RFREAL) :: rflu_scalegridspeed
321 
322 ! ==============================================================================
323 ! Arguments
324 ! ==============================================================================
325 
326  REAL(RFREAL), INTENT(INOUT) :: fs
327  TYPE(t_region), POINTER :: pregion
328 
329 ! ******************************************************************************
330 ! Scale grid speed
331 ! ******************************************************************************
332 
333  rflu_scalegridspeed = pregion%grid%fsScaleFactor*fs
334 
335 ! ******************************************************************************
336 ! End
337 ! ******************************************************************************
338 
339  END FUNCTION rflu_scalegridspeed
340 
341 
342 
343 
344 
345 
346 ! ******************************************************************************
347 !
348 ! Purpose: Scale grid speeds for faces and boundary patches.
349 !
350 ! Description: None.
351 !
352 ! Input:
353 ! pRegion Pointer to region data
354 !
355 ! Output: None.
356 !
357 ! Notes: None.
358 !
359 ! ******************************************************************************
360 
361  SUBROUTINE rflu_scalegridspeeds(pRegion)
362 
363  IMPLICIT NONE
364 
365 ! ******************************************************************************
366 ! Declarations and definitions
367 ! ******************************************************************************
368 
369 ! ==============================================================================
370 ! Arguments
371 ! ==============================================================================
372 
373  TYPE(t_region), POINTER :: pregion
374 
375 ! ==============================================================================
376 ! Locals
377 ! ==============================================================================
378 
379  INTEGER :: ifg,ifl,ipatch
380  REAL(RFREAL) :: scalefactor
381  TYPE(t_grid), POINTER :: pgrid
382  TYPE(t_patch), POINTER :: ppatch
383 
384 ! *****************************************************************************
385 ! Set pointers and variables
386 ! *****************************************************************************
387 
388  pgrid => pregion%grid
389 
390  scalefactor = pgrid%fsScaleFactor
391 
392 ! ******************************************************************************
393 ! Scale grid speeds
394 ! ******************************************************************************
395 
396  DO ifg = lbound(pgrid%gs,1),ubound(pgrid%gs,1)
397  pgrid%gs(ifg) = scalefactor*pgrid%gs(ifg)
398  END DO ! ifg
399 
400  DO ipatch = 1,pgrid%nPatches
401  ppatch => pregion%patches(ipatch)
402 
403  DO ifl = lbound(ppatch%gs,1),ubound(ppatch%gs,1)
404  ppatch%gs(ifl) = scalefactor*ppatch%gs(ifl)
405  END DO ! ifl
406  END DO ! iPatch
407 
408 ! ******************************************************************************
409 ! End
410 ! ******************************************************************************
411 
412  END SUBROUTINE rflu_scalegridspeeds
413 
414 
415 
416 
417 
418 
419 ! ******************************************************************************
420 !
421 ! Purpose: Set grid speed scale factor.
422 !
423 ! Description: None.
424 !
425 ! Input:
426 ! pRegion Pointer to region data
427 !
428 ! Output: None.
429 !
430 ! Notes: None.
431 !
432 ! ******************************************************************************
433 
434  SUBROUTINE rflu_setgridspeedscalefactor(pRegion)
435 
436  IMPLICIT NONE
437 
438 ! ******************************************************************************
439 ! Declarations and definitions
440 ! ******************************************************************************
441 
442 ! ==============================================================================
443 ! Arguments
444 ! ==============================================================================
445 
446  TYPE(t_region), POINTER :: pregion
447 
448 ! ==============================================================================
449 ! Locals
450 ! ==============================================================================
451 
452  INTEGER :: irk,irkstep,nrksteps
453  REAL(RFREAL) :: term
454  REAL(RFREAL) :: ark(5),grk(5)
455  TYPE(t_global), POINTER :: global
456  TYPE(t_grid), POINTER :: pgrid
457 
458 ! *****************************************************************************
459 ! Set pointers and variables
460 ! *****************************************************************************
461 
462  global => pregion%global
463  pgrid => pregion%grid
464 
465  irkstep = pregion%irkStep
466  nrksteps = pregion%global%nrkSteps
467 
468  ark(:) = pregion%mixtInput%ark(:)
469  grk(:) = pregion%mixtInput%grk(:)
470 
471 ! ******************************************************************************
472 ! Determine scaling factor
473 ! ******************************************************************************
474 
475  IF ( irkstep > 1 .AND. irkstep < nrksteps ) THEN
476  pgrid%fsScaleFactor = ark(irkstep-1)/ark(irkstep)
477  ELSE IF ( irkstep == 1 ) THEN
478  pgrid%fsScaleFactor = 1.0_rfreal/ark(irkstep)
479  ELSE IF ( irkstep == nrksteps ) THEN
480  term = 0.0_rfreal
481 
482  DO irk = 1,nrksteps-1
483  term = term + grk(irk)/ark(irk)
484  END DO ! iRk
485 
486  pgrid%fsScaleFactor = (1.0_rfreal/ark(nrksteps) - term)/ark(irkstep-1)
487  ELSE ! Defensive programming
488  CALL errorstop(global,err_reached_default,__line__)
489  END IF ! iRkStep
490 
491 ! ******************************************************************************
492 ! End
493 ! ******************************************************************************
494 
495  END SUBROUTINE rflu_setgridspeedscalefactor
496 
497 
498 
499 
500 END MODULE rflu_modgridspeedutils
501 
502 ! ******************************************************************************
503 !
504 ! RCS Revision history:
505 !
506 ! $Log: RFLU_ModGridSpeedUtils.F90,v $
507 ! Revision 1.7 2008/12/06 08:44:22 mtcampbe
508 ! Updated license.
509 !
510 ! Revision 1.6 2008/11/19 22:17:33 mtcampbe
511 ! Added Illinois Open Source License/Copyright
512 !
513 ! Revision 1.5 2006/04/07 15:19:19 haselbac
514 ! Removed tabs
515 !
516 ! Revision 1.4 2004/10/19 19:28:03 haselbac
517 ! Added routine to decide whether need grid speeds
518 !
519 ! Revision 1.3 2004/06/16 20:01:02 haselbac
520 ! Modification of loop limits to increase efficiency
521 !
522 ! Revision 1.2 2004/04/19 20:21:07 haselbac
523 ! Bug fix: Missing indGs added
524 !
525 ! Revision 1.1 2004/04/14 02:05:11 haselbac
526 ! Initial revision
527 !
528 ! ******************************************************************************
529 
530 
531 
532 
533 
534 
subroutine, public rflu_setgridspeedscalefactor(pRegion)
real(rfreal) function, public rflu_scalegridspeed(pRegion, fs)
LOGICAL function, public rflu_decideneedgridspeeds(pRegion)
real(rfreal) function, public rflu_descalegridspeed(pRegion, fs)
subroutine, public rflu_initgridspeedscalefactor(pRegion)
subroutine, public rflu_descalegridspeeds(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine, public rflu_scalegridspeeds(pRegion)