Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ScalarFirst.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 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to region data
31 ! nVarScal Number of scalar variables
32 ! cvScal Conserved scalar variables
33 ! resScal Residual due to central scalar fluxes
34 !
35 ! Output: None.
36 !
37 ! Notes: None.
38 !
39 !******************************************************************************
40 !
41 ! $Id: RFLU_ScalarFirst.F90,v 1.4 2008/12/06 08:44:12 mtcampbe Exp $
42 !
43 ! Copyright: (c) 2004 by the University of Illinois
44 !
45 !******************************************************************************
46 
47 SUBROUTINE rflu_scalarfirst(pRegion,nVarScal,cvScal,resScal)
48 
49  USE moddatatypes
50  USE modglobal, ONLY: t_global
51  USE moddatastruct, ONLY: t_region
52  USE modgrid, ONLY: t_grid
53  USE moderror
54  USE modparameters
55 
56  IMPLICIT NONE
57 
58 ! *****************************************************************************
59 ! Definitions and declarations
60 ! *****************************************************************************
61 
62 ! =============================================================================
63 ! Arguments
64 ! =============================================================================
65 
66  INTEGER, INTENT(IN) :: nvarscal
67  REAL(RFREAL), DIMENSION(:,:), INTENT(IN) :: cvscal
68  REAL(RFREAL), DIMENSION(:,:), INTENT(INOUT) :: resscal
69  TYPE(t_region), POINTER :: pregion
70 
71 ! =============================================================================
72 ! Locals
73 ! =============================================================================
74 
75  CHARACTER(CHRLEN) :: rcsidentstring
76  INTEGER :: c1,c2,ifc,ivarscal
77  REAL(RFREAL) :: flx,mf,mfn,mfp,sl,sr
78  REAL(RFREAL), DIMENSION(:), POINTER :: pmf
79  TYPE(t_global), POINTER :: global
80  TYPE(t_grid), POINTER :: pgrid
81 
82 ! *****************************************************************************
83 ! Start
84 ! *****************************************************************************
85 
86  rcsidentstring = '$RCSfile: RFLU_ScalarFirst.F90,v $ $Revision: 1.4 $'
87 
88  global => pregion%global
89 
90  CALL registerfunction(global,'RFLU_ScalarFirst',&
91  'RFLU_ScalarFirst.F90')
92 
93 ! *****************************************************************************
94 ! Checks: Defensive coding, should never occur
95 ! *****************************************************************************
96 
97  IF ( pregion%mixtInput%indMfMixt /= 1 ) THEN
98  CALL errorstop(global,err_indmfmixt_invalid,__line__)
99  END IF ! pRegion%mixtInput%indMfMixt
100 
101 ! *****************************************************************************
102 ! Set dimensions and pointers
103 ! *****************************************************************************
104 
105  pgrid => pregion%grid
106  pmf => pregion%mixt%mfMixt
107 
108 ! *****************************************************************************
109 ! Compute fluxes
110 ! *****************************************************************************
111 
112  DO ifc = 1,pgrid%nFaces
113  c1 = pgrid%f2c(1,ifc)
114  c2 = pgrid%f2c(2,ifc)
115 
116 ! =============================================================================
117 ! Get mass flux
118 ! =============================================================================
119 
120  mf = pmf(ifc)
121  mfp = max(mf,0.0_rfreal)
122  mfn = min(mf,0.0_rfreal)
123 
124 ! =============================================================================
125 ! Compute flux and accumulate into residual
126 ! =============================================================================
127 
128  DO ivarscal = 1,nvarscal
129  sl = cvscal(ivarscal,c1)
130  sr = cvscal(ivarscal,c2)
131 
132  flx = mfp*sl + mfn*sr
133 
134  resscal(ivarscal,c1) = resscal(ivarscal,c1) + flx
135  resscal(ivarscal,c2) = resscal(ivarscal,c2) - flx
136  END DO ! iVarScal
137  END DO ! ifc
138 
139 ! *****************************************************************************
140 ! End
141 ! *****************************************************************************
142 
143  CALL deregisterfunction(global)
144 
145 END SUBROUTINE rflu_scalarfirst
146 
147 !******************************************************************************
148 !
149 ! RCS Revision history:
150 !
151 ! $Log: RFLU_ScalarFirst.F90,v $
152 ! Revision 1.4 2008/12/06 08:44:12 mtcampbe
153 ! Updated license.
154 !
155 ! Revision 1.3 2008/11/19 22:17:26 mtcampbe
156 ! Added Illinois Open Source License/Copyright
157 !
158 ! Revision 1.2 2006/04/07 15:19:16 haselbac
159 ! Removed tabs
160 !
161 ! Revision 1.1 2004/01/29 22:56:07 haselbac
162 ! Initial revision
163 !
164 !******************************************************************************
165 
166 
167 
168 
169 
170 
171 
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflu_scalarfirst(pRegion, nVarScal, cvScal, resScal)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469