Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ScaleGridSpeeds.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: Scale grid speeds.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! region Pointer to region
31 !
32 ! Output: None.
33 !
34 ! Notes:
35 ! 1. Grid speeds need to be scaled because they are derived from an
36 ! expression equivalent to a forward Euler discretization, but the actual
37 ! solution is evolved using the Runge-Kutta scheme. As a result, the
38 ! right-hand side differs by a factor involving the Runge-Kutta
39 ! coefficients. Its the task of this routine to scale the grid speeds to
40 ! make up for this discrepancy.
41 ! 2. Note that at the last Runge-Kutta stage, the coefficient is negative!
42 !
43 !******************************************************************************
44 !
45 ! $Id: ScaleGridSpeeds.F90,v 1.3 2008/12/06 08:44:10 mtcampbe Exp $
46 !
47 ! Copyright: (c) 2002 by the University of Illinois
48 !
49 !******************************************************************************
50 
51 SUBROUTINE scalegridspeeds( region )
52 
53  USE moddatatypes
54  USE modgrid, ONLY: t_grid
55  USE moddatastruct, ONLY: t_region
56  USE modbndpatch, ONLY : t_patch
57  USE modglobal, ONLY : t_global
58  USE moderror
59  USE modparameters
60 #ifdef RFLO
62 #include "Indexing.h"
63 #endif
64 #ifdef RFLU
65  USE rflu_modgrid
66 #endif
67 
68  IMPLICIT NONE
69 
70 ! *****************************************************************************
71 ! Declarations and definitions
72 ! *****************************************************************************
73 
74 ! =============================================================================
75 ! Arguments
76 ! =============================================================================
77 
78  TYPE(t_region) :: region
79 
80 ! =============================================================================
81 ! Locals
82 ! =============================================================================
83 
84  INTEGER :: ifc, ipatch, irk, irkstep
85  REAL(RFREAL) :: scalefactor, term
86  REAL(RFREAL) :: ark(5), grk(5)
87 #ifdef RFLO
88  INTEGER :: ilev, idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend
89  INTEGER :: ibn, ien, inoff, ijnoff, in
90  REAL(RFREAL), POINTER :: sivel(:), sjvel(:), skvel(:)
91 #endif
92 #ifdef RFLU
93  REAL(RFREAL), DIMENSION(:), POINTER :: gs
94  TYPE(t_patch), POINTER :: ppatch
95 #endif
96  TYPE(t_global), POINTER :: global
97 
98 ! *****************************************************************************
99 ! Start
100 ! *****************************************************************************
101 
102  global => region%global
103 
104  CALL registerfunction(global,'ScaleGridSpeeds',&
105  'ScaleGridSpeeds.F90')
106 
107 ! *****************************************************************************
108 ! Set pointers and variables
109 ! *****************************************************************************
110 
111  irkstep = region%irkStep
112 
113  ark(:) = region%mixtInput%ark(:)
114  grk(:) = region%mixtInput%grk(:)
115 
116 ! *****************************************************************************
117 ! Scale grid speeds
118 ! *****************************************************************************
119 
120 ! =============================================================================
121 ! Determine scaling factor
122 ! =============================================================================
123 
124  IF ( irkstep > 1 .AND. irkstep < global%nrkSteps ) THEN
125  scalefactor = ark(irkstep-1)/ark(irkstep)
126  ELSE IF ( irkstep == 1 ) THEN
127  scalefactor = 1.0_rfreal/ark(irkstep)
128  ELSE IF ( irkstep == global%nrkSteps ) THEN
129  term = 0.0_rfreal
130 
131  DO irk = 1,global%nrkSteps-1
132  term = term + grk(irk)/ark(irk)
133  END DO ! irk
134 
135  scalefactor = (1.0_rfreal/ark(global%nrkSteps) - term)/ark(irkstep-1)
136  ELSE ! Defensive programming
137  CALL errorstop(global,err_reached_default,__line__)
138  END IF ! irkStep
139 
140 ! =============================================================================
141 ! Interior faces
142 ! =============================================================================
143 
144 #ifdef RFLO
145  ilev = region%currLevel
146  CALL rflo_getdimensdummynodes( region,ilev,idnbeg,idnend, &
147  jdnbeg,jdnend,kdnbeg,kdnend )
148  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
149  ibn = indijk(idnbeg,jdnbeg,kdnbeg,inoff,ijnoff)
150  ien = indijk(idnend,jdnend,kdnend,inoff,ijnoff)
151 
152  sivel => region%levels(ilev)%grid%siVel
153  sjvel => region%levels(ilev)%grid%sjVel
154  skvel => region%levels(ilev)%grid%skVel
155 
156  DO in=ibn,ien
157  sivel(in) = scalefactor*sivel(in)
158  sjvel(in) = scalefactor*sjvel(in)
159  skvel(in) = scalefactor*skvel(in)
160  ENDDO
161 #endif
162 
163 #ifdef RFLU
164  gs => region%grid%gs
165 
166  DO ifc = 1,region%grid%nFaces
167  gs(ifc) = scalefactor*gs(ifc)
168  END DO ! ifc
169 
170 ! =============================================================================
171 ! Patch faces
172 ! =============================================================================
173 
174  DO ipatch = 1,region%grid%nPatches
175  ppatch => region%patches(ipatch)
176  gs => ppatch%gs
177 
178  DO ifc = 1,ppatch%nBFaces
179  gs(ifc) = scalefactor*gs(ifc)
180  END DO ! ifc
181  END DO ! iPatch
182 #endif
183 
184 ! *****************************************************************************
185 ! End
186 ! *****************************************************************************
187 
188  CALL deregisterfunction(global)
189 
190 END SUBROUTINE scalegridspeeds
191 
192 !******************************************************************************
193 !
194 ! RCS Revision history:
195 !
196 ! $Log: ScaleGridSpeeds.F90,v $
197 ! Revision 1.3 2008/12/06 08:44:10 mtcampbe
198 ! Updated license.
199 !
200 ! Revision 1.2 2008/11/19 22:17:23 mtcampbe
201 ! Added Illinois Open Source License/Copyright
202 !
203 ! Revision 1.1 2004/12/01 16:51:17 haselbac
204 ! Initial revision after changing case
205 !
206 ! Revision 1.8 2003/11/20 16:40:35 mdbrandy
207 ! Backing out RocfluidMP changes from 11-17-03
208 !
209 ! Revision 1.5 2003/10/01 23:52:09 jblazek
210 ! Corrected bug in moving noslip wall BC and grid speeds.
211 !
212 ! Revision 1.4 2003/05/15 02:57:02 jblazek
213 ! Inlined index function.
214 !
215 ! Revision 1.3 2003/03/15 16:35:29 haselbac
216 ! Changed loop limit
217 !
218 ! Revision 1.2 2002/12/02 20:10:41 jblazek
219 ! Moved RFLU_ModGrid inside ifdef RFLU in ScaleGridSpeeds.
220 !
221 ! Revision 1.1 2002/11/08 21:55:48 haselbac
222 ! Initial revision
223 !
224 !******************************************************************************
225 
226 
227 
228 
229 
230 
231 
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 jdnbeg
**********************************************************************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 idnend
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 jdnend
**********************************************************************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 idnbeg
subroutine rflo_getdimensdummynodes(region, iLev, idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine scalegridspeeds(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 kdnbeg