Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_RoeFluxFirst.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 convective fluxes based on 1st-order Roe upwind scheme.
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_RoeFluxFirst.F90,v 1.3 2008/12/06 08:44:28 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2003 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE rflo_roefluxfirst( 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) :: rhl, rhr, qsl, qsr, pav, fc(5)
66  REAL(RFREAL), POINTER :: cv(:,:), dv(:,:), rhs(:,:), si(:,:), sj(:,:), sk(:,:)
67  REAL(RFREAL), POINTER :: sivel(:), sjvel(:), skvel(:)
68 
69 !******************************************************************************
70 
71  CALL registerfunction( region%global,'RFLO_RoeFluxFirst',&
72  'RFLO_RoeFluxFirst.F90' )
73 
74 ! get dimensions and pointers -------------------------------------------------
75 
76  ilev = region%currLevel
77 
78  CALL rflo_getdimensphys( region,ilev,ipcbeg,ipcend, &
79  jpcbeg,jpcend,kpcbeg,kpcend )
80  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
81  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
82 
83  cv => region%levels(ilev)%mixt%cv
84  dv => region%levels(ilev)%mixt%dv
85  rhs => region%levels(ilev)%mixt%rhs
86  si => region%levels(ilev)%grid%si
87  sj => region%levels(ilev)%grid%sj
88  sk => region%levels(ilev)%grid%sk
89  sivel => region%levels(ilev)%grid%siVel
90  sjvel => region%levels(ilev)%grid%sjVel
91  skvel => region%levels(ilev)%grid%skVel
92  indsvel = region%levels(ilev)%grid%indSvel
93 
94 ! flux in i-direction (except through boundary) -------------------------------
95 
96  DO k=kpcbeg,kpcend
97  DO j=jpcbeg,jpcend
98  DO i=ipcbeg+1,ipcend
99  ijkc0 = indijk(i ,j,k,icoff,ijcoff)
100  ijkc1 = indijk(i-1,j,k,icoff,ijcoff)
101  ijkn = indijk(i ,j,k,inoff,ijnoff)
102 
103  rhl = dv(dv_mixt_pres,ijkc1) + cv(cv_mixt_ener,ijkc1)
104  qsl = dv(dv_mixt_uvel,ijkc1)*si(xcoord,ijkn) + &
105  dv(dv_mixt_vvel,ijkc1)*si(ycoord,ijkn) + &
106  dv(dv_mixt_wvel,ijkc1)*si(zcoord,ijkn) - sivel(ijkn*indsvel)
107  rhr = dv(dv_mixt_pres,ijkc0) + cv(cv_mixt_ener,ijkc0)
108  qsr = dv(dv_mixt_uvel,ijkc0)*si(xcoord,ijkn) + &
109  dv(dv_mixt_vvel,ijkc0)*si(ycoord,ijkn) + &
110  dv(dv_mixt_wvel,ijkc0)*si(zcoord,ijkn) - sivel(ijkn*indsvel)
111  pav = 0.5_rfreal*(dv(dv_mixt_pres,ijkc0)+dv(dv_mixt_pres,ijkc1))
112 
113  fc(1) = 0.5_rfreal*(qsl*cv(cv_mixt_dens,ijkc1)+ &
114  qsr*cv(cv_mixt_dens,ijkc0))
115  fc(2) = 0.5_rfreal*(qsl*cv(cv_mixt_xmom,ijkc1)+ &
116  qsr*cv(cv_mixt_xmom,ijkc0)) + pav*si(xcoord,ijkn)
117  fc(3) = 0.5_rfreal*(qsl*cv(cv_mixt_ymom,ijkc1)+ &
118  qsr*cv(cv_mixt_ymom,ijkc0)) + pav*si(ycoord,ijkn)
119  fc(4) = 0.5_rfreal*(qsl*cv(cv_mixt_zmom,ijkc1)+ &
120  qsr*cv(cv_mixt_zmom,ijkc0)) + pav*si(zcoord,ijkn)
121  fc(5) = 0.5_rfreal*(qsl*rhl+qsr*rhr) + sivel(ijkn*indsvel)*pav
122 
123  rhs(cv_mixt_dens,ijkc0) = rhs(cv_mixt_dens,ijkc0) + fc(1)
124  rhs(cv_mixt_xmom,ijkc0) = rhs(cv_mixt_xmom,ijkc0) + fc(2)
125  rhs(cv_mixt_ymom,ijkc0) = rhs(cv_mixt_ymom,ijkc0) + fc(3)
126  rhs(cv_mixt_zmom,ijkc0) = rhs(cv_mixt_zmom,ijkc0) + fc(4)
127  rhs(cv_mixt_ener,ijkc0) = rhs(cv_mixt_ener,ijkc0) + fc(5)
128 
129  rhs(cv_mixt_dens,ijkc1) = rhs(cv_mixt_dens,ijkc1) - fc(1)
130  rhs(cv_mixt_xmom,ijkc1) = rhs(cv_mixt_xmom,ijkc1) - fc(2)
131  rhs(cv_mixt_ymom,ijkc1) = rhs(cv_mixt_ymom,ijkc1) - fc(3)
132  rhs(cv_mixt_zmom,ijkc1) = rhs(cv_mixt_zmom,ijkc1) - fc(4)
133  rhs(cv_mixt_ener,ijkc1) = rhs(cv_mixt_ener,ijkc1) - fc(5)
134  ENDDO ! i
135  ENDDO ! j
136  ENDDO ! k
137 
138 ! flux in j-direction (except through boundary) -------------------------------
139 
140  DO k=kpcbeg,kpcend
141  DO j=jpcbeg+1,jpcend
142  DO i=ipcbeg,ipcend
143  ijkc0 = indijk(i,j ,k,icoff,ijcoff)
144  ijkc1 = indijk(i,j-1,k,icoff,ijcoff)
145  ijkn = indijk(i,j ,k,inoff,ijnoff)
146 
147  rhl = dv(dv_mixt_pres,ijkc1) + cv(cv_mixt_ener,ijkc1)
148  qsl = dv(dv_mixt_uvel,ijkc1)*sj(xcoord,ijkn) + &
149  dv(dv_mixt_vvel,ijkc1)*sj(ycoord,ijkn) + &
150  dv(dv_mixt_wvel,ijkc1)*sj(zcoord,ijkn) - sjvel(ijkn*indsvel)
151  rhr = dv(dv_mixt_pres,ijkc0) + cv(cv_mixt_ener,ijkc0)
152  qsr = dv(dv_mixt_uvel,ijkc0)*sj(xcoord,ijkn) + &
153  dv(dv_mixt_vvel,ijkc0)*sj(ycoord,ijkn) + &
154  dv(dv_mixt_wvel,ijkc0)*sj(zcoord,ijkn) - sjvel(ijkn*indsvel)
155  pav = 0.5_rfreal*(dv(dv_mixt_pres,ijkc0)+dv(dv_mixt_pres,ijkc1))
156 
157  fc(1) = 0.5_rfreal*(qsl*cv(cv_mixt_dens,ijkc1)+ &
158  qsr*cv(cv_mixt_dens,ijkc0))
159  fc(2) = 0.5_rfreal*(qsl*cv(cv_mixt_xmom,ijkc1)+ &
160  qsr*cv(cv_mixt_xmom,ijkc0)) + pav*sj(xcoord,ijkn)
161  fc(3) = 0.5_rfreal*(qsl*cv(cv_mixt_ymom,ijkc1)+ &
162  qsr*cv(cv_mixt_ymom,ijkc0)) + pav*sj(ycoord,ijkn)
163  fc(4) = 0.5_rfreal*(qsl*cv(cv_mixt_zmom,ijkc1)+ &
164  qsr*cv(cv_mixt_zmom,ijkc0)) + pav*sj(zcoord,ijkn)
165  fc(5) = 0.5_rfreal*(qsl*rhl+qsr*rhr) + sjvel(ijkn*indsvel)*pav
166 
167  rhs(cv_mixt_dens,ijkc0) = rhs(cv_mixt_dens,ijkc0) + fc(1)
168  rhs(cv_mixt_xmom,ijkc0) = rhs(cv_mixt_xmom,ijkc0) + fc(2)
169  rhs(cv_mixt_ymom,ijkc0) = rhs(cv_mixt_ymom,ijkc0) + fc(3)
170  rhs(cv_mixt_zmom,ijkc0) = rhs(cv_mixt_zmom,ijkc0) + fc(4)
171  rhs(cv_mixt_ener,ijkc0) = rhs(cv_mixt_ener,ijkc0) + fc(5)
172 
173  rhs(cv_mixt_dens,ijkc1) = rhs(cv_mixt_dens,ijkc1) - fc(1)
174  rhs(cv_mixt_xmom,ijkc1) = rhs(cv_mixt_xmom,ijkc1) - fc(2)
175  rhs(cv_mixt_ymom,ijkc1) = rhs(cv_mixt_ymom,ijkc1) - fc(3)
176  rhs(cv_mixt_zmom,ijkc1) = rhs(cv_mixt_zmom,ijkc1) - fc(4)
177  rhs(cv_mixt_ener,ijkc1) = rhs(cv_mixt_ener,ijkc1) - fc(5)
178  ENDDO ! i
179  ENDDO ! j
180  ENDDO ! k
181 
182 ! flux in k-direction (except through boundary) -------------------------------
183 
184  DO k=kpcbeg+1,kpcend
185  DO j=jpcbeg,jpcend
186  DO i=ipcbeg,ipcend
187  ijkc0 = indijk(i,j,k ,icoff,ijcoff)
188  ijkc1 = indijk(i,j,k-1,icoff,ijcoff)
189  ijkn = indijk(i,j,k ,inoff,ijnoff)
190 
191  rhl = dv(dv_mixt_pres,ijkc1) + cv(cv_mixt_ener,ijkc1)
192  qsl = dv(dv_mixt_uvel,ijkc1)*sk(xcoord,ijkn) + &
193  dv(dv_mixt_vvel,ijkc1)*sk(ycoord,ijkn) + &
194  dv(dv_mixt_wvel,ijkc1)*sk(zcoord,ijkn) - skvel(ijkn*indsvel)
195  rhr = dv(dv_mixt_pres,ijkc0) + cv(cv_mixt_ener,ijkc0)
196  qsr = dv(dv_mixt_uvel,ijkc0)*sk(xcoord,ijkn) + &
197  dv(dv_mixt_vvel,ijkc0)*sk(ycoord,ijkn) + &
198  dv(dv_mixt_wvel,ijkc0)*sk(zcoord,ijkn) - skvel(ijkn*indsvel)
199  pav = 0.5_rfreal*(dv(dv_mixt_pres,ijkc0)+dv(dv_mixt_pres,ijkc1))
200 
201  fc(1) = 0.5_rfreal*(qsl*cv(cv_mixt_dens,ijkc1)+ &
202  qsr*cv(cv_mixt_dens,ijkc0))
203  fc(2) = 0.5_rfreal*(qsl*cv(cv_mixt_xmom,ijkc1)+ &
204  qsr*cv(cv_mixt_xmom,ijkc0)) + pav*sk(xcoord,ijkn)
205  fc(3) = 0.5_rfreal*(qsl*cv(cv_mixt_ymom,ijkc1)+ &
206  qsr*cv(cv_mixt_ymom,ijkc0)) + pav*sk(ycoord,ijkn)
207  fc(4) = 0.5_rfreal*(qsl*cv(cv_mixt_zmom,ijkc1)+ &
208  qsr*cv(cv_mixt_zmom,ijkc0)) + pav*sk(zcoord,ijkn)
209  fc(5) = 0.5_rfreal*(qsl*rhl+qsr*rhr) + skvel(ijkn*indsvel)*pav
210 
211  rhs(cv_mixt_dens,ijkc0) = rhs(cv_mixt_dens,ijkc0) + fc(1)
212  rhs(cv_mixt_xmom,ijkc0) = rhs(cv_mixt_xmom,ijkc0) + fc(2)
213  rhs(cv_mixt_ymom,ijkc0) = rhs(cv_mixt_ymom,ijkc0) + fc(3)
214  rhs(cv_mixt_zmom,ijkc0) = rhs(cv_mixt_zmom,ijkc0) + fc(4)
215  rhs(cv_mixt_ener,ijkc0) = rhs(cv_mixt_ener,ijkc0) + fc(5)
216 
217  rhs(cv_mixt_dens,ijkc1) = rhs(cv_mixt_dens,ijkc1) - fc(1)
218  rhs(cv_mixt_xmom,ijkc1) = rhs(cv_mixt_xmom,ijkc1) - fc(2)
219  rhs(cv_mixt_ymom,ijkc1) = rhs(cv_mixt_ymom,ijkc1) - fc(3)
220  rhs(cv_mixt_zmom,ijkc1) = rhs(cv_mixt_zmom,ijkc1) - fc(4)
221  rhs(cv_mixt_ener,ijkc1) = rhs(cv_mixt_ener,ijkc1) - fc(5)
222  ENDDO ! i
223  ENDDO ! j
224  ENDDO ! k
225 
226 ! fluxes through boundaries ---------------------------------------------------
227 
228  DO ipatch=1,region%nPatches
229  CALL rflo_roefluxpatch( region,region%levels(ilev)%patches(ipatch) )
230  ENDDO
231 
232 ! finalize --------------------------------------------------------------------
233 
234  CALL deregisterfunction( region%global )
235 
236 END SUBROUTINE rflo_roefluxfirst
237 
238 !******************************************************************************
239 !
240 ! RCS Revision history:
241 !
242 ! $Log: RFLO_RoeFluxFirst.F90,v $
243 ! Revision 1.3 2008/12/06 08:44:28 mtcampbe
244 ! Updated license.
245 !
246 ! Revision 1.2 2008/11/19 22:17:38 mtcampbe
247 ! Added Illinois Open Source License/Copyright
248 !
249 ! Revision 1.1 2004/11/29 20:51:40 wasistho
250 ! lower to upper case
251 !
252 ! Revision 1.6 2003/11/20 16:40:40 mdbrandy
253 ! Backing out RocfluidMP changes from 11-17-03
254 !
255 ! Revision 1.2 2003/10/01 23:52:10 jblazek
256 ! Corrected bug in moving noslip wall BC and grid speeds.
257 !
258 ! Revision 1.1 2003/05/29 17:28:43 jblazek
259 ! Implemented Roe scheme.
260 !
261 !******************************************************************************
262 
263 
264 
265 
266 
267 
268 
subroutine rflo_roefluxfirst(region)
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)
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 rflo_roefluxpatch(region, patch)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflo_getdimensphys(region, iLev, ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend)