Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_InjcTileCalcRhs.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: computes the RHS for the multiphase injection algorithm.
26 !
27 ! Description: none.
28 !
29 ! Input: region = current region
30 !
31 ! Output: regions(iReg)%levels%patch%tile%rhs = updated tile rhs values
32 ! of current region.
33 !
34 ! Notes: Use negative values of rhs for consistent RK Updating step.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PLAG_InjcTileCalcRhs.F90,v 1.4 2008/12/06 08:44:34 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2002 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE plag_injctilecalcrhs( region )
45 
46  USE moddatatypes
48  USE modbndpatch, ONLY : t_patch
49  USE moddatastruct, ONLY : t_region
50  USE modglobal, ONLY : t_global
53  USE moderror
54  USE modparameters
56  IMPLICIT NONE
57 
58 #include "Indexing.h"
59 
60 ! ... parameters
61  TYPE(t_region) :: region
62 
63 ! ... loop variables
64  INTEGER :: ipatch, icont, i, j, k
65 
66 ! ... local variables
67  CHARACTER(CHRLEN) :: rcsidentstring
68 
69  INTEGER :: bctype, distrib, i2dvals, ibeg, icoff, idir, iend, &
70  ijcoff, ijnoff, ijkc, ijkd, ijkn, ilev, inode, inoff, &
71  itile, jbeg, jdir, jend, jnode, kbeg, kdir, kend, &
72  knode, lbound, n1, n2, ncont, noff, npatches
73  INTEGER, POINTER, DIMENSION(:) :: pcvtilemass
74 
75  REAL(RFREAL) :: area, heatcapsum, injcvelratio, massfluxsum, mrate, &
76  rhomixtbcond, tburn, tiletemp, tilevelnrm
77  REAL(RFREAL), POINTER, DIMENSION(:) :: injcmassfluxratio, specheat
78  REAL(RFREAL), POINTER, DIMENSION(:,:) :: prhs, sface, vals
79 
80  TYPE(t_patch), POINTER :: ppatch
81  TYPE(t_tile_plag), POINTER :: ptileplag
82  TYPE(t_global), POINTER :: global
83 
84 !******************************************************************************
85 
86  rcsidentstring = '$RCSfile: PLAG_InjcTileCalcRhs.F90,v $ $Revision: 1.4 $'
87 
88  global => region%global
89 
90  CALL registerfunction( global, 'PLAG_InjcTileCalcRhs',&
91  'PLAG_InjcTileCalcRhs.F90' )
92 
93 ! Get dimensions --------------------------------------------------------------
94 
95  ilev = region%currLevel
96  npatches = region%nPatches
97 
98  ncont = region%plagInput%nCont
99  injcvelratio = region%plagInput%injcVelRatio
100 
101  injcmassfluxratio => region%plagInput%injcMassFluxRatio
102  specheat => region%plagInput%spht
103 
104 ! Loop over patches -----------------------------------------------------------
105 
106  DO ipatch=1,npatches
107 
108  ppatch => region%levels(ilev)%patches(ipatch)
109 
110  bctype = ppatch%bcType
111 
112 ! - Select injection boundary condition ---------------------------------------
113 
114  IF (bctype>=bc_injection .AND. bctype<=bc_injection+bc_range) THEN
115 
116 ! -- Get dimensions and pointers ----------------------------------------------
117 
118  lbound = ppatch%lbound
119 
120  CALL rflo_getpatchindices( region,ppatch,ilev, &
121  ibeg,iend,jbeg,jend,kbeg,kend )
122  CALL rflo_getpatchdirection( ppatch,idir,jdir,kdir )
123  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
124  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
125 
126  noff = abs(ppatch%l1end-ppatch%l1beg) + 1
127  distrib = ppatch%mixt%distrib
128 
129  vals => ppatch%mixt%vals
130 
131 ! -- Set appropriate extent of cells and shift upper cell by one value --------
132 
133  inode = 0
134  jnode = 0
135  knode = 0
136  IF (lbound==2 .OR. lbound==4 .OR. lbound==6) THEN
137  inode = -idir
138  jnode = -jdir
139  knode = -kdir
140  ENDIF ! lbound
141 
142 ! -- Get the appropriate face vector ------------------------------------------
143 
144  IF (lbound==1 .OR. lbound==2) sface => region%levels(ilev)%plag%si
145  IF (lbound==3 .OR. lbound==4) sface => region%levels(ilev)%plag%sj
146  IF (lbound==5 .OR. lbound==6) sface => region%levels(ilev)%plag%sk
147 
148 ! -- Loop over patch ----------------------------------------------------------
149 
150  DO k=kbeg,kend
151  DO j=jbeg,jend
152  DO i=ibeg,iend
153  ijkc = indijk(i,j,k,icoff,ijcoff)
154  ijkn = indijk(i+inode,j+jnode,k+knode,inoff,ijnoff)
155  ijkd = indijk(i-idir,j-jdir,k-kdir,icoff,ijcoff)
156  area = sqrt(sface(xcoord,ijkn)*sface(xcoord,ijkn)+ &
157  sface(ycoord,ijkn)*sface(ycoord,ijkn)+ &
158  sface(zcoord,ijkn)*sface(zcoord,ijkn))
159 
160  IF (lbound==1 .OR. lbound==2) THEN
161  n1 = j - jbeg + 1
162  n2 = k - kbeg + 1
163  ELSE IF (lbound==3 .OR. lbound==4) THEN
164  n1 = k - kbeg + 1
165  n2 = i - ibeg + 1
166  ELSE IF (lbound==5 .OR. lbound==6) THEN
167  n1 = i - ibeg + 1
168  n2 = j - jbeg + 1
169  ENDIF ! lbound
170 
171  i2dvals = distrib * indij(n1-1,n2-1,noff)
172  mrate = vals(bcdat_inject_mfrate,i2dvals)
173  tburn = vals(bcdat_inject_temp ,i2dvals)
174 
175 ! --- Compute mixture density on boundary -------------------------------------
176 ! --- based on an average of interior & dummy cell ----------------------------
177 
178  rhomixtbcond = 0.5_rfreal * &
179  (region%levels(ilev)%mixt%cv(cv_mixt_dens,ijkc) + &
180  region%levels(ilev)%mixt%cv(cv_mixt_dens,ijkd) )
181 
182 ! --- Update tile Rhs datastructure -------------------------------------------
183 
184  itile = indij(n1,n2,noff)
185  ptileplag => ppatch%tilePlag
186 
187  prhs => ptileplag%rhs
188  pcvtilemass => ptileplag%cvTileMass
189 
190  massfluxsum = sum( mrate * injcmassfluxratio(:) )
191  heatcapsum = dot_product( specheat, mrate * &
192  injcmassfluxratio(:) )
193 
194  tiletemp = tburn
195  tilevelnrm = injcvelratio * mrate / rhomixtbcond
196 
197  DO icont = 1, ncont
198  prhs(pcvtilemass(icont),itile) = -area *mrate * &
199  injcmassfluxratio(icont)
200  END DO ! iCont
201 
202  prhs(cv_tile_momnrm,itile) = -area *massfluxsum *tilevelnrm
203 
204  prhs(cv_tile_ener ,itile) = -area * &
205  ( 0.5_rfreal*massfluxsum*tilevelnrm**2 &
206  + heatcapsum *tiletemp )
207 
208  END DO ! i
209  END DO ! j
210  END DO ! k
211 
212  ENDIF ! bcType
213 
214  ENDDO ! iPatch
215 
216 ! finalize --------------------------------------------------------------------
217 
218  CALL deregisterfunction( global )
219 
220 END SUBROUTINE plag_injctilecalcrhs
221 
222 !******************************************************************************
223 !
224 ! RCS Revision history:
225 !
226 ! $Log: PLAG_InjcTileCalcRhs.F90,v $
227 ! Revision 1.4 2008/12/06 08:44:34 mtcampbe
228 ! Updated license.
229 !
230 ! Revision 1.3 2008/11/19 22:17:46 mtcampbe
231 ! Added Illinois Open Source License/Copyright
232 !
233 ! Revision 1.2 2006/08/19 15:40:05 mparmar
234 ! Renamed patch variables
235 !
236 ! Revision 1.1 2004/12/01 20:57:43 fnajjar
237 ! Initial revision after changing case
238 !
239 ! Revision 1.5 2003/11/03 21:21:51 fnajjar
240 ! Changed definition of face vectors pointing to PLAG datastructure
241 !
242 ! Revision 1.4 2003/05/15 02:57:05 jblazek
243 ! Inlined index function.
244 !
245 ! Revision 1.3 2003/05/07 15:12:10 fnajjar
246 ! Bug fix of i2dVals for correct boundary extent
247 !
248 ! Revision 1.2 2003/01/16 20:15:11 f-najjar
249 ! Removed iRegionGlobal
250 !
251 ! Revision 1.1 2002/10/25 14:16:31 f-najjar
252 ! Initial Import of Rocpart
253 !
254 !
255 !******************************************************************************
256 
257 
258 
259 
260 
261 
262 
**********************************************************************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 plag_injctilecalcrhs(region)
Tfloat sum() const
Return the sum of all the pixel values in an image.
Definition: CImg.h:13022
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
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
**********************************************************************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
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
long double dot_product(pnt vec1, pnt vec2)
**********************************************************************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