Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_CentralFlux.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 central convective fluxes by average of variables.
26 !
27 ! Description: none.
28 !
29 ! Input: region = data of current region.
30 !
31 ! Output: region%levels%mixt%rhs = convective fluxes added to the residual.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: RFLO_CentralFlux.F90,v 1.3 2008/12/06 08:44:26 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE rflo_centralflux( region )
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
49  USE moderror
50  USE modparameters
51  IMPLICIT NONE
52 
53 #include "Indexing.h"
54 
55 ! ... parameters
56  TYPE(t_region) :: region
57 
58 ! ... loop variables
59  INTEGER :: i, j, k, ipatch
60 
61 ! ... local variables
62  INTEGER :: ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend
63  INTEGER :: ilev, icoff, ijcoff, inoff, ijnoff, ijkc0, ijkc1, ijkn, indsvel
64 
65  REAL(RFREAL) :: rhoa, rhoua, rhova, rhowa, rhoea, pa, vcont, fc(5)
66  REAL(RFREAL), POINTER :: cv(:,:), dv(:,:), rhs(:,:), si(:,:), sj(:,:), sk(:,:)
67  REAL(RFREAL), POINTER :: aci(:,:), acj(:,:), ack(:,:)
68  REAL(RFREAL), POINTER :: sivel(:), sjvel(:), skvel(:)
69 
70 !******************************************************************************
71 
72  CALL registerfunction( region%global,'RFLO_CentralFlux',&
73  'RFLO_CentralFlux.F90' )
74 
75 ! get dimensions and pointers -------------------------------------------------
76 
77  ilev = region%currLevel
78 
79  CALL rflo_getdimensphys( region,ilev,ipcbeg,ipcend, &
80  jpcbeg,jpcend,kpcbeg,kpcend )
81  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
82  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
83 
84  cv => region%levels(ilev)%mixt%cv
85  dv => region%levels(ilev)%mixt%dv
86  rhs => region%levels(ilev)%mixt%rhs
87  aci => region%levels(ilev)%grid%c2fCoI
88  acj => region%levels(ilev)%grid%c2fCoJ
89  ack => region%levels(ilev)%grid%c2fCoK
90  si => region%levels(ilev)%grid%si
91  sj => region%levels(ilev)%grid%sj
92  sk => region%levels(ilev)%grid%sk
93  sivel => region%levels(ilev)%grid%siVel
94  sjvel => region%levels(ilev)%grid%sjVel
95  skvel => region%levels(ilev)%grid%skVel
96  indsvel = region%levels(ilev)%grid%indSvel
97 
98 ! flux in i-direction (except through boundary) -------------------------------
99 
100  DO k=kpcbeg,kpcend
101  DO j=jpcbeg,jpcend
102  DO i=ipcbeg+1,ipcend
103  ijkc0 = indijk(i ,j,k,icoff,ijcoff)
104  ijkc1 = indijk(i-1,j,k,icoff,ijcoff)
105  ijkn = indijk(i ,j,k,inoff,ijnoff)
106 
107  rhoa = aci(2,ijkn)*cv(cv_mixt_dens,ijkc0)+ &
108  aci(1,ijkn)*cv(cv_mixt_dens,ijkc1)
109  rhoua = aci(2,ijkn)*cv(cv_mixt_xmom,ijkc0)+ &
110  aci(1,ijkn)*cv(cv_mixt_xmom,ijkc1)
111  rhova = aci(2,ijkn)*cv(cv_mixt_ymom,ijkc0)+ &
112  aci(1,ijkn)*cv(cv_mixt_ymom,ijkc1)
113  rhowa = aci(2,ijkn)*cv(cv_mixt_zmom,ijkc0)+ &
114  aci(1,ijkn)*cv(cv_mixt_zmom,ijkc1)
115  rhoea = aci(2,ijkn)*cv(cv_mixt_ener,ijkc0)+ &
116  aci(1,ijkn)*cv(cv_mixt_ener,ijkc1)
117  pa = aci(2,ijkn)*dv(dv_mixt_pres,ijkc0)+ &
118  aci(1,ijkn)*dv(dv_mixt_pres,ijkc1)
119  vcont = (rhoua*si(xcoord,ijkn)+rhova*si(ycoord,ijkn)+&
120  rhowa*si(zcoord,ijkn))/rhoa - sivel(ijkn*indsvel)
121 
122  fc(1) = vcont*rhoa
123  fc(2) = vcont*rhoua + pa*si(xcoord,ijkn)
124  fc(3) = vcont*rhova + pa*si(ycoord,ijkn)
125  fc(4) = vcont*rhowa + pa*si(zcoord,ijkn)
126  fc(5) = vcont*(rhoea+pa) + sivel(ijkn*indsvel)*pa
127 
128  rhs(cv_mixt_dens,ijkc0) = rhs(cv_mixt_dens,ijkc0) + fc(1)
129  rhs(cv_mixt_xmom,ijkc0) = rhs(cv_mixt_xmom,ijkc0) + fc(2)
130  rhs(cv_mixt_ymom,ijkc0) = rhs(cv_mixt_ymom,ijkc0) + fc(3)
131  rhs(cv_mixt_zmom,ijkc0) = rhs(cv_mixt_zmom,ijkc0) + fc(4)
132  rhs(cv_mixt_ener,ijkc0) = rhs(cv_mixt_ener,ijkc0) + fc(5)
133 
134  rhs(cv_mixt_dens,ijkc1) = rhs(cv_mixt_dens,ijkc1) - fc(1)
135  rhs(cv_mixt_xmom,ijkc1) = rhs(cv_mixt_xmom,ijkc1) - fc(2)
136  rhs(cv_mixt_ymom,ijkc1) = rhs(cv_mixt_ymom,ijkc1) - fc(3)
137  rhs(cv_mixt_zmom,ijkc1) = rhs(cv_mixt_zmom,ijkc1) - fc(4)
138  rhs(cv_mixt_ener,ijkc1) = rhs(cv_mixt_ener,ijkc1) - fc(5)
139  ENDDO ! i
140  ENDDO ! j
141  ENDDO ! k
142 
143 ! flux in j-direction (except through boundary) -------------------------------
144 
145  DO k=kpcbeg,kpcend
146  DO j=jpcbeg+1,jpcend
147  DO i=ipcbeg,ipcend
148  ijkc0 = indijk(i,j ,k,icoff,ijcoff)
149  ijkc1 = indijk(i,j-1,k,icoff,ijcoff)
150  ijkn = indijk(i,j ,k,inoff,ijnoff)
151 
152  rhoa = acj(2,ijkn)*cv(cv_mixt_dens,ijkc0)+ &
153  acj(1,ijkn)*cv(cv_mixt_dens,ijkc1)
154  rhoua = acj(2,ijkn)*cv(cv_mixt_xmom,ijkc0)+ &
155  acj(1,ijkn)*cv(cv_mixt_xmom,ijkc1)
156  rhova = acj(2,ijkn)*cv(cv_mixt_ymom,ijkc0)+ &
157  acj(1,ijkn)*cv(cv_mixt_ymom,ijkc1)
158  rhowa = acj(2,ijkn)*cv(cv_mixt_zmom,ijkc0)+ &
159  acj(1,ijkn)*cv(cv_mixt_zmom,ijkc1)
160  rhoea = acj(2,ijkn)*cv(cv_mixt_ener,ijkc0)+ &
161  acj(1,ijkn)*cv(cv_mixt_ener,ijkc1)
162  pa = acj(2,ijkn)*dv(dv_mixt_pres,ijkc0)+ &
163  acj(1,ijkn)*dv(dv_mixt_pres,ijkc1)
164  vcont = (rhoua*sj(xcoord,ijkn)+rhova*sj(ycoord,ijkn)+&
165  rhowa*sj(zcoord,ijkn))/rhoa - sjvel(ijkn*indsvel)
166 
167  fc(1) = vcont*rhoa
168  fc(2) = vcont*rhoua + pa*sj(xcoord,ijkn)
169  fc(3) = vcont*rhova + pa*sj(ycoord,ijkn)
170  fc(4) = vcont*rhowa + pa*sj(zcoord,ijkn)
171  fc(5) = vcont*(rhoea+pa) + sjvel(ijkn*indsvel)*pa
172 
173  rhs(cv_mixt_dens,ijkc0) = rhs(cv_mixt_dens,ijkc0) + fc(1)
174  rhs(cv_mixt_xmom,ijkc0) = rhs(cv_mixt_xmom,ijkc0) + fc(2)
175  rhs(cv_mixt_ymom,ijkc0) = rhs(cv_mixt_ymom,ijkc0) + fc(3)
176  rhs(cv_mixt_zmom,ijkc0) = rhs(cv_mixt_zmom,ijkc0) + fc(4)
177  rhs(cv_mixt_ener,ijkc0) = rhs(cv_mixt_ener,ijkc0) + fc(5)
178 
179  rhs(cv_mixt_dens,ijkc1) = rhs(cv_mixt_dens,ijkc1) - fc(1)
180  rhs(cv_mixt_xmom,ijkc1) = rhs(cv_mixt_xmom,ijkc1) - fc(2)
181  rhs(cv_mixt_ymom,ijkc1) = rhs(cv_mixt_ymom,ijkc1) - fc(3)
182  rhs(cv_mixt_zmom,ijkc1) = rhs(cv_mixt_zmom,ijkc1) - fc(4)
183  rhs(cv_mixt_ener,ijkc1) = rhs(cv_mixt_ener,ijkc1) - fc(5)
184  ENDDO ! i
185  ENDDO ! j
186  ENDDO ! k
187 
188 ! flux in k-direction (except through boundary) -------------------------------
189 
190  DO k=kpcbeg+1,kpcend
191  DO j=jpcbeg,jpcend
192  DO i=ipcbeg,ipcend
193  ijkc0 = indijk(i,j,k ,icoff,ijcoff)
194  ijkc1 = indijk(i,j,k-1,icoff,ijcoff)
195  ijkn = indijk(i,j,k ,inoff,ijnoff)
196 
197  rhoa = ack(2,ijkn)*cv(cv_mixt_dens,ijkc0)+ &
198  ack(1,ijkn)*cv(cv_mixt_dens,ijkc1)
199  rhoua = ack(2,ijkn)*cv(cv_mixt_xmom,ijkc0)+ &
200  ack(1,ijkn)*cv(cv_mixt_xmom,ijkc1)
201  rhova = ack(2,ijkn)*cv(cv_mixt_ymom,ijkc0)+ &
202  ack(1,ijkn)*cv(cv_mixt_ymom,ijkc1)
203  rhowa = ack(2,ijkn)*cv(cv_mixt_zmom,ijkc0)+ &
204  ack(1,ijkn)*cv(cv_mixt_zmom,ijkc1)
205  rhoea = ack(2,ijkn)*cv(cv_mixt_ener,ijkc0)+ &
206  ack(1,ijkn)*cv(cv_mixt_ener,ijkc1)
207  pa = ack(2,ijkn)*dv(dv_mixt_pres,ijkc0)+ &
208  ack(1,ijkn)*dv(dv_mixt_pres,ijkc1)
209  vcont = (rhoua*sk(xcoord,ijkn)+rhova*sk(ycoord,ijkn)+&
210  rhowa*sk(zcoord,ijkn))/rhoa - skvel(ijkn*indsvel)
211 
212  fc(1) = vcont*rhoa
213  fc(2) = vcont*rhoua + pa*sk(xcoord,ijkn)
214  fc(3) = vcont*rhova + pa*sk(ycoord,ijkn)
215  fc(4) = vcont*rhowa + pa*sk(zcoord,ijkn)
216  fc(5) = vcont*(rhoea+pa) + skvel(ijkn*indsvel)*pa
217 
218  rhs(cv_mixt_dens,ijkc0) = rhs(cv_mixt_dens,ijkc0) + fc(1)
219  rhs(cv_mixt_xmom,ijkc0) = rhs(cv_mixt_xmom,ijkc0) + fc(2)
220  rhs(cv_mixt_ymom,ijkc0) = rhs(cv_mixt_ymom,ijkc0) + fc(3)
221  rhs(cv_mixt_zmom,ijkc0) = rhs(cv_mixt_zmom,ijkc0) + fc(4)
222  rhs(cv_mixt_ener,ijkc0) = rhs(cv_mixt_ener,ijkc0) + fc(5)
223 
224  rhs(cv_mixt_dens,ijkc1) = rhs(cv_mixt_dens,ijkc1) - fc(1)
225  rhs(cv_mixt_xmom,ijkc1) = rhs(cv_mixt_xmom,ijkc1) - fc(2)
226  rhs(cv_mixt_ymom,ijkc1) = rhs(cv_mixt_ymom,ijkc1) - fc(3)
227  rhs(cv_mixt_zmom,ijkc1) = rhs(cv_mixt_zmom,ijkc1) - fc(4)
228  rhs(cv_mixt_ener,ijkc1) = rhs(cv_mixt_ener,ijkc1) - fc(5)
229  ENDDO ! i
230  ENDDO ! j
231  ENDDO ! k
232 
233 ! fluxes through boundaries ---------------------------------------------------
234 
235  DO ipatch=1,region%nPatches
236  CALL rflo_centralfluxpatch( region,region%levels(ilev)%patches(ipatch) )
237  ENDDO
238 
239 ! finalize --------------------------------------------------------------------
240 
241  CALL deregisterfunction( region%global )
242 
243 END SUBROUTINE rflo_centralflux
244 
245 !******************************************************************************
246 !
247 ! RCS Revision history:
248 !
249 ! $Log: RFLO_CentralFlux.F90,v $
250 ! Revision 1.3 2008/12/06 08:44:26 mtcampbe
251 ! Updated license.
252 !
253 ! Revision 1.2 2008/11/19 22:17:37 mtcampbe
254 ! Added Illinois Open Source License/Copyright
255 !
256 ! Revision 1.1 2004/11/29 20:51:38 wasistho
257 ! lower to upper case
258 !
259 ! Revision 1.14 2004/08/02 21:56:23 wasistho
260 ! replaced cell2face midpoint by linear averaging
261 !
262 ! Revision 1.13 2003/11/20 16:40:39 mdbrandy
263 ! Backing out RocfluidMP changes from 11-17-03
264 !
265 ! Revision 1.9 2003/10/01 23:52:10 jblazek
266 ! Corrected bug in moving noslip wall BC and grid speeds.
267 !
268 ! Revision 1.8 2003/05/15 02:57:03 jblazek
269 ! Inlined index function.
270 !
271 ! Revision 1.7 2002/09/05 17:40:21 jblazek
272 ! Variable global moved into regions().
273 !
274 ! Revision 1.6 2002/08/30 18:25:55 jblazek
275 ! Forgot to multiply grid speeds by face area ...
276 !
277 ! Revision 1.5 2002/08/29 23:25:54 jblazek
278 ! Added support for moving grids.
279 !
280 ! Revision 1.4 2002/03/18 23:11:32 jblazek
281 ! Finished multiblock and MPI.
282 !
283 ! Revision 1.3 2002/02/21 23:25:05 jblazek
284 ! Blocks renamed as regions.
285 !
286 ! Revision 1.2 2002/01/28 23:55:22 jblazek
287 ! Added flux computation (central scheme).
288 !
289 ! Revision 1.1 2002/01/23 03:51:25 jblazek
290 ! Added low-level time-stepping routines.
291 !
292 !******************************************************************************
293 
294 
295 
296 
297 
298 
299 
j indices k indices k
Definition: Indexing.h:6
NT rhs
**********************************************************************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 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 ipcbeg
blockLoc i
Definition: read.cpp:79
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
subroutine rflo_centralflux(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
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflo_getdimensphys(region, iLev, ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend)
subroutine rflo_centralfluxpatch(region, patch)