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