1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Single level numeric flux class for density-based solvers
32 Rewrite by Hrvoje Jasak
38 \*---------------------------------------------------------------------------*/
43 #include "numericFluxBase.H"
44 #include "basicThermo.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 /*---------------------------------------------------------------------------*\
52 Class numericFlux Declaration
53 \*---------------------------------------------------------------------------*/
55 template<class Flux, class Limiter>
58 public numericFluxBase<Flux>
66 // Reference to primitive fields
69 const volScalarField& p_;
72 const volVectorField& U_;
74 //- Static temperature
75 const volScalarField& T_;
77 //- Reference to the thermophysicalModel
84 surfaceScalarField rhoFlux_;
87 surfaceVectorField rhoUFlux_;
90 surfaceScalarField rhoEFlux_;
95 //- Static pressure gradient
96 volVectorField gradP_;
99 volTensorField gradU_;
101 //- Static temperature gradient
102 volVectorField gradT_;
105 // Private Member Functions
107 //- Disallow default bitwise copy construct
108 numericFlux(const numericFlux&);
110 //- Disallow default bitwise assignment
111 void operator=(const numericFlux&);
114 //- Return internal field of mass flux
115 const scalarField& rhoFluxI() const
117 return rhoFlux_.internalField();
120 //- Return access to internal field of mass flux
121 scalarField& rhoFluxI()
123 return rhoFlux_.internalField();
126 //- Return internal field of momentum flux
127 const vectorField& rhoUFluxI() const
129 return rhoUFlux_.internalField();
132 //- Return access to internal field of momentum flux
133 vectorField& rhoUFluxI()
135 return rhoUFlux_.internalField();
138 //- Return access to internal field of energy flux
139 const scalarField& rhoEFluxI() const
141 return rhoEFlux_.internalField();
144 //- Return access to internal field of energy flux
145 scalarField& rhoEFluxI()
147 return rhoEFlux_.internalField();
155 //- Construct from components
158 const volScalarField& p,
159 const volVectorField& U,
160 const volScalarField& T,
166 virtual ~numericFlux()
172 //- Return mesh reference
173 const fvMesh& mesh() const
181 //- Return density flux
182 virtual const surfaceScalarField& rhoFlux() const
187 //- Return velocity flux
188 virtual const surfaceVectorField& rhoUFlux() const
193 //- Return energy flux
194 virtual const surfaceScalarField& rhoEFlux() const
202 //- Return density equation residual
203 virtual tmp<scalarField> rhoResidual() const
205 return fvc::div(rhoFlux_)().internalField();
208 //- Return momentum equation flux
209 virtual tmp<vectorField> rhoUResidual() const
211 return fvc::div(rhoUFlux_)().internalField();
214 //- Return energy equation flux
215 virtual tmp<scalarField> rhoEResidual() const
217 return fvc::div(rhoEFlux_)().internalField();
223 //- Return pressure gradient
224 const volVectorField& gradP() const
229 //- Return pressure gradient
230 const volTensorField& gradU() const
235 //- Return Temperature gradient
236 const volVectorField& gradT() const
242 // Update fluxes based on current state
245 virtual void computeFlux();
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 } // End namespace Foam
254 # include "numericFlux.C"
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 // ************************************************************************* //