Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ScalarViscousFluxes.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 viscous fluxes of scalar for actual faces.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to region
31 ! nVarScal Number of scalar variables
32 ! tvScal Scalar transport variables
33 ! gradScal Scalar face gradients
34 ! resScal Scalar residuals
35 !
36 ! Output: None.
37 !
38 ! Notes:
39 ! 1. The viscosity must be a dynamic viscosity!
40 !
41 !******************************************************************************
42 !
43 ! $Id: RFLU_ScalarViscousFluxes.F90,v 1.4 2008/12/06 08:44:13 mtcampbe Exp $
44 !
45 ! Copyright: (c) 2004 by the University of Illinois
46 !
47 !******************************************************************************
48 
49 SUBROUTINE rflu_scalarviscousfluxes(pRegion,nVarScal,tvScal,gradScal,resScal)
50 
51  USE moddatatypes
52  USE modparameters
53  USE moderror
54  USE modglobal, ONLY: t_global
55  USE moddatastruct, ONLY: t_region
56  USE modgrid, ONLY: t_grid
57 
58  IMPLICIT NONE
59 
60 ! *****************************************************************************
61 ! Declarations
62 ! *****************************************************************************
63 
64 ! =============================================================================
65 ! Arguments
66 ! =============================================================================
67 
68  INTEGER, INTENT(IN) :: nvarscal
69  REAL(RFREAL), DIMENSION(:,:), INTENT(IN) :: tvscal
70  REAL(RFREAL), DIMENSION(:,:), INTENT(INOUT) :: resscal
71  REAL(RFREAL), DIMENSION(:,:,:), INTENT(IN) :: gradscal
72  TYPE(t_region), POINTER :: pregion
73 
74 ! =============================================================================
75 ! Locals
76 ! =============================================================================
77 
78  CHARACTER(CHRLEN) :: rcsidentstring
79  INTEGER :: c1,c2,ifg,ivarscal
80  REAL(RFREAL) :: beta,flx,mu,nm,nx,ny,nz
81  TYPE(t_global), POINTER :: global
82  TYPE(t_grid), POINTER :: pgrid
83 
84 ! *****************************************************************************
85 ! Start
86 ! *****************************************************************************
87 
88  rcsidentstring = '$RCSfile: RFLU_ScalarViscousFluxes.F90,v $ $Revision: 1.4 $'
89 
90  global => pregion%global
91 
92  CALL registerfunction(global,'RFLU_ScalarViscousFluxes',&
93  'RFLU_ScalarViscousFluxes.F90')
94 
95 ! *****************************************************************************
96 ! Set variables and pointers
97 ! *****************************************************************************
98 
99  pgrid => pregion%grid
100 
101  beta = pregion%mixtInput%betrk(pregion%irkStep)
102 
103 ! *****************************************************************************
104 ! Loop over faces and compute viscous fluxes
105 ! *****************************************************************************
106 
107  DO ifg = 1,pgrid%nFaces
108  c1 = pgrid%f2c(1,ifg)
109  c2 = pgrid%f2c(2,ifg)
110 
111 ! =============================================================================
112 ! Get face geometry
113 ! =============================================================================
114 
115  nx = pgrid%fn(xcoord,ifg)
116  ny = pgrid%fn(ycoord,ifg)
117  nz = pgrid%fn(zcoord,ifg)
118  nm = pgrid%fn(xyzmag,ifg)
119 
120 ! =============================================================================
121 ! Get face state. NOTE this simple average is not accurate for non-uniform
122 ! grids, so this will have to be replaced by a proper interpolation.
123 ! =============================================================================
124 
125  DO ivarscal = 1,nvarscal
126  mu = 0.5_rfreal*(tvscal(ivarscal,c1) + tvscal(ivarscal,c2))
127 
128 ! -----------------------------------------------------------------------------
129 ! Compute fluxes
130 ! -----------------------------------------------------------------------------
131 
132  flx = mu*( gradscal(xcoord,ivarscal,ifg)*nx &
133  + gradscal(ycoord,ivarscal,ifg)*ny &
134  + gradscal(zcoord,ivarscal,ifg)*nz)*nm
135 
136 ! -----------------------------------------------------------------------------
137 ! Accumulate into residual
138 ! -----------------------------------------------------------------------------
139 
140  resscal(ivarscal,c1) = resscal(ivarscal,c1) + beta*flx
141  resscal(ivarscal,c2) = resscal(ivarscal,c2) - beta*flx
142  END DO ! iVarScal
143  END DO ! ifg
144 
145 ! *****************************************************************************
146 ! End
147 ! *****************************************************************************
148 
149  CALL deregisterfunction(global)
150 
151 END SUBROUTINE rflu_scalarviscousfluxes
152 
153 !******************************************************************************
154 !
155 ! RCS Revision history:
156 !
157 ! $Log: RFLU_ScalarViscousFluxes.F90,v $
158 ! Revision 1.4 2008/12/06 08:44:13 mtcampbe
159 ! Updated license.
160 !
161 ! Revision 1.3 2008/11/19 22:17:26 mtcampbe
162 ! Added Illinois Open Source License/Copyright
163 !
164 ! Revision 1.2 2006/04/07 15:19:16 haselbac
165 ! Removed tabs
166 !
167 ! Revision 1.1 2004/01/29 22:56:17 haselbac
168 ! Initial revision
169 !
170 !******************************************************************************
171 
172 
173 
174 
175 
176 
177 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflu_scalarviscousfluxes(pRegion, nVarScal, tvScal, gradScal, resScal)
subroutine deregisterfunction(global)
Definition: ModError.F90:469