phaseModel.H
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) 2017-2021 OpenCFD Ltd.
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 Class
27  Foam::phaseModel
28 
29 Description
30 
31 SourceFiles
32  phaseModel.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef phaseModel_H
37 #define phaseModel_H
38 
39 #include "dictionary.H"
40 #include "dimensionedScalar.H"
41 #include "volFields.H"
42 #include "surfaceFields.H"
43 #include "fvMatricesFwd.H"
44 #include "runTimeSelectionTables.H"
45 #include "rhoThermo.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward Declarations
53 class phaseSystem;
54 
55 /*---------------------------------------------------------------------------*\
56  Class phaseModel Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class phaseModel
60 :
61  public volScalarField
62 {
63  // Private Data
64 
65  //- Reference to the phaseSystem to which this phase belongs
66  const phaseSystem& fluid_;
67 
68  //- Name of phase
69  word name_;
70 
71 
72 public:
73 
74  //- Runtime type information
75  ClassName("phaseModel");
76 
77  // Declare runtime construction
79  (
80  autoPtr,
81  phaseModel,
82  phaseSystem,
83  (
84  const phaseSystem& fluid,
85  const word& phaseName
86  ),
87  (fluid, phaseName)
88  );
89 
90 
91  // Constructors
92 
93  //- Construct from phaseSystem and phaseName
94  phaseModel(const phaseSystem& fluid, const word& phaseName);
95 
96 
97  //- Destructor
98  virtual ~phaseModel() = default;
99 
100 
101  // Selectors
102 
103  static autoPtr<phaseModel> New
104  (
105  const phaseSystem& fluid,
106  const word& phaseName
107  );
108 
109 
110  // Member Functions
111 
112  //- The name of this phase
113  const word& name() const
114  {
115  return name_;
116  }
117 
118  //- Return the system to which this phase belongs
119  const phaseSystem& fluid() const;
120 
121  //- Correct phase thermo
122  virtual void correct();
123 
124  //- Correct the turbulence
125  virtual void correctTurbulence();
126 
127  //- Solve species fraction equation
128  virtual void solveYi
129  (
132  ) = 0;
133 
134  //- Read phase properties dictionary
135  virtual bool read();
136 
137 
138  // Thermo
139 
140  //- Access const to phase thermo
141  virtual const rhoThermo& thermo() const = 0;
142 
143  //- Access to phase thermo
144  virtual rhoThermo& thermo() = 0;
145 
146  //- Return the phase density
147  tmp<volScalarField> rho() const;
148 
149  //- Return phase density on a patch
150  tmp<scalarField> rho(const label patchi) const;
151 
152  //- Chemical enthalpy for phase [J/kg]
153  tmp<volScalarField> hc() const;
154 
155  //- Return phase Cp
156  tmp<volScalarField> Cp() const;
157 
158  //- Heat capacity of the phase at constant pressure for patch
159  // [J/kg/K]
161  (
162  const scalarField& p,
163  const scalarField& T,
164  const label patchi
165  ) const;
166 
167  //- Return Cv of the phase
168  tmp<volScalarField> Cv() const;
169 
170  //- Heat capacity at constant volume for phase for a patch [J/kg/K]
172  (
173  const scalarField& p,
174  const scalarField& T,
175  const label patchI
176  ) const;
177 
178  //- Gamma = Cp/Cv of phase[]
179  tmp<volScalarField> gamma() const;
180 
181  //- Gamma = Cp/Cv for phase on patch []
183  (
184  const scalarField& p,
185  const scalarField& T,
186  const label patchi
187  ) const;
188 
189  //- Heat capacity at constant pressure/volume for phase [J/kg/K]
190  tmp<volScalarField> Cpv() const;
191 
192  //- Heat capacity at constant pressure/volume for phase at patch
193  // [J/kg/K]
195  (
196  const scalarField& p,
197  const scalarField& T,
198  const label patchi
199  ) const;
200 
201  //- Heat capacity ratio for phase []
203 
204  //- Heat capacity ratio for phase at patch []
206  (
207  const scalarField& p,
208  const scalarField& T,
209  const label patchi
210  ) const;
211 
212  //- Query thermo for dpdt
213  bool dpdt() const
214  {
215  return thermo().dpdt();
216  }
217 
218 
219  // Transport
220 
221  //- Thermal diffusivity for enthalpy of mixture [kg/m/s]
222  const volScalarField& alpha() const;
223 
224  //- Thermal diffusivity for enthalpy of mixture for patch [kg/m/s]
225  const scalarField& alpha(const label patchi) const;
226 
227  //- Thermal diffusivity for temperature of phase [J/m/s/K]
228  tmp<volScalarField> kappa() const;
229 
230  //- Thermal diffusivity for temperature of phase for patch [J/m/s/K]
231  tmp<scalarField> kappa(const label patchi) const;
232 
233  //- Thermal diffusivity for energy of mixture [kg/m/s]
235 
236  //- Thermal diffusivity for energy of mixture for patch [kg/m/s]
237  tmp<scalarField> alphahe(const label patchi) const;
238 
239  //- Effective thermal diffusivity for temperature of phase [J/m/s/K]
241 
242  //- Effective thermal diffusivity for temperature
243  // of phase for patch [J/m/s/K]
245  (
246  const scalarField& alphat,
247  const label patchi
248  ) const;
249 
250  //- Effective thermal diffusivity of phase [kg/m/s]
251  tmp<volScalarField> alphaEff(const volScalarField& alphat) const;
252 
253  //- Effective thermal diffusivity of phase for patch [kg/m/s]
255  (
256  const scalarField& alphat,
257  const label patchi
258  ) const;
259 
260  //- Return the mixture kinematic viscosity
261  virtual tmp<volScalarField> nu() const;
262 
263  //- Return the mixture kinematic viscosity on patchi
264  virtual tmp<scalarField> nu(const label patchi) const;
265 
266  //- Return the mixture dymanic viscosity
267  virtual tmp<volScalarField> mu() const;
268 
269  //- Return the mixture dymanic viscosity on patchi
270  virtual tmp<scalarField> mu(const label patchi) const;
271 
272  //- Diffusion number
273  virtual tmp<surfaceScalarField> diffNo() const = 0;
274 
275 
276  // Species
277 
278  //- Constant access the species mass fractions
279  virtual const PtrList<volScalarField>& Y() const = 0;
280 
281  //- Access the species mass fractions
282  virtual PtrList<volScalarField>& Y() = 0;
283 
284 
285  // Momentum
286 
287  //- Constant access the volumetric flux
288  virtual tmp<surfaceScalarField> phi() const = 0;
289 
290  //- Access the volumetric flux
291  virtual const surfaceScalarField& phi() = 0;
292 
293  //- Constant access the volumetric flux of the phase
294  virtual tmp<surfaceScalarField> alphaPhi() const = 0;
295 
296  //- Access the volumetric flux of the phase
297  virtual surfaceScalarField& alphaPhi() = 0;
298 
299  //- Access const reference to U
300  virtual tmp<volVectorField> U() const = 0;
301 
302 
303  // Turbulence (WIP: possible to add turbulence on each phase)
304 
305  /*
306  //- Return the turbulent dynamic viscosity
307  virtual tmp<volScalarField> mut() const = 0;
308 
309  //- Return the turbulent dynamic viscosity on a patch
310  virtual tmp<scalarField> mut(const label patchI) const = 0;
311 
312  //- Return the turbulent kinematic viscosity
313  virtual tmp<volScalarField> nut() const = 0;
314 
315  //- Return the turbulent kinematic viscosity on a patch
316  virtual tmp<scalarField> nut(const label patchI) const = 0;
317 
318  //- Return the kinetic pressure derivative w.r.t. volume fraction
319  virtual tmp<volScalarField> pPrime() const = 0;
320 
321  //- Return the turbulent kinetic energy
322  virtual tmp<volScalarField> k() const = 0;
323  */
324 };
325 
326 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
327 
328 } // End namespace Foam
329 
330 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
331 
332 
333 #endif
334 
335 // ************************************************************************* //
Foam::phaseModel::mu
virtual tmp< volScalarField > mu() const
Return the mixture dymanic viscosity.
Definition: phaseModel.C:297
volFields.H
Foam::phaseModel::correctTurbulence
virtual void correctTurbulence()
Correct the turbulence.
Definition: phaseModel.C:112
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::phaseModel::Cv
tmp< volScalarField > Cv() const
Return Cv of the phase.
Definition: phaseModel.C:153
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::phaseModel::kappa
const dimensionedScalar & kappa() const
Definition: phaseModel.H:157
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::phaseModel::kappaEff
virtual tmp< volScalarField > kappaEff() const =0
Effective thermal turbulent diffusivity for temperature.
Foam::phaseModel::alphaPhi
const surfaceScalarField & alphaPhi() const
Definition: phaseModel.H:202
Foam::phaseModel::diffNo
virtual tmp< surfaceScalarField > diffNo() const =0
Diffusion number.
Sp
zeroField Sp
Definition: alphaSuSp.H:2
Foam::basicThermo::dpdt
bool dpdt() const noexcept
True if dpdt term should be included in enthalpy equation.
Definition: basicThermo.H:345
Foam::phaseModel::correct
void correct()
Correct the phase properties.
Definition: phaseModel.C:215
fvMatricesFwd.H
Forward declarations of fvMatrix specializations.
surfaceFields.H
Foam::surfaceFields.
Foam::phaseModel::thermo
virtual const rhoThermo & thermo() const =0
Access const to phase thermo.
Foam::phaseModel::Y
virtual const PtrList< volScalarField > & Y() const =0
Constant access the species mass fractions.
Foam::phaseModel::solveYi
virtual void solveYi(PtrList< volScalarField::Internal > &Su, PtrList< volScalarField::Internal > &Sp)=0
Solve species fraction equation.
Foam::phaseModel::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, phaseModel, phaseSystem,(const phaseSystem &fluid, const word &phaseName),(fluid, phaseName))
Foam::phaseModel::Cp
const dimensionedScalar & Cp() const
Definition: phaseModel.H:162
Foam::phaseModel::~phaseModel
virtual ~phaseModel()
Destructor.
Definition: phaseModel.C:201
rhoThermo.H
Su
zeroField Su
Definition: alphaSuSp.H:1
Foam::rhoThermo
Basic thermodynamic properties based on density.
Definition: rhoThermo.H:55
Foam::phaseModel::phaseModel
phaseModel(const word &phaseName, const dictionary &phaseDict, const fvMesh &mesh)
Definition: phaseModel.C:39
Foam::phaseModel::CpByCpv
tmp< volScalarField > CpByCpv() const
Heat capacity ratio for phase [].
Definition: phaseModel.C:204
Foam::Field< scalar >
Foam::phaseModel::ClassName
ClassName("phaseModel")
Runtime type information.
Foam::phaseModel::Cpv
tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume for phase [J/kg/K].
Definition: phaseModel.C:187
Foam::phaseModel::nu
const dimensionedScalar & nu() const
Definition: phaseModel.H:152
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::phaseModel::name
const word & name() const
The name of this phase.
Definition: phaseModel.H:112
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::phaseModel::gamma
tmp< volScalarField > gamma() const
Gamma = Cp/Cv of phase[].
Definition: phaseModel.C:170
Foam::phaseModel::dpdt
bool dpdt() const
Query thermo for dpdt.
Definition: phaseModel.H:212
Foam::phaseModel::phi
const surfaceScalarField & phi() const
Definition: phaseModel.H:192
Foam::GeometricField< scalar, fvPatchField, volMesh >::T
tmp< GeometricField< scalar, fvPatchField, volMesh > > T() const
Return transpose (only if it is a tensor field)
Definition: GeometricField.C:1046
Foam::phaseModel::name
const word & name() const
Definition: phaseModel.H:140
dimensionedScalar.H
Foam::phaseModel::U
const volVectorField & U() const
Definition: phaseModel.H:172
Foam::phaseModel::alpha
const volScalarField & alpha() const
Thermal diffusivity for enthalpy of mixture [kg/m/s].
Definition: phaseModel.C:221
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::phaseModel::read
virtual bool read()
Read phase properties dictionary.
Definition: phaseModel.C:321
Foam::phaseModel::hc
tmp< volScalarField > hc() const
Chemical enthalpy for phase [J/kg].
Definition: phaseModel.C:130
dictionary.H
Foam::phaseModel::fluid
const phaseSystem & fluid() const
Return the system to which this phase belongs.
Definition: phaseModel.C:100
Foam::phaseModel::alphaEff
virtual tmp< volScalarField > alphaEff() const =0
Effective thermal turbulent diffusivity of mixture [kg/m/s].
Foam::phaseModel::alphahe
tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
Definition: phaseModel.C:245
Foam::phaseSystem
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:66
Foam::phaseModel::rho
const dimensionedScalar & rho() const
Definition: phaseModel.H:167
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::phaseModel::New
static autoPtr< phaseModel > New(const phaseSystem &fluid, const word &phaseName)
Definition: phaseModel.C:69