Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RADI_FlimDiffFlux.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 FLDTRAN diffusion flux: c*lamda(Er)/Kr*d_j(Er)
26 !
27 ! Description: this routine compute d_j(Er), while the parameters defining
28 ! the diffusion coefficient are known from previous computations.
29 !
30 ! Input: region = data of current region
31 !
32 ! Output: region%levels%radi%diss = diffusion flux added to FLD dissipation.
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: RADI_FlimDiffFlux.F90,v 1.3 2008/12/06 08:44:37 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2003 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE radi_flimdiffflux( region )
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY : t_region
48 #ifdef RFLO
51 
52 #include "Indexing.h"
53 #endif
54 #ifdef RFLU
55  USE rflu_moddifferentiation, ONLY: rflu_computegradfacesbak, &
56  rflu_computegradfacespatchesbak
57 #endif
59  USE moderror
60  USE modparameters
62  IMPLICIT NONE
63 
64 ! ... parameters
65 #ifdef RFLO
66  TYPE(t_region) :: region
67 #endif
68 #ifdef RFLU
69  TYPE(t_region), POINTER :: region
70 #endif
71 
72 ! ... loop variables
73  INTEGER :: i, j, k, ic, ipatch
74 
75 ! ... local variables
76  INTEGER :: ibegv, iendv, ibegg, iendg, ijkn, ijkc0, ijkc1
77  REAL(RFREAL) :: beta, sounda, flima, coefa, diffcoef, modsf, fd
78  REAL(RFREAL) :: sface(3), radenx, radeny, radenz
79  REAL(RFREAL), POINTER :: dv(:,:), rcv(:,:), rdiss(:,:), flim(:), coef(:,:)
80  REAL(RFREAL), POINTER :: qr(:)
81 
82 #ifdef RFLO
83  INTEGER :: ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend
84  INTEGER :: ilev, icoff, ijcoff, inoff, ijnoff
85  REAL(RFREAL), POINTER :: avgco(:,:), sf(:,:), grad(:,:)
86 #endif
87 #ifdef RFLU
88  INTEGER, POINTER :: f2c(:,:)
89  REAL(RFREAL), POINTER :: fn(:,:), grad(:,:,:)
90 #endif
91 
92 !******************************************************************************
93 
94  CALL registerfunction( region%global,'RADI_FlimDiffFlux',&
95  'RADI_FlimDiffFlux.F90' )
96 
97 ! get dimensions and pointers ------------------------------------------------
98 
99 #ifdef RFLO
100  ilev = region%currLevel
101  dv => region%levels(ilev)%mixt%dv
102  rcv => region%levels(ilev)%radi%cv
103  rdiss => region%levels(ilev)%radi%diss
104  flim => region%levels(ilev)%radi%fluxLim
105  coef => region%levels(ilev)%radi%radCoef
106 
107  CALL rflo_getdimensphys( region,ilev,ipcbeg,ipcend, &
108  jpcbeg,jpcend,kpcbeg,kpcend )
109  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
110  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
111 #endif
112 #ifdef RFLU
113  dv => region%mixt%dv
114  rcv => region%radi%cv
115  rdiss => region%radi%diss
116  flim => region%radi%fluxLim
117  coef => region%radi%radCoef
118 #endif
119  ibegv = cv_radi_ener
120  iendv = cv_radi_ener
121  ibegg = gr_radi_ex
122  iendg = gr_radi_ez
123 
124 ! get needed quantities
125 
126  beta = region%mixtInput%betrk(region%irkStep)
127 
128 ! get gradients of radiation Energy Er
129 
130 #ifdef RFLO
131  CALL rflo_calcgradvector( region,ibegv,iendv,ibegg,iendg, &
132  region%levels(ilev)%radi%cv, &
133  region%levels(ilev)%radi%gradi, &
134  region%levels(ilev)%radi%gradj, &
135  region%levels(ilev)%radi%gradk )
136 #endif
137 #ifdef RFLU
138  CALL rflu_computegradfacesbak( region,ibegv,iendv,ibegg,iendg, &
139  region%radi%cv,region%radi%gradi )
140  CALL rflu_computegradfacespatchesbak( region,ibegv,iendv,ibegg,iendg, &
141  region%radi%cv,region%radi%bGradi )
142 #endif
143 
144 ! interior fluxes -------------------------------------------------------------
145 
146  CALL computeflux( icoord )
147 #ifdef RFLO
148  CALL computeflux( jcoord )
149  CALL computeflux( kcoord )
150 #endif
151 
152 ! fluxes through boundaries ---------------------------------------------------
153 #ifdef RFLO
154  DO ipatch=1,region%nPatches
155  CALL radi_flimdifffluxpatch( region,region%levels(ilev)%patches(ipatch) )
156  ENDDO
157 #endif
158 #ifdef RFLU
159  DO ipatch = 1,region%grid%nPatches
160  CALL radi_flimdifffluxpatch( region,region%patches(ipatch) )
161  END DO ! ipatch
162 #endif
163 
164 ! finalize --------------------------------------------------------------------
165 
166  CALL deregisterfunction( region%global )
167 
168 ! =============================================================================
169 ! Flux computation subroutines
170 ! =============================================================================
171 
172 CONTAINS
173 
174  SUBROUTINE computeflux( ijk )
175 
176 ! ... parameters
177  INTEGER :: ijk
178 
179 ! ... local variables
180  INTEGER :: ibeg,iend,jbeg,jend,kbeg,kend, iadd,jadd,kadd
181  REAL(RFREAL) :: ac0, ac1
182 
183 ! - Set limits and pointers ---------------------------------------------------
184 
185 #ifdef RFLO
186  IF (ijk==icoord) THEN
187  ibeg = ipcbeg+1
188  iend = ipcend
189  jbeg = jpcbeg
190  jend = jpcend
191  kbeg = kpcbeg
192  kend = kpcend
193  iadd = -1
194  jadd = 0
195  kadd = 0
196  qr => region%levels(ilev)%radi%qri
197  grad => region%levels(ilev)%radi%gradi
198  sf => region%levels(ilev)%grid%si
199  avgco => region%levels(ilev)%grid%c2fCoI
200  ELSEIF (ijk==jcoord) THEN
201  ibeg = ipcbeg
202  iend = ipcend
203  jbeg = jpcbeg+1
204  jend = jpcend
205  kbeg = kpcbeg
206  kend = kpcend
207  iadd = 0
208  jadd = -1
209  kadd = 0
210  qr => region%levels(ilev)%radi%qrj
211  grad => region%levels(ilev)%radi%gradj
212  sf => region%levels(ilev)%grid%sj
213  avgco => region%levels(ilev)%grid%c2fCoJ
214  ELSEIF (ijk==kcoord) THEN
215  ibeg = ipcbeg
216  iend = ipcend
217  jbeg = jpcbeg
218  jend = jpcend
219  kbeg = kpcbeg+1
220  kend = kpcend
221  iadd = 0
222  jadd = 0
223  kadd = -1
224  qr => region%levels(ilev)%radi%qrk
225  grad => region%levels(ilev)%radi%gradk
226  sf => region%levels(ilev)%grid%sk
227  avgco => region%levels(ilev)%grid%c2fCoK
228  ENDIF
229 #endif
230 #ifdef RFLU
231  ibeg = 1
232  iend = region%grid%nFaces
233  f2c => region%grid%f2c
234  qr => region%radi%qri
235  grad => region%radi%gradi
236  fn => region%grid%fn
237 #endif
238 
239 ! -- flux in ijk-direction (except through boundary) --------------------------
240 
241 #ifdef RFLO
242  DO k=kbeg,kend
243  DO j=jbeg,jend
244  DO i=ibeg,iend
245 
246  ijkc0 = indijk(i ,j ,k ,icoff,ijcoff)
247  ijkc1 = indijk(i+iadd,j+jadd,k+kadd,icoff,ijcoff)
248  ijkn = indijk(i ,j ,k ,inoff,ijnoff)
249  ac0 = avgco(2,ijkn)
250  ac1 = avgco(1,ijkn)
251  sface(1)= sf(xcoord,ijkn)
252  sface(2)= sf(ycoord,ijkn)
253  sface(3)= sf(zcoord,ijkn)
254 #endif
255 #ifdef RFLU
256  ac0 = 0.5_rfreal
257  ac1 = 0.5_rfreal
258  DO ijkn = ibeg,iend
259  ijkc0 = f2c(1,ijkn)
260  ijkc1 = f2c(2,ijkn)
261  sface(1)= fn(xcoord,ijkn)*fn(xyzmag,ijkn)
262  sface(2)= fn(ycoord,ijkn)*fn(xyzmag,ijkn)
263  sface(3)= fn(zcoord,ijkn)*fn(xyzmag,ijkn)
264 #endif
265  sounda = ac0*dv(dv_mixt_soun ,ijkc0)+ac1*dv(dv_mixt_soun ,ijkc1)
266  flima = ac0*flim(ijkc0)+ac1*flim(ijkc1)
267  coefa = ac0*coef(ijkc0,radi_coeff_extinct)+ &
268  ac1*coef(ijkc1,radi_coeff_extinct)
269  diffcoef = sounda*flima/coefa
270 
271 #ifdef RFLO
272  radenx = grad(gr_radi_ex,ijkn)
273  radeny = grad(gr_radi_ey,ijkn)
274  radenz = grad(gr_radi_ez,ijkn)
275 #endif
276 #ifdef RFLU
277  radenx = grad(xcoord,gr_radi_ex,ijkn)
278  radeny = grad(ycoord,gr_radi_ex,ijkn)
279  radenz = grad(zcoord,gr_radi_ex,ijkn)
280 #endif
281 
282  fd = diffcoef* &
283  (radenx*sface(1)+radeny*sface(2)+radenz*sface(3))
284 
285  rdiss(cv_radi_ener,ijkc0) = rdiss(cv_radi_ener,ijkc0) + fd*beta
286  rdiss(cv_radi_ener,ijkc1) = rdiss(cv_radi_ener,ijkc1) - fd*beta
287 
288 ! ------- store radiant flux normal to cell face in positive direction in qr
289  modsf = sqrt( sface(1)*sface(1) + &
290  sface(2)*sface(2) + &
291  sface(3)*sface(3))
292  qr(ijkn) = fd/modsf
293 #ifdef RFLO
294  ENDDO ! i
295  ENDDO ! j
296  ENDDO ! k
297 #else
298  ENDDO ! ijkN
299 #endif
300 
301  END SUBROUTINE computeflux
302 
303 END SUBROUTINE radi_flimdiffflux
304 
305 !******************************************************************************
306 !
307 ! RCS Revision history:
308 !
309 ! $Log: RADI_FlimDiffFlux.F90,v $
310 ! Revision 1.3 2008/12/06 08:44:37 mtcampbe
311 ! Updated license.
312 !
313 ! Revision 1.2 2008/11/19 22:17:49 mtcampbe
314 ! Added Illinois Open Source License/Copyright
315 !
316 ! Revision 1.1 2004/09/30 17:49:10 wasistho
317 ! prepared for full FLD radiation model
318 !
319 !
320 !
321 !******************************************************************************
322 
323 
324 
325 
326 
327 
328 
**********************************************************************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 ibeg
j indices k indices k
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 kpcbeg
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 ic
double sqrt(double d)
Definition: double.h:73
**********************************************************************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 jpcbeg
**********************************************************************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 ipcend
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 knode iend
**********************************************************************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 ipcbeg
subroutine radi_flimdifffluxpatch(region, patch)
blockLoc i
Definition: read.cpp:79
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
subroutine radi_flimdiffflux(region)
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 jpcend
**********************************************************************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 knode jend
**********************************************************************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 knode jbeg
subroutine computeflux(ijk)
**********************************************************************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 knode kbeg
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflo_getdimensphys(region, iLev, ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend)
subroutine rflo_calcgradvector(region, iBegV, iEndV, iBegG, iEndG, var, gradi, gradj, gradk)