Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ScalarFirstPatch.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 first-order accurate discretization of scalar inviscid flux
26 ! through 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 ! nVarScal Number of scalars
34 ! cvScal Vector of conserved scalar variables
35 ! valScal Boundary values of scalar variables
36 !
37 ! Output:
38 ! resScal Residual of scalar variables
39 !
40 ! Notes: None.
41 !
42 ! ******************************************************************************
43 !
44 ! $Id: RFLU_ScalarFirstPatch.F90,v 1.7 2008/12/06 08:44:12 mtcampbe Exp $
45 !
46 ! Copyright: (c) 2004-2006 by the University of Illinois
47 !
48 ! ******************************************************************************
49 
50 SUBROUTINE rflu_scalarfirstpatch(pRegion,pPatch,nVarScal,cvScal,valScal,resScal)
51 
52  USE modglobal, ONLY: t_global
53  USE moddatatypes
54  USE modbndpatch, ONLY: t_bcvalues,t_patch
55  USE moddatastruct, ONLY: t_region
56  USE modgrid, ONLY: t_grid
57  USE moderror
58  USE modparameters
59 
60  IMPLICIT NONE
61 
62 ! ******************************************************************************
63 ! Definitions and declarations
64 ! ******************************************************************************
65 
66 ! ==============================================================================
67 ! Arguments
68 ! ==============================================================================
69 
70  INTEGER, INTENT(IN) :: nvarscal
71  REAL(RFREAL), DIMENSION(:,:), INTENT(IN) :: cvscal
72  REAL(RFREAL), DIMENSION(:,:), INTENT(INOUT) :: resscal
73  TYPE(t_bcvalues) :: valscal
74  TYPE(t_patch), POINTER :: ppatch
75  TYPE(t_region), POINTER :: pregion
76 
77 ! ==============================================================================
78 ! Locals
79 ! ==============================================================================
80 
81  CHARACTER(CHRLEN) :: rcsidentstring
82  INTEGER :: c1,bctype,distscal,ifc,ivarscal
83  REAL(RFREAL) :: flx,mf
84  REAL(RFREAL), DIMENSION(:), POINTER :: pmfmixt
85  REAL(RFREAL), DIMENSION(:,:), POINTER :: rhs
86  TYPE(t_global), POINTER :: global
87  TYPE(t_grid), POINTER :: pgrid
88 
89 ! ******************************************************************************
90 ! Start
91 ! ******************************************************************************
92 
93  rcsidentstring = '$RCSfile: RFLU_ScalarFirstPatch.F90,v $ $Revision: 1.7 $'
94 
95  global => pregion%global
96 
97  CALL registerfunction(global,'RFLU_ScalarFirstPatch',&
98  'RFLU_ScalarFirstPatch.F90')
99 
100 ! ******************************************************************************
101 ! Checks: Defensive coding, should never occur
102 ! ******************************************************************************
103 
104  IF ( pregion%mixtInput%indMfMixt /= 1 ) THEN
105  CALL errorstop(global,err_indmfmixt_invalid,__line__)
106  END IF ! pRegion%mixtInput%indMfMixt
107 
108 ! ******************************************************************************
109 ! Set pointers and variables
110 ! ******************************************************************************
111 
112  pgrid => pregion%grid
113  pmfmixt => ppatch%mfMixt
114 
115  bctype = ppatch%bcType
116  distscal = valscal%distrib
117 
118 ! ******************************************************************************
119 ! Select boundary type
120 ! ******************************************************************************
121 
122  SELECT CASE ( bctype )
123 
124 ! ==============================================================================
125 ! Inflow
126 ! ==============================================================================
127 
128  CASE ( bc_inflow_totang,bc_inflow_veltemp )
129  DO ifc = 1,ppatch%nBFaces
130  c1 = ppatch%bf2c(ifc)
131 
132  mf = pmfmixt(ifc)
133 
134  DO ivarscal = 1,nvarscal
135  flx = mf*valscal%vals(ivarscal,distscal*ifc)
136 
137  resscal(ivarscal,c1) = resscal(ivarscal,c1) + flx
138  END DO ! iVarScal
139  END DO ! ifc
140 
141 ! ==============================================================================
142 ! Outflow
143 ! ==============================================================================
144 
145  CASE ( bc_outflow )
146  DO ifc = 1,ppatch%nBFaces
147  c1 = ppatch%bf2c(ifc)
148 
149  mf = pmfmixt(ifc)
150 
151  DO ivarscal = 1,nvarscal
152  flx = mf*cvscal(ivarscal,c1)
153 
154  resscal(ivarscal,c1) = resscal(ivarscal,c1) + flx
155  END DO ! iVarScal
156  END DO ! ifc
157 
158 ! ==============================================================================
159 ! Slip wall
160 ! ==============================================================================
161 
162  CASE ( bc_slipwall )
163 
164 ! ==============================================================================
165 ! No-slip wall
166 ! ==============================================================================
167 
168  CASE ( bc_noslipwall_hflux,bc_noslipwall_temp )
169 
170 ! ==============================================================================
171 ! Farfield
172 ! ==============================================================================
173 
174  CASE ( bc_farfield )
175  DO ifc = 1,ppatch%nBFaces
176  c1 = ppatch%bf2c(ifc)
177 
178  mf = pmfmixt(ifc)
179 
180  IF ( mf > 0.0_rfreal ) THEN ! Outflow
181  DO ivarscal = 1,nvarscal
182  flx = mf*cvscal(ivarscal,c1)
183 
184  resscal(ivarscal,c1) = resscal(ivarscal,c1) + flx
185  END DO ! iVarScal
186  ELSE ! Inflow
187  DO ivarscal = 1,nvarscal
188  flx = mf*valscal%vals(ivarscal,distscal*ifc)
189 
190  resscal(ivarscal,c1) = resscal(ivarscal,c1) + flx
191  END DO ! iVarScal
192  END IF ! mf
193  END DO ! ifc
194 
195 ! ==============================================================================
196 ! Injection
197 ! ==============================================================================
198 
199  CASE ( bc_injection )
200  DO ifc = 1,ppatch%nBFaces
201  c1 = ppatch%bf2c(ifc)
202 
203  mf = pmfmixt(ifc)
204 
205  DO ivarscal = 1,nvarscal
206  flx = mf*valscal%vals(ivarscal,distscal*ifc)
207 
208  resscal(ivarscal,c1) = resscal(ivarscal,c1) + flx
209  END DO ! iVarScal
210  END DO ! ifc
211 
212 ! ==============================================================================
213 ! Boundaries for which fluxes must not or need not be computed
214 ! ==============================================================================
215 
216  CASE ( bc_periodic, &
217  bc_symmetry, &
218  bc_virtual )
219 
220 ! ==============================================================================
221 ! Default
222 ! ==============================================================================
223 
224  CASE default
225  CALL errorstop(global,err_reached_default,__line__)
226  END SELECT ! bcType
227 
228 ! ******************************************************************************
229 ! End
230 ! ******************************************************************************
231 
232  CALL deregisterfunction(global)
233 
234 END SUBROUTINE rflu_scalarfirstpatch
235 
236 ! ******************************************************************************
237 !
238 ! RCS Revision history:
239 !
240 ! $Log: RFLU_ScalarFirstPatch.F90,v $
241 ! Revision 1.7 2008/12/06 08:44:12 mtcampbe
242 ! Updated license.
243 !
244 ! Revision 1.6 2008/11/19 22:17:26 mtcampbe
245 ! Added Illinois Open Source License/Copyright
246 !
247 ! Revision 1.5 2006/04/07 15:19:16 haselbac
248 ! Removed tabs
249 !
250 ! Revision 1.4 2006/03/25 21:43:47 haselbac
251 ! Added CASEs for sype patches
252 !
253 ! Revision 1.3 2005/11/10 02:03:16 haselbac
254 ! Added virtual boundary, cleaned up CASE statements
255 !
256 ! Revision 1.2 2005/04/20 14:40:15 haselbac
257 ! Removed CHECK_UNIFLOW code section, cosmetics
258 !
259 ! Revision 1.1 2004/01/29 22:56:10 haselbac
260 ! Initial revision
261 !
262 ! ******************************************************************************
263 
264 
265 
266 
267 
268 
269 
NT rhs
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflu_scalarfirstpatch(pRegion, pPatch, nVarScal, cvScal, valScal, resScal)