Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RADI_FluxLimiter.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: compute the radiation flux limiter based on the model selected.
26 !
27 ! Description: none.
28 !
29 ! Input: region = data of current region.
30 !
31 ! Output: region%levels%radi%fluxLim = flux limiter in diff. based radiation
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: RADI_FluxLimiter.F90,v 1.3 2008/12/06 08:44:37 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE radi_fluxlimiter( region )
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
49  USE moderror
50  USE modparameters
52  IMPLICIT NONE
53 
54 #include "Indexing.h"
55 
56 ! ... parameters
57  TYPE(t_region) :: region
58 
59 ! ... loop variables
60  INTEGER :: i, j, k
61 
62 ! ... local variables
63  INTEGER :: idcbeg, idcend, jdcbeg, jdcend, kdcbeg, kdcend
64  INTEGER :: ilev, icoff, ijcoff, inoff, ijnoff
65  INTEGER :: ijkc, ijkn, ijkni, ijknj, ijknk, errfl
66 
67  REAL(RFREAL) :: one3rd, one6th, rparam, grademod, coefc, radenerg
68  REAL(RFREAL), POINTER :: dv(:,:), rcv(:,:), rdv(:,:), coef(:,:), fluxlim(:)
69  REAL(RFREAL), POINTER :: gradi(:,:), gradj(:,:), gradk(:,:)
70  REAL(RFREAL), POINTER :: rgradi(:,:), rgradj(:,:), rgradk(:,:)
71  REAL(RFREAL), ALLOCATABLE :: gradc(:,:,:,:)
72 
73 !******************************************************************************
74 
75  CALL registerfunction( region%global,'RADI_FluxLimiter',&
76  'RADI_FluxLimiter.F90' )
77 
78 ! get constants, dimensions and pointers --------------------------------------
79 
80  one3rd = 1._rfreal/3._rfreal
81  one6th = 1._rfreal/6._rfreal
82  ilev = region%currLevel
83 
84  CALL rflo_getdimensdummy( region,ilev,idcbeg,idcend, &
85  jdcbeg,jdcend,kdcbeg,kdcend )
86  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
87  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
88 
89  gradi => region%levels(ilev)%mixt%gradi
90  gradj => region%levels(ilev)%mixt%gradj
91  gradk => region%levels(ilev)%mixt%gradk
92  dv => region%levels(ilev)%mixt%dv
93  rdv => region%levels(ilev)%radi%dv
94  coef => region%levels(ilev)%radi%radCoef
95 
96  IF (region%radiInput%radiModel == radi_model_fldsrc .OR. &
97  region%radiInput%radiModel == radi_model_fldtran) THEN
98  ALLOCATE( gradc(idcbeg:idcend,jdcbeg:jdcend,kdcbeg:kdcend,3),stat=errfl )
99  region%global%error = errfl
100  CALL errorstop( region%global,err_allocate,__line__ )
101  ENDIF
102 
103 ! get effective temperature --------------------------------------------------
104 
105  IF ((region%radiInput%radiModel == radi_model_ross) .OR. &
106  (region%radiInput%radiModel == radi_model_fldsrc .AND. &
107  region%radiInput%fluxLim == fld_lim_none)) THEN
108  DO k=kdcbeg,kdcend
109  DO j=jdcbeg,jdcend
110  DO i=idcbeg,idcend
111  ijkc = indijk(i ,j,k,icoff,ijcoff)
112  fluxlim(ijkc) = one3rd
113  ENDDO ! i
114  ENDDO ! j
115  ENDDO ! k
116  ELSEIF ((region%radiInput%radiModel == radi_model_fldsrc) .AND. &
117  (region%radiInput%fluxLim == fld_lim_lp)) THEN
118 
119  DO k=kdcbeg,kdcend
120  DO j=jdcbeg,jdcend
121  DO i=idcbeg,idcend
122  ijkn = indijk(i ,j ,k ,inoff,ijnoff)
123  ijkni = indijk(i+1,j ,k ,inoff,ijnoff)
124  ijknj = indijk(i ,j+1,k ,inoff,ijnoff)
125  ijknk = indijk(i ,j ,k+1,inoff,ijnoff)
126  gradc(i,j,k,1) = one6th* &
127  (gradi(gr_mixt_tx,ijkn)+gradi(gr_mixt_tx,ijkni) + &
128  gradj(gr_mixt_tx,ijkn)+gradj(gr_mixt_tx,ijknj) + &
129  gradk(gr_mixt_tx,ijkn)+gradk(gr_mixt_tx,ijknk))
130  gradc(i,j,k,2) = one6th* &
131  (gradi(gr_mixt_ty,ijkn)+gradi(gr_mixt_ty,ijkni) + &
132  gradj(gr_mixt_ty,ijkn)+gradj(gr_mixt_ty,ijknj) + &
133  gradk(gr_mixt_ty,ijkn)+gradk(gr_mixt_ty,ijknk))
134  gradc(i,j,k,3) = one6th* &
135  (gradi(gr_mixt_tz,ijkn)+gradi(gr_mixt_tz,ijkni) + &
136  gradj(gr_mixt_tz,ijkn)+gradj(gr_mixt_tz,ijknj) + &
137  gradk(gr_mixt_tz,ijkn)+gradk(gr_mixt_tz,ijknk))
138  ENDDO ! i
139  ENDDO ! j
140  ENDDO ! k
141  DO k=kdcbeg,kdcend
142  DO j=jdcbeg,jdcend
143  DO i=idcbeg,idcend
144  ijkc = indijk(i ,j,k,icoff,ijcoff)
145  grademod = sqrt( gradc(i,j,k,1)*gradc(i,j,k,1) + &
146  gradc(i,j,k,2)*gradc(i,j,k,2) + &
147  gradc(i,j,k,3)*gradc(i,j,k,3) )
148  coefc = coef(ijkc,radi_coeff_extinct)
149  radenerg = abs( dv(dv_mixt_temp,ijkc) )
150  rparam = grademod/(coefc*radenerg)
151  fluxlim(ijkc) = flimiterlp(rparam)
152  ENDDO ! i
153  ENDDO ! j
154  ENDDO ! k
155  ELSEIF (region%radiInput%radiModel == radi_model_fldtran) THEN
156 
157  rcv => region%levels(ilev)%radi%cv
158  rgradi => region%levels(ilev)%radi%gradi
159  rgradj => region%levels(ilev)%radi%gradj
160  rgradk => region%levels(ilev)%radi%gradk
161 
162  DO k=kdcbeg,kdcend
163  DO j=jdcbeg,jdcend
164  DO i=idcbeg,idcend
165  ijkn = indijk(i ,j ,k ,inoff,ijnoff)
166  ijkni = indijk(i+1,j ,k ,inoff,ijnoff)
167  ijknj = indijk(i ,j+1,k ,inoff,ijnoff)
168  ijknk = indijk(i ,j ,k+1,inoff,ijnoff)
169  gradc(i,j,k,1) = one6th* &
170  (rgradi(gr_radi_ex,ijkn)+rgradi(gr_radi_ex,ijkni) + &
171  rgradj(gr_radi_ex,ijkn)+rgradj(gr_radi_ex,ijknj) + &
172  rgradk(gr_radi_ex,ijkn)+rgradk(gr_radi_ex,ijknk))
173  gradc(i,j,k,2) = one6th* &
174  (rgradi(gr_radi_ey,ijkn)+rgradi(gr_radi_ey,ijkni) + &
175  rgradj(gr_radi_ey,ijkn)+rgradj(gr_radi_ey,ijknj) + &
176  rgradk(gr_radi_ey,ijkn)+rgradk(gr_radi_ey,ijknk))
177  gradc(i,j,k,3) = one6th* &
178  (rgradi(gr_radi_ez,ijkn)+rgradi(gr_radi_ez,ijkni) + &
179  rgradj(gr_radi_ez,ijkn)+rgradj(gr_radi_ez,ijknj) + &
180  rgradk(gr_radi_ez,ijkn)+rgradk(gr_radi_ez,ijknk))
181  ENDDO ! i
182  ENDDO ! j
183  ENDDO ! k
184 
185  DO k=kdcbeg,kdcend
186  DO j=jdcbeg,jdcend
187  DO i=idcbeg,idcend
188  ijkc = indijk(i ,j,k,icoff,ijcoff)
189  grademod = sqrt( gradc(i,j,k,1)*gradc(i,j,k,1) + &
190  gradc(i,j,k,2)*gradc(i,j,k,2) + &
191  gradc(i,j,k,3)*gradc(i,j,k,3) )
192  coefc = coef(ijkc,radi_coeff_extinct)
193  radenerg = rcv(cv_radi_ener,ijkc)
194  rparam = grademod/(coefc*radenerg)
195  fluxlim(ijkc) = flimiterlp(rparam)
196  ENDDO ! i
197  ENDDO ! j
198  ENDDO ! k
199  ENDIF
200 
201 ! deallocate arrays
202 
203  IF (ALLOCATED( gradc )) THEN
204  DEALLOCATE( gradc, stat=errfl )
205  region%global%error = errfl
206  CALL errorstop( region%global,err_deallocate,__line__ )
207  ENDIF
208 
209 ! finalize --------------------------------------------------------------------
210 
211  CALL deregisterfunction( region%global )
212 
213 ! #############################################################################
214 
215  CONTAINS
216 
217  REAL(RFREAL) FUNCTION flimiterlp( r )
218 
219  REAL(RFREAL) :: r
220 
221  flimiterlp = (2._rfreal + r)/(6._rfreal + 3._rfreal*r + r*r)
222 
223  END FUNCTION flimiterlp
224 
225 END SUBROUTINE radi_fluxlimiter
226 
227 !******************************************************************************
228 !
229 ! RCS Revision history:
230 !
231 ! $Log: RADI_FluxLimiter.F90,v $
232 ! Revision 1.3 2008/12/06 08:44:37 mtcampbe
233 ! Updated license.
234 !
235 ! Revision 1.2 2008/11/19 22:17:50 mtcampbe
236 ! Added Illinois Open Source License/Copyright
237 !
238 ! Revision 1.1 2004/09/22 02:35:49 wasistho
239 ! changed file nomenclature from lower to upper case
240 !
241 ! Revision 1.2 2004/09/22 01:32:19 wasistho
242 ! switch LFD to FLD for flux limited diffusion
243 !
244 ! Revision 1.1 2004/09/18 18:02:07 wasistho
245 ! initial import for Limited Flux Diffusion radiation
246 !
247 !
248 !
249 !******************************************************************************
250 
251 
252 
253 
254 
255 
256 
unsigned char r() const
Definition: Color.h:68
**********************************************************************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 idcend
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double sqrt(double d)
Definition: double.h:73
subroutine radi_fluxlimiter(region)
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
REAL(RFREAL) function flimiterlp(r)
subroutine rflo_getdimensdummy(region, iLev, idcbeg, idcend, jdcbeg, jdcend, kdcbeg, kdcend)
**********************************************************************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 kdcbeg
blockLoc i
Definition: read.cpp:79
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
**********************************************************************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 idcbeg
**********************************************************************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 iEndG gradi(:,:)
**********************************************************************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 jdcend
j indices j
Definition: Indexing.h:6
**********************************************************************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 jdcbeg
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
**********************************************************************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 iEndG gradj(:,:)