Loading...
Searching...
No Matches
StationaryPhaseModel.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2015-2018 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
29
30// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
31
32template<class BasePhaseModel>
33template<class Type, template<class> class PatchField, class GeoMesh>
35Foam::StationaryPhaseModel<BasePhaseModel>::zeroField
36(
37 const word& name,
38 const dimensionSet& dims,
39 const bool cache
40) const
41{
43 (
45 (
47 (
49 this->mesh().time().timeName(),
50 this->mesh()
51 ),
52 this->mesh(),
54 )
55 );
56}
57
58
59template<class BasePhaseModel>
60template<class Type>
62Foam::StationaryPhaseModel<BasePhaseModel>::zeroVolField
63(
64 const word& name,
65 const dimensionSet& dims,
66 const bool cache
67) const
68{
69 return zeroField<Type, fvPatchField, volMesh>(name, dims, cache);
70}
71
72
73template<class BasePhaseModel>
74template<class Type>
76Foam::StationaryPhaseModel<BasePhaseModel>::zeroSurfaceField
77(
78 const word& name,
79 const dimensionSet& dims,
80 const bool cache
81) const
82{
83 return zeroField<Type, fvsPatchField, surfaceMesh>(name, dims, cache);
84}
85
86
87// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
88
89template<class BasePhaseModel>
91(
92 const phaseSystem& fluid,
93 const word& phaseName,
94 const label index
95)
96:
97 BasePhaseModel(fluid, phaseName, index)
98{}
99
100
101// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
102
103template<class BasePhaseModel>
108// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109
110template<class BasePhaseModel>
113 return true;
114}
115
116
117template<class BasePhaseModel>
120{
122 << "Cannot construct a momentum equation for a stationary phase"
123 << exit(FatalError);
125 return nullptr;
126}
127
128
129template<class BasePhaseModel>
132{
134 << "Cannot construct a momentum equation for a stationary phase"
135 << exit(FatalError);
137 return nullptr;
138}
139
140
141template<class BasePhaseModel>
145 return zeroVolField<vector>("U", dimVelocity, true);
146}
147
148
149template<class BasePhaseModel>
152{
154 << "Cannot access the velocity of a stationary phase"
155 << exit(FatalError);
157 return volVectorField::null().constCast();
158}
159
160
161template<class BasePhaseModel>
165 return zeroSurfaceField<scalar>("phi", dimVolume/dimTime);
166}
167
168
169template<class BasePhaseModel>
172{
174 << "Cannot access the flux of a stationary phase"
175 << exit(FatalError);
177 return surfaceScalarField::null().constCast();
178}
179
180
181template<class BasePhaseModel>
185 return zeroSurfaceField<scalar>("alphaPhi", dimVolume/dimTime);
186}
187
188
189template<class BasePhaseModel>
192{
194 << "Cannot access the volumetric flux of a stationary phase"
195 << exit(FatalError);
197 return surfaceScalarField::null().constCast();
198}
199
200
201template<class BasePhaseModel>
205 return zeroSurfaceField<scalar>("alphaRhoPhi", dimMass/dimTime);
206}
207
208
209template<class BasePhaseModel>
212{
214 << "Cannot access the mass flux of a stationary phase"
215 << exit(FatalError);
217 return surfaceScalarField::null().constCast();
218}
219
220
221template<class BasePhaseModel>
225 return zeroVolField<vector>("DUDt", dimVelocity/dimTime);
226}
227
228
229template<class BasePhaseModel>
233 return zeroSurfaceField<scalar>("DUDtf", dimVelocity*dimArea/dimTime);
234}
235
236
237template<class BasePhaseModel>
241 return zeroVolField<scalar>("continuityError", dimDensity/dimTime);
242}
243
244
245template<class BasePhaseModel>
249 return zeroVolField<scalar>("continuityErrorFlow", dimDensity/dimTime);
250}
251
252
253template<class BasePhaseModel>
257 return zeroVolField<scalar>("continuityErrorSources", dimDensity/dimTime);
258}
259
260
261template<class BasePhaseModel>
265 return zeroVolField<scalar>("K", sqr(dimVelocity));
266}
267
268
269template<class BasePhaseModel>
272{
273 return nullptr;
274}
275
276
277template<class BasePhaseModel>
279(
281)
282{
284 << "Cannot set the dilatation rate of a stationary phase"
285 << exit(FatalError);
286}
287
288
289template<class BasePhaseModel>
293 return zeroVolField<scalar>("continuityError", dimDynamicViscosity);
294}
295
296
297template<class BasePhaseModel>
301 return this->thermo().mu();
302}
303
304
305template<class BasePhaseModel>
309 return zeroVolField<scalar>("continuityError", dimViscosity);
310}
311
312
313template<class BasePhaseModel>
317 return this->thermo().nu();
318}
319
320
321template<class BasePhaseModel>
325 return this->thermo().kappa();
326}
327
328
329template<class BasePhaseModel>
333 return this->thermo().kappa(patchi);
334}
335
336
337template<class BasePhaseModel>
341 return this->thermo().alpha();
342}
343
344
345template<class BasePhaseModel>
349 return this->thermo().alpha(patchi);
350}
351
352
353template<class BasePhaseModel>
357 return zeroVolField<scalar>("k", sqr(dimVelocity));
358}
359
360
361template<class BasePhaseModel>
364{
365 return zeroVolField<scalar>("pPrime", dimPressure);
366}
367
368
369// ************************************************************************* //
twoPhaseSystem & fluid
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition GeoMesh.H:46
Generic GeometricField class.
this_type & constCast() const noexcept
Return non-const reference to this field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
virtual tmp< volScalarField > continuityErrorSources() const
Return the continuity error due to any sources.
virtual tmp< fvVectorMatrix > UEqn()
Return the momentum equation.
virtual tmp< surfaceScalarField > DUDtf() const
Return the substantive acceleration on the faces.
virtual tmp< volScalarField > muEff() const
Return the effective dynamic viscosity.
virtual tmp< volScalarField > k() const
Return the turbulent kinetic energy.
StationaryPhaseModel(const phaseSystem &fluid, const word &phaseName, const label index)
virtual tmp< volVectorField > U() const
Return the velocity.
virtual tmp< volScalarField > mut() const
Return the turbulent dynamic viscosity.
virtual surfaceScalarField & alphaRhoPhiRef()
Access the mass flux of the phase.
virtual surfaceScalarField & phiRef()
Access the volumetric flux.
virtual tmp< volScalarField > alphaEff() const
Return the effective thermal diffusivity.
virtual tmp< surfaceScalarField > alphaPhi() const
Return the volumetric flux of the phase.
virtual tmp< volScalarField > K() const
Return the phase kinetic energy.
virtual tmp< volScalarField > pPrime() const
Return the phase-pressure'.
virtual tmp< volScalarField > continuityErrorFlow() const
Return the continuity error due to the flow field.
virtual tmp< volScalarField > nuEff() const
Return the effective kinematic viscosity.
virtual ~StationaryPhaseModel()
Destructor.
virtual tmp< volScalarField > divU() const
Return the phase dilatation rate (d(alpha)/dt + div(alpha*phi)).
virtual surfaceScalarField & alphaPhiRef()
Access the volumetric flux of the phase.
virtual tmp< surfaceScalarField > alphaRhoPhi() const
Return the mass flux of the phase.
virtual tmp< surfaceScalarField > phi() const
Return the volumetric flux.
virtual tmp< fvVectorMatrix > UfEqn()
Return the momentum equation for the face-based algorithm.
virtual tmp< volScalarField > nut() const
Return the turbulent kinematic viscosity.
virtual volVectorField & URef()
Access the velocity.
virtual tmp< volVectorField > DUDt() const
Return the substantive acceleration.
virtual tmp< volScalarField > kappaEff() const
Return the effective thermal conductivity.
virtual bool stationary() const
Return whether the phase is stationary.
virtual tmp< volScalarField > continuityError() const
Return the continuity error.
virtual tmp< volScalarField > kappa() const =0
Thermal diffusivity for temperature of mixture [J/m/s/K].
virtual const volScalarField & alpha() const
Thermal diffusivity for enthalpy of mixture [kg/m/s].
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Generic dimensioned Type class.
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].
Definition fluidThermo.C:96
Class to represent a system of phases and model interfacial transfers between them.
Definition phaseSystem.H:72
virtual tmp< volScalarField > mu() const
Dynamic viscosity of mixture [kg/m/s].
Definition psiThermo.C:175
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
auto & name
zeroField divU
Definition alphaSuSp.H:3
word timeName
Definition getTimeIndex.H:3
const dimensionSet dimPressure
const dimensionSet dimViscosity
GeometricField< vector, fvPatchField, volMesh > volVectorField
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
const dimensionSet dimArea(sqr(dimLength))
const dimensionSet dimVelocity
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
const dimensionSet dimDynamicViscosity
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const dimensionSet dimVolume(pow3(dimLength))
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
const dimensionSet dimDensity
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
psiReactionThermo & thermo