Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RADI_FlimDiffFluxPatch.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 ! through a patch
27 !
28 ! Description: this routine works in the same way as RADI_FlimDiffFlux
29 ! but applied on region patches
30 !
31 ! Input: region = data of current region.
32 ! patch = current patch.
33 !
34 ! Output: region%levels%radi%diss = diffusion flux added to FLD dissipation.
35 !
36 ! Notes: none.
37 !
38 !******************************************************************************
39 !
40 ! $Id: RADI_FlimDiffFluxPatch.F90,v 1.4 2008/12/06 08:44:37 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2003 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE radi_flimdifffluxpatch( region,patch )
47 
48  USE moddatatypes
49  USE modbndpatch, ONLY : t_patch
50  USE moddatastruct, ONLY : t_region
51 #ifdef RFLO
54 
55 #include "Indexing.h"
56 #endif
57  USE moderror
58  USE modparameters
60  IMPLICIT NONE
61 
62 ! ... parameters
63  TYPE(t_region) :: region
64  TYPE(t_patch) :: patch
65 
66 ! ... loop variables
67  INTEGER :: i, j, k, ic
68 
69 ! ... local variables
70  INTEGER :: bctype, ijkcb0, ijkcd, ijknb
71  INTEGER :: ibeg, iend, jbeg, jend, kbeg, kend
72 
73  REAL(RFREAL) :: beta, sounda, flima, coefa, diffcoef, modsf
74  REAL(RFREAL) :: radenx, radeny, radenz, fd, sf(3), ac0, ac1
75  REAL(RFREAL), POINTER :: dv(:,:), rcv(:,:), rdiss(:,:), flim(:), coef(:,:)
76  REAL(RFREAL), POINTER :: qr(:)
77 
78 #ifdef RFLO
79  INTEGER :: inode, jnode, knode, idir, jdir, kdir
80  INTEGER :: ilev, lbound, icoff, ijcoff, inoff, ijnoff, acid0, acid1
81  REAL(RFREAL) :: sgn
82  REAL(RFREAL), POINTER :: avgco(:,:), sface(:,:), grad(:,:)
83 #endif
84 #ifdef RFLU
85  INTEGER :: ifgbeg, ijknbg
86  REAL(RFREAL), POINTER :: fn(:,:), grad(:,:,:)
87 #endif
88 
89 !******************************************************************************
90 
91  CALL registerfunction( region%global,'RADI_FlimDiffFluxPatch',&
92  'RADI_FlimDiffFluxPatch.F90' )
93 
94 ! get dimensions and pointers -------------------------------------------------
95 
96  bctype = patch%bcType
97 
98 #ifdef RFLO
99  ilev = region%currLevel
100  lbound = patch%lbound
101 
102  dv => region%levels(ilev)%mixt%dv
103  rcv => region%levels(ilev)%radi%cv
104  rdiss => region%levels(ilev)%radi%diss
105  flim => region%levels(ilev)%radi%fluxLim
106  coef => region%levels(ilev)%radi%radCoef
107 #endif
108 #ifdef RFLU
109  dv => region%mixt%dv
110  rcv => region%radi%cv
111  rdiss => region%radi%diss
112  flim => region%radi%fluxLim
113  coef => region%radi%radCoef
114 #endif
115 
116 ! get coefficients -----------------------------------------------------------
117 
118  beta = region%mixtInput%betrk(region%irkStep)
119 
120 #ifdef RFLO
121 
122 ! take the right face vector and make it point outwards ----------------------
123 
124  CALL rflo_getpatchindices( region,patch,ilev,ibeg,iend,jbeg,jend,kbeg,kend )
126  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
127  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
128 
129  sgn = +1._rfreal
130  inode = 0
131  jnode = 0
132  knode = 0
133  acid0 = 2
134  acid1 = 1
135  IF (lbound==2 .OR. lbound==4 .OR. lbound==6) THEN
136  sgn = -1._rfreal
137  inode = -idir
138  jnode = -jdir
139  knode = -kdir
140  acid0 = 1
141  acid1 = 2
142  ENDIF
143 
144 ! get the appropriate face vector --------------------------------------------
145 
146  IF (lbound==1 .OR. lbound==2) THEN
147  avgco => region%levels(ilev)%grid%c2fCoI
148  sface => region%levels(ilev)%grid%si
149  grad => region%levels(ilev)%radi%gradi
150  qr => region%levels(ilev)%radi%qri
151  ELSE IF (lbound==3 .OR. lbound==4) THEN
152  avgco => region%levels(ilev)%grid%c2fCoJ
153  sface => region%levels(ilev)%grid%sj
154  grad => region%levels(ilev)%radi%gradj
155  qr => region%levels(ilev)%radi%qrj
156  ELSE
157  avgco => region%levels(ilev)%grid%c2fCoK
158  sface => region%levels(ilev)%grid%sk
159  grad => region%levels(ilev)%radi%gradk
160  qr => region%levels(ilev)%radi%qrk
161  ENDIF
162 
163 ! non-conforming region interface --------------------------------------------
164 
165  IF (bctype>=bc_regionint .AND. bctype<=bc_regionint+bc_range) THEN
166 
167  ELSE IF (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) THEN
168 
169 ! everything else
170 
171  ELSE
172 
173 ! flux in the direction normal to the patch ----------------------------------
174 
175  DO k=kbeg,kend
176  DO j=jbeg,jend
177  DO i=ibeg,iend
178 
179  ijkcb0 = indijk(i ,j ,k ,icoff,ijcoff) ! bnd cells
180  ijkcd = indijk(i-idir ,j-jdir ,k-kdir ,icoff,ijcoff) ! dummy
181  ijknb = indijk(i+inode,j+jnode,k+knode,inoff,ijnoff) ! bnd nodes
182  ac0 = avgco(acid0,ijknb)
183  ac1 = avgco(acid1,ijknb)
184  sf(1) = sgn*sface(xcoord,ijknb)
185  sf(2) = sgn*sface(ycoord,ijknb)
186  sf(3) = sgn*sface(zcoord,ijknb)
187 #endif
188 #ifdef RFLU
189  ibeg = 1
190  iend = patch%nBFaces
191 ! TEMPORARY : removing usage of bf2bg from everywhere
192 ! ifgBeg = patch%bf2bg(BF2BG_BEG)
193  ac0 = 0.5_rfreal
194  ac1 = 0.5_rfreal
195 
196  grad => region%radi%bGradi
197  fn => patch%fn
198 
199  DO ic=ibeg,iend
200  ijkcb0 = patch%bf2c(ic)
201  ijkcd = ijkcb0
202  ijknb = ic
203  ijknbg = ic + ifgbeg-1
204 
205  sf(1) = fn(xcoord,ijknb)*fn(xyzmag,ijknb)
206  sf(2) = fn(ycoord,ijknb)*fn(xyzmag,ijknb)
207  sf(3) = fn(zcoord,ijknb)*fn(xyzmag,ijknb)
208 #endif
209  sounda = ac0*dv(dv_mixt_soun,ijkcb0)+ac1*dv(dv_mixt_soun,ijkcd)
210  flima = ac0*flim(ijkcb0)+ac1*flim(ijkcd)
211  coefa = ac0*coef(ijkcb0,radi_coeff_extinct)+ &
212  ac1*coef(ijkcd,radi_coeff_extinct)
213  diffcoef = sounda*flima/coefa
214 
215 #ifdef RFLO
216  radenx = grad(gr_radi_ex,ijknb)
217  radeny = grad(gr_radi_ey,ijknb)
218  radenz = grad(gr_radi_ez,ijknb)
219 #endif
220 #ifdef RFLU
221  radenx = grad(xcoord,gr_radi_ex,ijknbg)
222  radeny = grad(ycoord,gr_radi_ex,ijknbg)
223  radenz = grad(zcoord,gr_radi_ex,ijknbg)
224 #endif
225 
226  fd = diffcoef* &
227  (radenx*sf(1)+radeny*sf(2)+radenz*sf(3))
228 
229  rdiss(cv_radi_ener,ijkcb0) = rdiss(cv_radi_ener,ijkcb0)+fd*beta
230 
231 ! ------- store rad. flux normal to surf. in positive direction (hence sgn* )
232  modsf = sqrt( sf(1)*sf(1) + sf(2)*sf(2) + sf(3)*sf(3) )
233  qr(ijknb) = sgn*fd/modsf
234 #ifdef RFLO
235  ENDDO ! i
236  ENDDO ! j
237  ENDDO ! k
238  ENDIF
239 #endif
240 
241 #ifdef RFLU
242  ENDDO ! iC
243 #endif
244 
245 ! finalize --------------------------------------------------------------------
246 
247  CALL deregisterfunction( region%global )
248 
249 END SUBROUTINE radi_flimdifffluxpatch
250 
251 !******************************************************************************
252 !
253 ! RCS Revision history:
254 !
255 ! $Log: RADI_FlimDiffFluxPatch.F90,v $
256 ! Revision 1.4 2008/12/06 08:44:37 mtcampbe
257 ! Updated license.
258 !
259 ! Revision 1.3 2008/11/19 22:17:50 mtcampbe
260 ! Added Illinois Open Source License/Copyright
261 !
262 ! Revision 1.2 2006/08/19 15:40:15 mparmar
263 ! Removed bf2bg
264 !
265 ! Revision 1.1 2004/09/30 17:49:10 wasistho
266 ! prepared for full FLD radiation model
267 !
268 !
269 !
270 !******************************************************************************
271 
272 
273 
274 
275 
276 
277 
**********************************************************************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
subroutine rflo_getpatchdirection(patch, idir, jdir, kdir)
**********************************************************************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 inode
j indices k indices k
Definition: Indexing.h:6
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
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
double sqrt(double d)
Definition: double.h:73
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 jdir
Definition: patch.h:74
**********************************************************************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
subroutine radi_flimdifffluxpatch(region, patch)
blockLoc i
Definition: read.cpp:79
**********************************************************************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 idir
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
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 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 kdir
**********************************************************************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
**********************************************************************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
**********************************************************************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 jnode