Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DescaleGridSpeeds.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: Descale 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 descaled because they are scaled during the
36 ! Runge-Kutta stages, but for consistent restarts, they need to be
37 ! written out consistent with their values when they were used for the
38 ! time-step computation.
39 !
40 !******************************************************************************
41 !
42 ! $Id: DescaleGridSpeeds.F90,v 1.3 2008/12/06 08:44:09 mtcampbe Exp $
43 !
44 ! Copyright: (c) 2003 by the University of Illinois
45 !
46 !******************************************************************************
47 
48 SUBROUTINE descalegridspeeds( region )
49 
50  USE moddatatypes
51  USE modgrid, ONLY : t_grid
52  USE moddatastruct, ONLY: t_region
53  USE modbndpatch, ONLY : t_patch
54  USE modglobal, ONLY : t_global
55  USE moderror
56  USE modparameters
57 #ifdef RFLO
59 #include "Indexing.h"
60 #endif
61 #ifdef RFLU
62  USE rflu_modgrid
63 #endif
64 
65  IMPLICIT NONE
66 
67 ! *****************************************************************************
68 ! Declarations and definitions
69 ! *****************************************************************************
70 
71 ! =============================================================================
72 ! Arguments
73 ! =============================================================================
74 
75  TYPE(t_region) :: region
76 
77 ! =============================================================================
78 ! Locals
79 ! =============================================================================
80 
81  INTEGER :: ifc, ipatch, irk, irkstep
82  REAL(RFREAL) :: scalefactor, term
83  REAL(RFREAL) :: ark(5), grk(5)
84 #ifdef RFLO
85  INTEGER :: ilev, idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend
86  INTEGER :: ibn, ien, inoff, ijnoff, in
87  REAL(RFREAL), POINTER :: sivel(:), sjvel(:), skvel(:)
88 #endif
89 #ifdef RFLU
90  REAL(RFREAL), DIMENSION(:), POINTER :: gs
91  TYPE(t_patch), POINTER :: ppatch
92 #endif
93  TYPE(t_global), POINTER :: global
94 
95 ! *****************************************************************************
96 ! Start
97 ! *****************************************************************************
98 
99  global => region%global
100 
101  CALL registerfunction(global,'DescaleGridSpeeds',&
102  'DescaleGridSpeeds.F90')
103 
104 ! *****************************************************************************
105 ! Set pointers and variables
106 ! *****************************************************************************
107 
108  irkstep = region%irkStep
109 
110  ark(:) = region%mixtInput%ark(:)
111  grk(:) = region%mixtInput%grk(:)
112 
113 ! *****************************************************************************
114 ! Descale grid speeds
115 ! *****************************************************************************
116 
117 ! =============================================================================
118 ! Determine scaling factor (compare with ScaleGridSpeeds.F90)
119 ! =============================================================================
120 
121  term = 0.0_rfreal
122 
123  DO irk = 1,global%nrkSteps-1
124  term = term + grk(irk)/ark(irk)
125  END DO ! irk
126 
127  scalefactor = 1.0_rfreal/(1.0_rfreal/ark(global%nrkSteps) - term)
128 
129 ! =============================================================================
130 ! Interior faces
131 ! =============================================================================
132 
133 #ifdef RFLO
134  ilev = region%currLevel
135  CALL rflo_getdimensdummynodes( region,ilev,idnbeg,idnend, &
136  jdnbeg,jdnend,kdnbeg,kdnend )
137  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
138  ibn = indijk(idnbeg,jdnbeg,kdnbeg,inoff,ijnoff)
139  ien = indijk(idnend,jdnend,kdnend,inoff,ijnoff)
140 
141  sivel => region%levels(ilev)%grid%siVel
142  sjvel => region%levels(ilev)%grid%sjVel
143  skvel => region%levels(ilev)%grid%skVel
144 
145  DO in=ibn,ien
146  sivel(in) = scalefactor*sivel(in)
147  sjvel(in) = scalefactor*sjvel(in)
148  skvel(in) = scalefactor*skvel(in)
149  ENDDO
150 #endif
151 
152 #ifdef RFLU
153  gs => region%grid%gs
154 
155  DO ifc = 1,region%grid%nFaces
156  gs(ifc) = scalefactor*gs(ifc)
157  END DO ! ifc
158 
159 ! =============================================================================
160 ! Patch faces
161 ! =============================================================================
162 
163  DO ipatch = 1,region%grid%nPatches
164  ppatch => region%patches(ipatch)
165  gs => ppatch%gs
166 
167  DO ifc = 1,ppatch%nBFaces
168  gs(ifc) = scalefactor*gs(ifc)
169  END DO ! ifc
170  END DO ! iPatch
171 #endif
172 
173 ! *****************************************************************************
174 ! End
175 ! *****************************************************************************
176 
177  CALL deregisterfunction(global)
178 
179 END SUBROUTINE descalegridspeeds
180 
181 !******************************************************************************
182 !
183 ! RCS Revision history:
184 !
185 ! $Log: DescaleGridSpeeds.F90,v $
186 ! Revision 1.3 2008/12/06 08:44:09 mtcampbe
187 ! Updated license.
188 !
189 ! Revision 1.2 2008/11/19 22:17:22 mtcampbe
190 ! Added Illinois Open Source License/Copyright
191 !
192 ! Revision 1.1 2004/12/01 16:48:29 haselbac
193 ! Initial revision after changing case
194 !
195 ! Revision 1.7 2003/11/20 16:40:35 mdbrandy
196 ! Backing out RocfluidMP changes from 11-17-03
197 !
198 ! Revision 1.4 2003/10/01 23:52:09 jblazek
199 ! Corrected bug in moving noslip wall BC and grid speeds.
200 !
201 ! Revision 1.3 2003/05/15 02:57:02 jblazek
202 ! Inlined index function.
203 !
204 ! Revision 1.2 2003/03/15 16:14:30 haselbac
205 ! Changed loop limit
206 !
207 ! Revision 1.1 2003/02/25 21:42:24 haselbac
208 ! Initial revision
209 !
210 !******************************************************************************
211 
212 
213 
214 
215 
216 
217 
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 deregisterfunction(global)
Definition: ModError.F90:469
subroutine descalegridspeeds(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