Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PEUL_CentralDissipation.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 artificial numerical dissipation for smoke.
26 !
27 ! Description: the dissipation is 4th-order only, with no 2nd-order part
28 !
29 ! Input: region = data of current region.
30 !
31 ! Output: region%levels%peul%diss = dissipative fluxes.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: PEUL_CentralDissipation.F90,v 1.3 2008/12/06 08:44:39 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2002 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE peul_centraldissipation( region ) ! PUBLIC
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
47  USE modglobal, ONLY : t_global
49  USE moderror
50  USE modparameters
52  IMPLICIT NONE
53 
54 #include "Indexing.h"
55 
56 ! ... parameters
57  TYPE(t_region), INTENT(INOUT) :: region
58 
59 ! ... loop variables
60  INTEGER :: i, j, k, ii, jj, kk, icv
61 
62 ! ... local variables
63  INTEGER, PARAMETER :: npeul_max = 10
64 
65  CHARACTER(CHRLEN) :: rcsidentstring
66 
67  INTEGER :: ipcbeg,ipcend,jpcbeg,jpcend,kpcbeg,kpcend
68  INTEGER :: ncv,ilev,icoff,ijcoff,ijkc0,ijkcm1,ijkcp1,ijkcp2
69 
70  REAL(RFREAL) :: beta,eval,eps2,eps4,pmax,fd,vis4(npeul_max)
71  REAL(RFREAL), POINTER :: scv(:,:),sdiss(:,:),srad(:,:)
72 
73  TYPE(t_global), POINTER :: global
74 
75 !******************************************************************************
76 
77  rcsidentstring = '$RCSfile: PEUL_CentralDissipation.F90,v $ $Revision: 1.3 $'
78 
79  global => region%global
80 
81  CALL registerfunction( global,'PEUL_CentralDissipation',&
82  'PEUL_CentralDissipation.F90' )
83 
84 ! begin -----------------------------------------------------------------------
85 
86 ! get dimensions and pointers -------------------------------------------------
87 
88  ilev = region%currLevel
89 
90  CALL rflo_getdimensphys( region,ilev,ipcbeg,ipcend, &
91  jpcbeg,jpcend,kpcbeg,kpcend )
92  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
93 
94  scv => region%levels(ilev)%peul%cv
95  ncv = region%levels(ilev)%peul%nCv
96 
97  sdiss => region%levels(ilev)%peul%diss
98  srad => region%levels(ilev)%peul%srad
99 
100  beta = region%mixtInput%betrk(region%irkStep)
101 
102 ! the implementation assumes that each sCv is a smoke density, so check that
103 ! nCv is indeed the number of smoke particle types
104 
105  IF (ncv /= region%peulInput%nPtypes) &
106  CALL errorstop( global,err_peul_npmismatch,__line__ )
107 
108  IF (ncv > npeul_max) &
109  CALL errorstop( global,err_exceeds_decl_mem,__line__ )
110 
111  vis4(:) = 0._rfreal
112  vis4(1:ncv) = beta*region%peulInput%ptypes(1:ncv)%vis4
113 
114 ! dissipation in i-direction ------------------------------------------------
115 
116  DO k=kpcbeg,kpcend
117  DO j=jpcbeg,jpcend
118 
119 ! --- dissipative fluxes at I+1/2
120 
121  ii = 0
122  DO i=ipcbeg-1,ipcend
123  ii = ii + 1
124  ijkc0 = indijk(i ,j,k,icoff,ijcoff)
125  ijkcm1 = indijk(i-1,j,k,icoff,ijcoff)
126  ijkcp1 = indijk(i+1,j,k,icoff,ijcoff)
127  ijkcp2 = indijk(i+2,j,k,icoff,ijcoff)
128  eval = 0.5_rfreal*(srad(icoord,ijkc0)+srad(icoord,ijkcp1) + &
129  max(srad(jcoord,ijkc0)+srad(jcoord,ijkcp1), &
130  srad(kcoord,ijkc0)+srad(kcoord,ijkcp1)))
131 
132  DO icv = 1,ncv
133  eps4 = eval*vis4(icv)
134  fd = eps4*( (scv(icv,ijkcm1) - scv(icv,ijkcp2)) + &
135  3._rfreal*(scv(icv,ijkcp1) - scv(icv,ijkc0 )) )
136 
137  sdiss(icv,ijkc0 ) = sdiss(icv,ijkc0 ) + fd
138  sdiss(icv,ijkcp1) = sdiss(icv,ijkcp1) - fd
139  ENDDO ! iCv
140 
141  ENDDO ! i
142  ENDDO ! j
143  ENDDO ! k
144 
145 ! dissipation in j-direction ------------------------------------------------
146 
147  DO k=kpcbeg,kpcend
148  DO i=ipcbeg,ipcend
149 
150 ! --- dissipative fluxes at J+1/2
151 
152  jj = 0
153  DO j=jpcbeg-1,jpcend
154  jj = jj + 1
155  ijkc0 = indijk(i,j ,k,icoff,ijcoff)
156  ijkcm1 = indijk(i,j-1,k,icoff,ijcoff)
157  ijkcp1 = indijk(i,j+1,k,icoff,ijcoff)
158  ijkcp2 = indijk(i,j+2,k,icoff,ijcoff)
159  eval = 0.5_rfreal*(srad(jcoord,ijkc0)+srad(jcoord,ijkcp1) + &
160  max(srad(icoord,ijkc0)+srad(icoord,ijkcp1), &
161  srad(kcoord,ijkc0)+srad(kcoord,ijkcp1)))
162 
163  DO icv = 1,ncv
164  eps4 = eval*vis4(icv)
165  fd = eps4*( (scv(icv,ijkcm1) - scv(icv,ijkcp2)) + &
166  3._rfreal*(scv(icv,ijkcp1) - scv(icv,ijkc0 )) )
167 
168  sdiss(icv,ijkc0 ) = sdiss(icv,ijkc0 ) + fd
169  sdiss(icv,ijkcp1) = sdiss(icv,ijkcp1) - fd
170  ENDDO ! iCv
171 
172  ENDDO ! j
173  ENDDO ! i
174  ENDDO ! k
175 
176 ! dissipation in k-direction --------------------------------------------------
177 
178  DO j=jpcbeg,jpcend
179  DO i=ipcbeg,ipcend
180 
181 ! --- dissipative fluxes at K+1/2
182 
183  kk = 0
184  DO k=kpcbeg-1,kpcend
185  kk = kk + 1
186  ijkc0 = indijk(i,j,k ,icoff,ijcoff)
187  ijkcm1 = indijk(i,j,k-1,icoff,ijcoff)
188  ijkcp1 = indijk(i,j,k+1,icoff,ijcoff)
189  ijkcp2 = indijk(i,j,k+2,icoff,ijcoff)
190  eval = 0.5_rfreal*(srad(kcoord,ijkc0)+srad(kcoord,ijkcp1) + &
191  max(srad(icoord,ijkc0)+srad(icoord,ijkcp1), &
192  srad(jcoord,ijkc0)+srad(jcoord,ijkcp1)))
193 
194  DO icv = 1,ncv
195  eps4 = eval*vis4(icv)
196  fd = eps4*( (scv(icv,ijkcm1) - scv(icv,ijkcp2)) + &
197  3._rfreal*(scv(icv,ijkcp1) - scv(icv,ijkc0 )) )
198 
199  sdiss(icv,ijkc0 ) = sdiss(icv,ijkc0 ) + fd
200  sdiss(icv,ijkcp1) = sdiss(icv,ijkcp1) - fd
201  ENDDO ! iCv
202 
203  ENDDO ! k
204  ENDDO ! i
205  ENDDO ! j
206 
207 ! finalize --------------------------------------------------------------------
208 
209  CALL deregisterfunction( global )
210 
211 END SUBROUTINE peul_centraldissipation
212 
213 !******************************************************************************
214 !
215 ! RCS Revision history:
216 !
217 ! $Log: PEUL_CentralDissipation.F90,v $
218 ! Revision 1.3 2008/12/06 08:44:39 mtcampbe
219 ! Updated license.
220 !
221 ! Revision 1.2 2008/11/19 22:17:51 mtcampbe
222 ! Added Illinois Open Source License/Copyright
223 !
224 ! Revision 1.1 2004/12/01 21:09:25 haselbac
225 ! Initial revision after changing case
226 !
227 ! Revision 1.8 2004/07/28 15:42:13 jferry
228 ! deleted defunct constructs: useDetangle, useSmokeDrag, useSmokeHeatTransfer
229 !
230 ! Revision 1.7 2004/03/05 22:09:04 jferry
231 ! created global variables for peul, plag, and inrt use
232 !
233 ! Revision 1.6 2004/03/02 21:48:09 jferry
234 ! First phase of replacing Detangle interaction
235 !
236 ! Revision 1.5 2003/09/25 15:42:57 jferry
237 ! Added mixture source terms due to active smoke (for Detangle interaction)
238 !
239 ! Revision 1.4 2003/05/15 02:57:05 jblazek
240 ! Inlined index function.
241 !
242 ! Revision 1.3 2003/05/01 22:57:24 jferry
243 ! substituted macro for IndIJK
244 !
245 ! Revision 1.2 2003/04/09 15:12:04 jferry
246 ! miscellaneous stylistic changes
247 !
248 ! Revision 1.1 2003/02/11 22:52:50 jferry
249 ! Initial import of Rocsmoke
250 !
251 !******************************************************************************
252 
253 
254 
255 
256 
257 
258 
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
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
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 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
**********************************************************************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
blockLoc i
Definition: read.cpp:79
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 jpcend
subroutine peul_centraldissipation(region)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflo_getdimensphys(region, iLev, ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend)