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 -------------------------------------------------------------------------------
10 License
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 
28 #include "StationaryPhaseModel.H"
29 
30 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
31 
32 template<class BasePhaseModel>
33 template<class Type, template<class> class PatchField, class GeoMesh>
36 (
37  const word& name,
38  const dimensionSet& dims,
39  const bool cache
40 ) const
41 {
43  (
45  (
46  IOobject
47  (
48  IOobject::groupName(name, this->name()),
49  this->mesh().time().timeName(),
50  this->mesh()
51  ),
52  this->mesh(),
53  dimensioned<Type>(dims, Zero)
54  )
55  );
56 }
57 
58 
59 template<class BasePhaseModel>
60 template<class Type>
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 
73 template<class BasePhaseModel>
74 template<class Type>
77 (
78  const word& name,
79  const dimensionSet& dims,
80  const bool cache
81 ) const
82 {
84 }
85 
86 
87 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
88 
89 template<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 
103 template<class BasePhaseModel>
105 {}
106 
107 
108 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109 
110 template<class BasePhaseModel>
112 {
113  return true;
114 }
115 
116 
117 template<class BasePhaseModel>
120 {
122  << "Cannot construct a momentum equation for a stationary phase"
123  << exit(FatalError);
124 
125  return tmp<fvVectorMatrix>();
126 }
127 
128 
129 template<class BasePhaseModel>
132 {
134  << "Cannot construct a momentum equation for a stationary phase"
135  << exit(FatalError);
136 
137  return tmp<fvVectorMatrix>();
138 }
139 
140 
141 template<class BasePhaseModel>
144 {
145  return zeroVolField<vector>("U", dimVelocity, true);
146 }
147 
148 
149 template<class BasePhaseModel>
152 {
154  << "Cannot access the velocity of a stationary phase"
155  << exit(FatalError);
156 
157  return const_cast<volVectorField&>(volVectorField::null());
158 }
159 
160 
161 template<class BasePhaseModel>
164 {
165  return zeroSurfaceField<scalar>("phi", dimVolume/dimTime);
166 }
167 
168 
169 template<class BasePhaseModel>
172 {
174  << "Cannot access the flux of a stationary phase"
175  << exit(FatalError);
176 
177  return const_cast<surfaceScalarField&>(surfaceScalarField::null());
178 }
179 
180 
181 template<class BasePhaseModel>
184 {
185  return zeroSurfaceField<scalar>("alphaPhi", dimVolume/dimTime);
186 }
187 
188 
189 template<class BasePhaseModel>
192 {
194  << "Cannot access the volumetric flux of a stationary phase"
195  << exit(FatalError);
196 
197  return const_cast<surfaceScalarField&>(surfaceScalarField::null());
198 }
199 
200 
201 template<class BasePhaseModel>
204 {
205  return zeroSurfaceField<scalar>("alphaRhoPhi", dimMass/dimTime);
206 }
207 
208 
209 template<class BasePhaseModel>
212 {
214  << "Cannot access the mass flux of a stationary phase"
215  << exit(FatalError);
216 
217  return const_cast<surfaceScalarField&>(surfaceScalarField::null());
218 }
219 
220 
221 template<class BasePhaseModel>
224 {
225  return zeroVolField<vector>("DUDt", dimVelocity/dimTime);
226 }
227 
228 
229 template<class BasePhaseModel>
232 {
233  return zeroSurfaceField<scalar>("DUDtf", dimVelocity*dimArea/dimTime);
234 }
235 
236 
237 template<class BasePhaseModel>
240 {
241  return zeroVolField<scalar>("continuityError", dimDensity/dimTime);
242 }
243 
244 
245 template<class BasePhaseModel>
248 {
249  return zeroVolField<scalar>("continuityErrorFlow", dimDensity/dimTime);
250 }
251 
252 
253 template<class BasePhaseModel>
256 {
257  return zeroVolField<scalar>("continuityErrorSources", dimDensity/dimTime);
258 }
259 
260 
261 template<class BasePhaseModel>
264 {
265  return zeroVolField<scalar>("K", sqr(dimVelocity));
266 }
267 
268 
269 template<class BasePhaseModel>
272 {
273  return tmp<volScalarField>();
274 }
275 
276 
277 template<class BasePhaseModel>
279 (
281 )
282 {
284  << "Cannot set the dilatation rate of a stationary phase"
285  << exit(FatalError);
286 }
287 
288 
289 template<class BasePhaseModel>
292 {
293  return zeroVolField<scalar>("continuityError", dimDynamicViscosity);
294 }
295 
296 
297 template<class BasePhaseModel>
300 {
301  return this->thermo().mu();
302 }
303 
304 
305 template<class BasePhaseModel>
308 {
309  return zeroVolField<scalar>("continuityError", dimViscosity);
310 }
311 
312 
313 template<class BasePhaseModel>
316 {
317  return this->thermo().nu();
318 }
319 
320 
321 template<class BasePhaseModel>
324 {
325  return this->thermo().kappa();
326 }
327 
328 
329 template<class BasePhaseModel>
332 {
333  return this->thermo().kappa(patchi);
334 }
335 
336 
337 template<class BasePhaseModel>
340 {
341  return this->thermo().alpha();
342 }
343 
344 
345 template<class BasePhaseModel>
348 {
349  return this->thermo().alpha(patchi);
350 }
351 
352 
353 template<class BasePhaseModel>
356 {
357  return zeroVolField<scalar>("k", sqr(dimVelocity));
358 }
359 
360 
361 template<class BasePhaseModel>
364 {
365  return zeroVolField<scalar>("pPrime", dimPressure);
366 }
367 
368 
369 // ************************************************************************* //
Foam::StationaryPhaseModel::continuityErrorFlow
virtual tmp< volScalarField > continuityErrorFlow() const
Return the continuity error due to the flow field.
Definition: StationaryPhaseModel.C:247
Foam::StationaryPhaseModel::alphaPhiRef
virtual surfaceScalarField & alphaPhiRef()
Access the volumetric flux of the phase.
Definition: StationaryPhaseModel.C:191
Foam::dimPressure
const dimensionSet dimPressure
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::StationaryPhaseModel::pPrime
virtual tmp< volScalarField > pPrime() const
Return the phase-pressure'.
Definition: StationaryPhaseModel.C:363
Foam::StationaryPhaseModel::~StationaryPhaseModel
virtual ~StationaryPhaseModel()
Destructor.
Definition: StationaryPhaseModel.C:104
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::StationaryPhaseModel::stationary
virtual bool stationary() const
Return whether the phase is stationary.
Definition: StationaryPhaseModel.C:111
Foam::StationaryPhaseModel::alphaRhoPhi
virtual tmp< surfaceScalarField > alphaRhoPhi() const
Return the mass flux of the phase.
Definition: StationaryPhaseModel.C:203
Foam::StationaryPhaseModel::DUDtf
virtual tmp< surfaceScalarField > DUDtf() const
Return the substantive acceleration on the faces.
Definition: StationaryPhaseModel.C:231
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::StationaryPhaseModel::U
virtual tmp< volVectorField > U() const
Return the velocity.
Definition: StationaryPhaseModel.C:143
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::dimVelocity
const dimensionSet dimVelocity
Foam::dimDensity
const dimensionSet dimDensity
thermo
psiReactionThermo & thermo
Definition: createFields.H:28
Foam::zeroField
A class representing the concept of a field of 0 used to avoid unnecessary manipulations for objects ...
Definition: zeroField.H:53
Foam::StationaryPhaseModel::nut
virtual tmp< volScalarField > nut() const
Return the turbulent kinematic viscosity.
Definition: StationaryPhaseModel.C:307
Foam::StationaryPhaseModel::kappaEff
virtual tmp< volScalarField > kappaEff() const
Return the effective thermal conductivity.
Definition: StationaryPhaseModel.C:323
Foam::dimensionSet
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:108
fluid
twoPhaseSystem & fluid
Definition: setRegionFluidFields.H:3
Foam::StationaryPhaseModel::alphaPhi
virtual tmp< surfaceScalarField > alphaPhi() const
Return the volumetric flux of the phase.
Definition: StationaryPhaseModel.C:183
Foam::StationaryPhaseModel::mut
virtual tmp< volScalarField > mut() const
Return the turbulent dynamic viscosity.
Definition: StationaryPhaseModel.C:291
StationaryPhaseModel.H
Foam::StationaryPhaseModel::phi
virtual tmp< surfaceScalarField > phi() const
Return the volumetric flux.
Definition: StationaryPhaseModel.C:163
Foam::StationaryPhaseModel::StationaryPhaseModel
StationaryPhaseModel(const phaseSystem &fluid, const word &phaseName, const label index)
Definition: StationaryPhaseModel.C:91
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::StationaryPhaseModel::UfEqn
virtual tmp< fvVectorMatrix > UfEqn()
Return the momentum equation for the face-based algorithm.
Definition: StationaryPhaseModel.C:131
Foam::StationaryPhaseModel::divU
virtual tmp< volScalarField > divU() const
Return the phase dilatation rate (d(alpha)/dt + div(alpha*phi))
Definition: StationaryPhaseModel.C:271
Foam::dimArea
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:59
Foam::StationaryPhaseModel
Class which represents a stationary (and therefore probably solid) phase. Generates,...
Definition: StationaryPhaseModel.H:58
Foam::StationaryPhaseModel::alphaEff
virtual tmp< volScalarField > alphaEff() const
Return the effective thermal diffusivity.
Definition: StationaryPhaseModel.C:339
divU
zeroField divU
Definition: alphaSuSp.H:3
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::dimViscosity
const dimensionSet dimViscosity
Foam::FatalError
error FatalError
Foam::dimDynamicViscosity
const dimensionSet dimDynamicViscosity
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
Foam::StationaryPhaseModel::k
virtual tmp< volScalarField > k() const
Return the turbulent kinetic energy.
Definition: StationaryPhaseModel.C:355
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::StationaryPhaseModel::URef
virtual volVectorField & URef()
Access the velocity.
Definition: StationaryPhaseModel.C:151
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::StationaryPhaseModel::DUDt
virtual tmp< volVectorField > DUDt() const
Return the substantive acceleration.
Definition: StationaryPhaseModel.C:223
Foam::StationaryPhaseModel::continuityError
virtual tmp< volScalarField > continuityError() const
Return the continuity error.
Definition: StationaryPhaseModel.C:239
Foam::StationaryPhaseModel::muEff
virtual tmp< volScalarField > muEff() const
Return the effective dynamic viscosity.
Definition: StationaryPhaseModel.C:299
Foam::StationaryPhaseModel::phiRef
virtual surfaceScalarField & phiRef()
Access the volumetric flux.
Definition: StationaryPhaseModel.C:171
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::StationaryPhaseModel::continuityErrorSources
virtual tmp< volScalarField > continuityErrorSources() const
Return the continuity error due to any sources.
Definition: StationaryPhaseModel.C:255
Foam::phaseSystem
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:66
Foam::StationaryPhaseModel::UEqn
virtual tmp< fvVectorMatrix > UEqn()
Return the momentum equation.
Definition: StationaryPhaseModel.C:119
Foam::StationaryPhaseModel::K
virtual tmp< volScalarField > K() const
Return the phase kinetic energy.
Definition: StationaryPhaseModel.C:263
Foam::dimVolume
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:60
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::StationaryPhaseModel::nuEff
virtual tmp< volScalarField > nuEff() const
Return the effective kinematic viscosity.
Definition: StationaryPhaseModel.C:315
Foam::StationaryPhaseModel::alphaRhoPhiRef
virtual surfaceScalarField & alphaRhoPhiRef()
Access the mass flux of the phase.
Definition: StationaryPhaseModel.C:211