Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SPEC_EqEulCorrPatch.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 Equilibrium Eulerian correction to species mass fluxes and
26 ! overall mass flux for boundary faces.
27 !
28 ! Description: None.
29 !
30 ! Input:
31 ! pRegion Pointer to data of current region
32 ! pPatch Pointer to data of current patch
33 ! iSpec Index of species
34 !
35 ! Output: None.
36 !
37 ! Notes:
38 ! 1. Outflow boundary conditions have a modified flux due to the Equilibrium
39 ! Eulerian velocity correction
40 ! 2. Inflow boundary conditions have unmodified fluxes: the total mass flux
41 ! is specified, and has already been accounted for
42 !
43 ! ******************************************************************************
44 !
45 ! $Id: SPEC_EqEulCorrPatch.F90,v 1.6 2008/12/06 08:44:40 mtcampbe Exp $
46 !
47 ! Copyright: (c) 2004-2005 by the University of Illinois
48 !
49 ! ******************************************************************************
50 
51 SUBROUTINE spec_eqeulcorrpatch(pRegion,pPatch,iSpec)
52 
53  USE moddatatypes
54  USE modglobal, ONLY: t_global
55  USE modbndpatch, ONLY: t_bcvalues,t_patch
56  USE moddatastruct, ONLY: t_region
57  USE modgrid, ONLY: t_grid
58  USE moderror
59  USE modparameters
60 
61  IMPLICIT NONE
62 
63 ! ******************************************************************************
64 ! Definitions and declarations
65 ! ******************************************************************************
66 
67 ! ==============================================================================
68 ! Arguments
69 ! ==============================================================================
70 
71  INTEGER, INTENT(IN) :: ispec
72  TYPE(t_region), POINTER :: pregion
73  TYPE(t_patch), POINTER :: ppatch
74 
75 ! ==============================================================================
76 ! Locals
77 ! ==============================================================================
78 
79  CHARACTER(CHRLEN) :: rcsidentstring
80  INTEGER :: bctype,c1,ifl
81  REAL(RFREAL) :: flx,gx,gy,gz,nx,ny,nz,nm,sd1x,sd1y,sd1z,sdf,taucoef
82  REAL(RFREAL), DIMENSION(:), POINTER :: pmfmixt
83  REAL(RFREAL), DIMENSION(:,:), POINTER :: psd,pcvspec,ptvmixt,rhsmixt,rhsspec
84  TYPE(t_global), POINTER :: global
85  TYPE(t_grid), POINTER :: pgrid
86 
87 ! ******************************************************************************
88 ! Start
89 ! ******************************************************************************
90 
91  rcsidentstring = '$RCSfile: SPEC_EqEulCorrPatch.F90,v $ $Revision: 1.6 $'
92 
93  global => pregion%global
94 
95  CALL registerfunction(global,'SPEC_EqEulCorrPatch',&
96  'SPEC_EqEulCorrPatch.F90')
97 
98 ! ******************************************************************************
99 ! Set pointers and variables
100 ! ******************************************************************************
101 
102  pgrid => pregion%grid
103  pmfmixt => ppatch%mfMixt
104 
105  psd => pregion%mixt%sd
106  pcvspec => pregion%spec%cv
107  ptvmixt => pregion%mixt%tv
108  rhsmixt => pregion%mixt%rhs
109  rhsspec => pregion%spec%rhs
110 
111  bctype = ppatch%bcType
112 
113  taucoef = pregion%specInput%specType(ispec)%tauCoefficient
114 
115 ! ******************************************************************************
116 ! Checks: Defensive coding, should never occur
117 ! ******************************************************************************
118 
119  IF ( pregion%specInput%specType(ispec)%discreteFlag .EQV. .false. ) THEN
120  CALL errorstop(global,err_illegal_value,__line__)
121  END IF ! pRegion%specInput
122 
123  IF ( pregion%specInput%specType(ispec)%velocityMethod /= &
124  spec_methv_eqeul ) THEN
125  CALL errorstop(global,err_illegal_value,__line__)
126  END IF ! pRegion%specInput
127 
128  IF ( taucoef <= 0.0_rfreal ) THEN
129  CALL errorstop(global,err_illegal_value,__line__)
130  END IF ! tauCoef
131 
132  IF ( pregion%mixtInput%indSd /= 1 ) THEN
133  CALL errorstop(global,err_illegal_value,__line__)
134  END IF ! pRegion%mixtInput%indSd
135 
136  IF ( pregion%mixt%cvState /= cv_mixt_state_cons ) THEN
137  CALL errorstop(global,err_cv_state_invalid,__line__)
138  END IF ! pRegion%mixt%cvState
139 
140 ! ******************************************************************************
141 ! Set gravity vector for settling velocity
142 ! ******************************************************************************
143 
144  IF ( (global%accelOn .EQV. .true.) .AND. &
145  (pregion%specInput%specType(ispec)%settlingFlag .EQV. .true.) ) THEN
146  gx = global%accelX
147  gy = global%accelY
148  gz = global%accelZ
149  ELSE
150  gx = 0.0_rfreal
151  gy = 0.0_rfreal
152  gz = 0.0_rfreal
153  END IF ! global%accelOn
154 
155 ! ******************************************************************************
156 ! Select boundary type
157 ! ******************************************************************************
158 
159  SELECT CASE ( bctype )
160 
161 ! ==============================================================================
162 ! Inflow: No additional terms
163 ! ==============================================================================
164 
165  CASE ( bc_inflow_totang,bc_inflow_veltemp )
166 
167 ! ==============================================================================
168 ! Outflow: No test on pMfMixt: for consistency with RFLU_ScalarFirstPatch
169 ! ==============================================================================
170 
171  CASE ( bc_outflow )
172  DO ifl = 1,ppatch%nBFaces
173  c1 = ppatch%bf2c(ifl)
174 
175  nx = ppatch%fn(xcoord,ifl)
176  ny = ppatch%fn(ycoord,ifl)
177  nz = ppatch%fn(zcoord,ifl)
178  nm = ppatch%fn(xyzmag,ifl)
179 
180  sd1x = psd(sd_xmom,c1)
181  sd1y = psd(sd_ymom,c1)
182  sd1z = psd(sd_zmom,c1)
183 
184  sdf = ((sd1x-gx)*nx + (sd1y-gy)*ny + (sd1z-gz)*nz)/ptvmixt(tv_mixt_muel,c1)
185 
186  flx = -taucoef*sdf*pcvspec(ispec,c1)*nm
187 
188  rhsspec(ispec,c1) = rhsspec(ispec,c1) + flx
189 
190  rhsmixt(cv_mixt_dens,c1) = rhsmixt(cv_mixt_dens,c1) + flx
191  END DO ! ifl
192 
193 ! ==============================================================================
194 ! Slip wall: No additional terms
195 ! ==============================================================================
196 
197  CASE ( bc_slipwall )
198 
199 ! ==============================================================================
200 ! No-slip wall: No additional terms
201 ! ==============================================================================
202 
203  CASE ( bc_noslipwall_hflux,bc_noslipwall_temp )
204 
205 ! ==============================================================================
206 ! Farfield
207 ! ==============================================================================
208 
209  CASE ( bc_farfield )
210  DO ifl = 1,ppatch%nBFaces
211  c1 = ppatch%bf2c(ifl)
212 
213  IF ( pmfmixt(ifl) > 0.0_rfreal ) THEN ! Outflow
214  nx = ppatch%fn(xcoord,ifl)
215  ny = ppatch%fn(ycoord,ifl)
216  nz = ppatch%fn(zcoord,ifl)
217  nm = ppatch%fn(xyzmag,ifl)
218 
219  sd1x = psd(sd_xmom,c1)
220  sd1y = psd(sd_ymom,c1)
221  sd1z = psd(sd_zmom,c1)
222 
223  sdf = ((sd1x-gx)*nx + (sd1y-gy)*ny + (sd1z-gz)*nz)/ptvmixt(tv_mixt_muel,c1)
224 
225  flx = -taucoef*sdf*pcvspec(ispec,c1)*nm
226 
227  rhsspec(ispec,c1) = rhsspec(ispec,c1) + flx
228 
229  rhsmixt(cv_mixt_dens,c1) = rhsmixt(cv_mixt_dens,c1) + flx
230  END IF ! pMfMixt
231  END DO ! ifl
232 
233 ! ==============================================================================
234 ! Injection: No additional terms
235 ! ==============================================================================
236 
237  CASE ( bc_injection )
238 
239 ! ==============================================================================
240 ! Virtual
241 ! ==============================================================================
242 
243  CASE ( bc_virtual )
244 
245 ! ==============================================================================
246 ! Default
247 ! ==============================================================================
248 
249  CASE default
250  CALL errorstop(global,err_reached_default,__line__)
251  END SELECT ! bcType
252 
253 ! ******************************************************************************
254 ! End
255 ! ******************************************************************************
256 
257  CALL deregisterfunction(global)
258 
259 END SUBROUTINE spec_eqeulcorrpatch
260 
261 ! ******************************************************************************
262 !
263 ! RCS Revision history:
264 !
265 ! $Log: SPEC_EqEulCorrPatch.F90,v $
266 ! Revision 1.6 2008/12/06 08:44:40 mtcampbe
267 ! Updated license.
268 !
269 ! Revision 1.5 2008/11/19 22:17:52 mtcampbe
270 ! Added Illinois Open Source License/Copyright
271 !
272 ! Revision 1.4 2005/11/10 02:34:41 haselbac
273 ! Added support for gravity, cleaned up patch CASE statement
274 !
275 ! Revision 1.3 2005/10/05 14:24:10 haselbac
276 ! Bug fix: Missing definition of pTvMixt
277 !
278 ! Revision 1.2 2005/03/31 17:17:41 haselbac
279 ! Changed computation of correction, cosmetics
280 !
281 ! Revision 1.1 2004/07/30 22:47:37 jferry
282 ! Implemented Equilibrium Eulerian method for Rocflu
283 !
284 ! ******************************************************************************
285 
286 
287 
288 
289 
290 
291 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine spec_eqeulcorrpatch(pRegion, pPatch, iSpec)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469