ThermoPhaseModel.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 "ThermoPhaseModel.H"
29 
30 #include "phaseSystem.H"
31 
32 #include "fvmDdt.H"
33 #include "fvmDiv.H"
34 #include "fvmSup.H"
35 #include "fvmLaplacian.H"
36 #include "fvcDdt.H"
37 #include "fvcDiv.H"
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
41 template<class BasePhaseModel, class ThermoType>
43 (
44  const phaseSystem& fluid,
45  const word& phaseName,
46  const label index
47 )
48 :
49  BasePhaseModel(fluid, phaseName, index),
50  thermo_(ThermoType::New(fluid.mesh(), this->name()))
51 {
52  thermo_->validate
53  (
54  IOobject::groupName(phaseModel::typeName, this->name()),
55  "h",
56  "e"
57  );
58 }
59 
60 
61 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
62 
63 template<class BasePhaseModel, class ThermoType>
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
70 template<class BasePhaseModel, class ThermoType>
72 {
73  return !thermo_().incompressible();
74 }
75 
76 
77 template<class BasePhaseModel, class ThermoType>
78 const Foam::rhoThermo&
80 {
81  return thermo_();
82 }
83 
84 
85 template<class BasePhaseModel, class ThermoType>
88 {
89  return thermo_();
90 }
91 
92 
93 template<class BasePhaseModel, class ThermoType>
96 {
97  return thermo_->rho();
98 }
99 
100 
101 template<class BasePhaseModel, class ThermoType>
104 {
105  return thermo_->mu();
106 }
107 
108 
109 template<class BasePhaseModel, class ThermoType>
112 (
113  const label patchi
114 ) const
115 {
116  return thermo_->mu(patchi);
117 }
118 
119 
120 template<class BasePhaseModel, class ThermoType>
123 {
124  return thermo_->nu();
125 }
126 
127 
128 template<class BasePhaseModel, class ThermoType>
131 (
132  const label patchi
133 ) const
134 {
135  return thermo_->nu(patchi);
136 }
137 
138 
139 template<class BasePhaseModel, class ThermoType>
142 {
143  return thermo_->kappa();
144 }
145 
146 
147 template<class BasePhaseModel, class ThermoType>
150 (
151  const label patchi
152 ) const
153 {
154  return thermo_->kappa(patchi);
155 }
156 
157 
158 template<class BasePhaseModel, class ThermoType>
161 {
162  return thermo_->alphahe();
163 }
164 
165 
166 template<class BasePhaseModel, class ThermoType>
169 (
170  const label patchi
171 ) const
172 {
173  return thermo_->alphahe(patchi);
174 }
175 
176 
177 template<class BasePhaseModel, class ThermoType>
180 (
181  const volScalarField& alphat
182 ) const
183 {
184  return thermo_->kappaEff(alphat);
185 }
186 
187 
188 template<class BasePhaseModel, class ThermoType>
191 (
192  const scalarField& alphat,
193  const label patchi
194 ) const
195 {
196  return thermo_->kappaEff(alphat, patchi);
197 }
198 
199 
200 template<class BasePhaseModel, class ThermoType>
203 {
204  return thermo_->alpha();
205 }
206 
207 
208 template<class BasePhaseModel, class ThermoType>
211 (
212  const label patchi
213 ) const
214 {
215  return thermo_->alpha(patchi);
216 }
217 
218 
219 template<class BasePhaseModel, class ThermoType>
222 (
223  const volScalarField& alphat
224 ) const
225 {
226  return thermo_->alphaEff(alphat);
227 }
228 
229 
230 template<class BasePhaseModel, class ThermoType>
233 (
234  const scalarField& alphat,
235  const label patchi
236 ) const
237 {
238  return thermo_->alphaEff(alphat, patchi);
239 }
240 
241 
242 // ************************************************************************* //
Foam::ThermoPhaseModel::thermo
virtual const rhoThermo & thermo() const
Return the thermophysical model.
Definition: ThermoPhaseModel.C:79
Foam::ThermoPhaseModel::rho
virtual tmp< volScalarField > rho() const
Return the density field.
Definition: ThermoPhaseModel.C:95
Foam::ThermoPhaseModel::mu
virtual tmp< volScalarField > mu() const
Return the laminar dynamic viscosity.
Definition: ThermoPhaseModel.C:103
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::ThermoPhaseModel::compressible
virtual bool compressible() const
Return whether the phase is compressible.
Definition: ThermoPhaseModel.C:71
Foam::ThermoPhaseModel::~ThermoPhaseModel
virtual ~ThermoPhaseModel()
Destructor.
Definition: ThermoPhaseModel.C:64
fvcDiv.H
Calculate the divergence of the given field.
Foam::ThermoPhaseModel::thermoRef
virtual rhoThermo & thermoRef()
Access the thermophysical model.
Definition: ThermoPhaseModel.C:87
fluid
twoPhaseSystem & fluid
Definition: setRegionFluidFields.H:3
fvmDiv.H
Calculate the matrix for the divergence of the given field and flux.
Foam::rhoThermo
Basic thermodynamic properties based on density.
Definition: rhoThermo.H:55
Foam::Field< scalar >
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::ThermoPhaseModel::ThermoPhaseModel
ThermoPhaseModel(const phaseSystem &fluid, const word &phaseName, const label index)
Definition: ThermoPhaseModel.C:43
fvmLaplacian.H
Calculate the matrix for the laplacian of the field.
Foam::ThermoPhaseModel::alpha
virtual tmp< volScalarField > alpha() const
Thermal diffusivity for enthalpy of mixture [kg/m/s].
Definition: ThermoPhaseModel.C:202
Foam::ThermoPhaseModel::nu
virtual tmp< volScalarField > nu() const
Return the laminar kinematic viscosity.
Definition: ThermoPhaseModel.C:122
fvmSup.H
Calculate the matrix for implicit and explicit sources.
Foam::ThermoPhaseModel::kappa
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
Definition: ThermoPhaseModel.C:141
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
ThermoPhaseModel.H
Foam::ThermoPhaseModel::alphahe
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
Definition: ThermoPhaseModel.C:160
fvcDdt.H
Calculate the first temporal derivative.
Foam::phaseSystem
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:63
Foam::ThermoPhaseModel::alphaEff
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal turbulent diffusivity of mixture [kg/m/s].
Definition: ThermoPhaseModel.C:222
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::ThermoPhaseModel::kappaEff
virtual tmp< volScalarField > kappaEff(const volScalarField &alphat) const
Effective thermal turbulent diffusivity for temperature.
Definition: ThermoPhaseModel.C:180
fvmDdt.H
Calculate the matrix for the first temporal derivative.