Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CellGradientsMP.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: Calculate cell gradients for higher-order schemes in RocfluidMP
26 ! framework.
27 !
28 ! Description: None.
29 !
30 ! Input:
31 ! region Data of current region
32 !
33 ! Output: None.
34 !
35 ! Notes: None.
36 !
37 ! ******************************************************************************
38 !
39 ! $Id: CellGradientsMP.F90,v 1.12 2008/12/06 08:44:08 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2003-2006 by the University of Illinois
42 !
43 ! ******************************************************************************
44 
45 SUBROUTINE cellgradientsmp(region)
46 
47  USE moddatatypes
48  USE moderror
49  USE modparameters
50  USE modglobal, ONLY: t_global
51  USE moddatastruct, ONLY: t_region
52 
53 #ifdef RFLU
67 #endif
68 
69  IMPLICIT NONE
70 
71 ! ******************************************************************************
72 ! Definitions and declarations
73 ! ******************************************************************************
74 
75 ! ==============================================================================
76 ! Arguments
77 ! ==============================================================================
78 
79  TYPE(t_region), TARGET :: region
80 
81 ! ==============================================================================
82 ! Locals
83 ! ==============================================================================
84 
85  TYPE(t_global), POINTER :: global
86 
87 #ifdef RFLU
88  INTEGER :: varinfomixt(cv_mixt_dens:cv_mixt_pres)
89  TYPE(t_region), POINTER :: pregion
90 #ifdef SPEC
91  INTEGER :: errorflag,ispec
92  INTEGER, DIMENSION(:), ALLOCATABLE :: varinfospec
93 #endif
94 #endif
95 
96 ! ******************************************************************************
97 ! Start
98 ! ******************************************************************************
99 
100  global => region%global
101 
102  CALL registerfunction(global,'CellGradientsMP',&
103  'CellGradientsMP.F90')
104 
105 #ifdef RFLU
106 ! ******************************************************************************
107 ! Compute cell gradients
108 ! ******************************************************************************
109 
110  pregion => region
111 
112  IF ( pregion%mixtInput%spaceOrder > 1 ) THEN
113 
114 ! ==============================================================================
115 ! Mixture
116 ! ==============================================================================
117 
118 ! ------------------------------------------------------------------------------
119 ! Convert to primitive state vector
120 ! ------------------------------------------------------------------------------
121 
122  SELECT CASE ( pregion%mixtInput%gasModel )
123  CASE ( gas_model_tcperf, &
124  gas_model_tperf, &
125  gas_model_mixt_tcperf, &
126  gas_model_mixt_tperf, &
127  gas_model_mixt_pseudo )
128  CALL rflu_convertcvcons2prim(pregion,cv_mixt_state_duvwp)
129 
130  varinfomixt(cv_mixt_dens) = v_mixt_dens
131  varinfomixt(cv_mixt_xvel) = v_mixt_xvel
132  varinfomixt(cv_mixt_yvel) = v_mixt_yvel
133  varinfomixt(cv_mixt_zvel) = v_mixt_zvel
134  varinfomixt(cv_mixt_pres) = v_mixt_pres
135  CASE ( gas_model_mixt_gasliq )
136  CALL rflu_convertcvcons2prim(pregion,cv_mixt_state_duvwt)
137 
138  varinfomixt(cv_mixt_dens) = v_mixt_dens
139  varinfomixt(cv_mixt_xvel) = v_mixt_xvel
140  varinfomixt(cv_mixt_yvel) = v_mixt_yvel
141  varinfomixt(cv_mixt_zvel) = v_mixt_zvel
142  varinfomixt(cv_mixt_temp) = v_mixt_temp
143  CASE default
144  CALL errorstop(global,err_reached_default,__line__)
145  END SELECT ! pRegion%mixtInput%gasModel
146 
147 ! ------------------------------------------------------------------------------
148 ! Compute gradients
149 ! ------------------------------------------------------------------------------
150 
151  CALL rflu_computegradcellswrapper(pregion,cv_mixt_dens,cv_mixt_pres, &
152  grc_mixt_dens,grc_mixt_pres, &
153  varinfomixt,pregion%mixt%cv, &
154  pregion%mixt%gradCell)
155 
156 ! ------------------------------------------------------------------------------
157 ! Modify gradients
158 ! ------------------------------------------------------------------------------
159 
160  SELECT CASE ( pregion%mixtInput%reconst )
161  CASE ( reconst_none )
162  CASE ( reconst_weno_simple )
163  CALL rflu_wenogradcellswrapper(pregion,grc_mixt_dens,grc_mixt_pres, &
164  pregion%mixt%gradCell)
165  CALL rflu_limitgradcellssimple(pregion,cv_mixt_dens,cv_mixt_pres, &
166  grc_mixt_dens,grc_mixt_pres, &
167  pregion%mixt%cv,pregion%mixt%cvInfo, &
168  pregion%mixt%gradCell)
169  CASE ( reconst_weno_xyz )
170  CALL rflu_wenogradcellsxyzwrapper(pregion,grc_mixt_dens,grc_mixt_pres, &
171  pregion%mixt%gradCell)
172  CALL rflu_limitgradcellssimple(pregion,cv_mixt_dens,cv_mixt_pres, &
173  grc_mixt_dens,grc_mixt_pres, &
174  pregion%mixt%cv,pregion%mixt%cvInfo, &
175  pregion%mixt%gradCell)
176  CASE ( reconst_lim_barthjesp )
177  CALL rflu_createlimiter(pregion,grc_mixt_dens,grc_mixt_pres, &
178  pregion%mixt%lim)
179  CALL rflu_computelimiterbarthjesp(pregion,cv_mixt_dens,cv_mixt_pres, &
180  grc_mixt_dens,grc_mixt_pres, &
181  pregion%mixt%cv, &
182  pregion%mixt%gradCell, &
183  pregion%mixt%lim)
184  CALL rflu_limitgradcells(pregion,grc_mixt_dens,grc_mixt_pres, &
185  pregion%mixt%gradCell,pregion%mixt%lim)
186  CALL rflu_destroylimiter(pregion,pregion%mixt%lim)
187  CASE ( reconst_lim_venkat )
188  CALL rflu_createlimiter(pregion,grc_mixt_dens,grc_mixt_pres, &
189  pregion%mixt%lim)
190  CALL rflu_computelimitervenkat(pregion,cv_mixt_dens,cv_mixt_pres, &
191  grc_mixt_dens,grc_mixt_pres, &
192  pregion%mixt%cv,pregion%mixt%gradCell, &
193  pregion%mixt%lim)
194  CALL rflu_limitgradcells(pregion,grc_mixt_dens,grc_mixt_pres, &
195  pregion%mixt%gradCell,pregion%mixt%lim)
196  CALL rflu_destroylimiter(pregion,pregion%mixt%lim)
197  CASE default
198  CALL errorstop(global,err_reached_default,__line__)
199  END SELECT ! pRegion%mixtInput%reconst
200 
201 ! ------------------------------------------------------------------------------
202 ! Convert back to primitive state vector
203 ! ------------------------------------------------------------------------------
204 
205  CALL rflu_convertcvprim2cons(pregion,cv_mixt_state_cons)
206 
207 #ifdef SPEC
208 ! ==============================================================================
209 ! Species
210 ! ==============================================================================
211 
212  IF ( global%specUsed .EQV. .true. ) THEN
213 
214 ! ------------------------------------------------------------------------------
215 ! Convert to primitive state vector
216 ! ------------------------------------------------------------------------------
217 
218  CALL rflu_scalarconvertcvcons2prim(pregion,pregion%spec%cv, &
219  pregion%spec%cvState)
220 
221  ALLOCATE(varinfospec(pregion%specInput%nSpecies),stat=errorflag)
222  global%error = errorflag
223  IF ( global%error /= err_none ) THEN
224  CALL errorstop(global,err_allocate,__line__,'varInfoSpec')
225  END IF ! global%error
226 
227  DO ispec = 1,pregion%specInput%nSpecies
228  varinfospec(ispec) = v_spec_var1 + ispec - 1
229  END DO ! iSpec
230 
231 ! ------------------------------------------------------------------------------
232 ! Compute gradients
233 ! ------------------------------------------------------------------------------
234 
235  CALL rflu_computegradcellswrapper(pregion,1,pregion%specInput%nSpecies, &
236  1,pregion%specInput%nSpecies, &
237  varinfospec,pregion%spec%cv, &
238  pregion%spec%gradCell)
239 
240  DEALLOCATE(varinfospec,stat=errorflag)
241  global%error = errorflag
242  IF ( global%error /= err_none ) THEN
243  CALL errorstop(global,err_deallocate,__line__,'varInfoSpec')
244  END IF ! global%error
245 
246 ! ------------------------------------------------------------------------------
247 ! Modify gradients
248 ! ------------------------------------------------------------------------------
249 
250  SELECT CASE ( pregion%mixtInput%reconst )
251  CASE ( reconst_none )
252  CASE ( reconst_weno_simple )
253  CALL rflu_wenogradcellswrapper(pregion,1,pregion%specInput%nSpecies, &
254  pregion%spec%gradCell)
255  CALL rflu_limitgradcellssimple(pregion,1, &
256  pregion%specInput%nSpecies,1, &
257  pregion%specInput%nSpecies, &
258  pregion%spec%cv,pregion%spec%cvInfo, &
259  pregion%spec%gradCell)
260  CASE ( reconst_weno_xyz )
261  CALL rflu_wenogradcellsxyzwrapper(pregion,1, &
262  pregion%specInput%nSpecies, &
263  pregion%spec%gradCell)
264  CALL rflu_limitgradcellssimple(pregion,1, &
265  pregion%specInput%nSpecies,1, &
266  pregion%specInput%nSpecies, &
267  pregion%spec%cv,pregion%spec%cvInfo, &
268  pregion%spec%gradCell)
269  CASE ( reconst_lim_barthjesp )
270  CALL rflu_createlimiter(pregion,1,pregion%specInput%nSpecies, &
271  pregion%spec%lim)
272  CALL rflu_computelimiterbarthjesp(pregion,1, &
273  pregion%specInput%nSpecies,1, &
274  pregion%specInput%nSpecies, &
275  pregion%spec%cv, &
276  pregion%spec%gradCell, &
277  pregion%spec%lim)
278  CALL rflu_limitgradcells(pregion,1,pregion%specInput%nSpecies, &
279  pregion%spec%gradCell,pregion%spec%lim)
280  CALL rflu_destroylimiter(pregion,pregion%spec%lim)
281  CASE ( reconst_lim_venkat )
282  CALL rflu_createlimiter(pregion,1,pregion%specInput%nSpecies, &
283  pregion%spec%lim)
284  CALL rflu_computelimitervenkat(pregion,1, &
285  pregion%specInput%nSpecies,1, &
286  pregion%specInput%nSpecies, &
287  pregion%spec%cv, &
288  pregion%spec%gradCell, &
289  pregion%spec%lim)
290  CALL rflu_limitgradcells(pregion,1,pregion%specInput%nSpecies, &
291  pregion%spec%gradCell,pregion%spec%lim)
292  CALL rflu_destroylimiter(pregion,pregion%spec%lim)
293  CASE default
294  CALL errorstop(global,err_reached_default,__line__)
295  END SELECT ! pRegion%mixtInput%reconst
296 
297  CALL rflu_scalarconvertcvprim2cons(pregion,pregion%spec%cv, &
298  pregion%spec%cvState)
299  END IF ! global%specUsed
300 #endif
301  END IF ! pRegion%mixtInput%spaceOrder
302 #endif
303 
304 ! ******************************************************************************
305 ! End
306 ! ******************************************************************************
307 
308  CALL deregisterfunction(global)
309 
310 END SUBROUTINE cellgradientsmp
311 
312 ! ******************************************************************************
313 !
314 ! RCS Revision history:
315 !
316 ! $Log: CellGradientsMP.F90,v $
317 ! Revision 1.12 2008/12/06 08:44:08 mtcampbe
318 ! Updated license.
319 !
320 ! Revision 1.11 2008/11/19 22:17:22 mtcampbe
321 ! Added Illinois Open Source License/Copyright
322 !
323 ! Revision 1.10 2006/04/27 15:10:04 haselbac
324 ! Added VENKAT limiter option
325 !
326 ! Revision 1.9 2006/04/15 16:52:30 haselbac
327 ! Added RECONST_NONE option in CASE statements
328 !
329 ! Revision 1.8 2006/04/07 14:37:20 haselbac
330 ! Changes bcos of new WENO module and renamed routines
331 !
332 ! Revision 1.7 2006/03/26 20:21:11 haselbac
333 ! Introduced GL model, affects cv conversion
334 !
335 ! Revision 1.6 2006/01/06 22:03:36 haselbac
336 ! Added call to wrapper
337 !
338 ! Revision 1.5 2005/10/27 18:52:58 haselbac
339 ! Adapted to new cell grad routines
340 !
341 ! Revision 1.4 2005/10/05 13:45:07 haselbac
342 ! Revamped gradient computation
343 !
344 ! Revision 1.3 2005/07/11 20:24:36 haselbac
345 ! Added calls to WENO scheme with separate weighting in xyz directions
346 !
347 ! Revision 1.2 2005/07/11 19:21:15 mparmar
348 ! Added limiter reconstruction option
349 !
350 ! Revision 1.1 2004/12/01 16:48:20 haselbac
351 ! Initial revision after changing case
352 !
353 ! Revision 1.3 2004/07/28 15:29:18 jferry
354 ! created global variable for spec use
355 !
356 ! Revision 1.2 2004/01/29 22:52:37 haselbac
357 ! Added second-order for species
358 !
359 ! Revision 1.1 2003/12/04 03:22:54 haselbac
360 ! Initial revision
361 !
362 ! ******************************************************************************
363 
364 
365 
366 
367 
368 
369 
subroutine, public rflu_destroylimiter(pRegion, lim)
subroutine, public rflu_computelimitervenkat(pRegion, iBegVar, iEndVar, iBegGrad, iEndGrad, var, grad, lim)
subroutine, public rflu_computelimiterbarthjesp(pRegion, iBegVar, iEndVar, iBegGrad, iEndGrad, var, grad, lim)
subroutine, public rflu_createlimiter(pRegion, iBegGrad, iEndGrad, lim)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine cellgradientsmp(region)
subroutine, public rflu_limitgradcells(pRegion, iBegGrad, iEndGrad, grad, lim)
subroutine, public rflu_limitgradcellssimple(pRegion, iBegVar, iEndVar, iBegGrad, iEndGrad, var, varInfo, grad)
subroutine, public rflu_convertcvcons2prim(pRegion, cvStateFuture)
subroutine, public rflu_convertcvprim2cons(pRegion, cvStateFuture)
subroutine, public rflu_wenogradcellswrapper(pRegion, iBegGrad, iEndGrad, grad)
subroutine, public rflu_scalarconvertcvprim2cons(pRegion, cvScal, cvScalStateCurrent)
subroutine, public rflu_wenogradcellsxyzwrapper(pRegion, iBegGrad, iEndGrad, grad)
subroutine, public rflu_computegradcellswrapper(pRegion, iBegVar, iEndVar, iBegGrad, iEndGrad, varInfo, var, grad)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, public rflu_scalarconvertcvcons2prim(pRegion, cvScal, cvScalStateCurrent)