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  (
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 // ************************************************************************* //
virtual tmp< volScalarField > rho() const
Return the density field.
twoPhaseSystem & fluid
virtual const rhoThermo & thermo() const
Return the thermophysical model.
virtual rhoThermo & thermoRef()
Access the thermophysical model.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Calculate the matrix for the laplacian of the field.
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal turbulent diffusivity of mixture [kg/m/s].
Calculate the first temporal derivative.
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
autoPtr< ThermoType > thermo_
Thermophysical model.
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:69
A class for handling words, derived from Foam::string.
Definition: word.H:63
Calculate the matrix for the first temporal derivative.
ThermoPhaseModel(const phaseSystem &fluid, const word &phaseName, const label index)
Calculate the divergence of the given field.
virtual tmp< volScalarField > mu() const
Return the laminar dynamic viscosity.
virtual tmp< volScalarField > alpha() const
Thermal diffusivity for enthalpy of mixture [kg/m/s].
const word typeName("volScalarField::Internal")
Calculate the matrix for the divergence of the given field and flux.
virtual tmp< volScalarField > nu() const
Return the laminar kinematic viscosity.
virtual ~ThermoPhaseModel()
Destructor.
Basic thermodynamic properties based on density.
Definition: rhoThermo.H:51
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual bool compressible() const
Return whether the phase is compressible.
virtual tmp< volScalarField > kappaEff(const volScalarField &alphat) const
Effective thermal turbulent diffusivity for temperature.
Calculate the finiteVolume matrix for implicit and explicit sources.