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 | Copyright (C) 2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "ThermoPhaseModel.H"
27 
28 #include "phaseSystem.H"
29 
30 #include "fvmDdt.H"
31 #include "fvmDiv.H"
32 #include "fvmSup.H"
33 #include "fvmLaplacian.H"
34 #include "fvcDdt.H"
35 #include "fvcDiv.H"
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
39 template<class BasePhaseModel, class ThermoType>
41 (
42  const phaseSystem& fluid,
43  const word& phaseName,
44  const label index,
45  const bool createThermo
46 )
47 :
48  BasePhaseModel(fluid, phaseName, index)
49 {
50  if (createThermo)
51  {
52  thermoPtr_.set
53  (
54  ThermoType::New(fluid.mesh(), this->name()).ptr()
55  );
56 
57  thermo_ = thermoPtr_.ptr();
58 
59  thermo_->validate
60  (
62  "h",
63  "e"
64  );
65  }
66 }
67 
68 
69 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
70 
71 template<class BasePhaseModel, class ThermoType>
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
77 
78 template<class BasePhaseModel, class ThermoType>
79 const Foam::rhoThermo&
81 {
82  return *thermo_;
83 }
84 
85 
86 template<class BasePhaseModel, class ThermoType>
89 {
90  return *thermo_;
91 }
92 
93 
94 template<class BasePhaseModel, class ThermoType>
97 {
98  return thermo_->rho();
99 }
100 
101 
102 template<class BasePhaseModel, class ThermoType>
105 {
106  return thermo_->mu();
107 }
108 
109 
110 template<class BasePhaseModel, class ThermoType>
113 (
114  const label patchi
115 ) const
116 {
117  return thermo_->mu(patchi);
118 }
119 
120 
121 template<class BasePhaseModel, class ThermoType>
124 {
125  return thermo_->nu();
126 }
127 
128 
129 template<class BasePhaseModel, class ThermoType>
132 (
133  const label patchi
134 ) const
135 {
136  return thermo_->nu(patchi);
137 }
138 
139 
140 template<class BasePhaseModel, class ThermoType>
143 {
144  return thermo_->kappa();
145 }
146 
147 
148 template<class BasePhaseModel, class ThermoType>
151 (
152  const label patchi
153 ) const
154 {
155  return thermo_->kappa(patchi);
156 }
157 
158 
159 template<class BasePhaseModel, class ThermoType>
162 (
163  const volScalarField& alphat
164 ) const
165 {
166  return thermo_->kappaEff(alphat);
167 }
168 
169 
170 template<class BasePhaseModel, class ThermoType>
173 (
174  const scalarField& alphat,
175  const label patchi
176 ) const
177 {
178  return thermo_->kappaEff(alphat, patchi);
179 }
180 
181 
182 template<class BasePhaseModel, class ThermoType>
185 {
186  return thermo_->alpha();
187 }
188 
189 
190 template<class BasePhaseModel, class ThermoType>
193 (
194  const label patchi
195 ) const
196 {
197  return thermo_->alpha(patchi);
198 }
199 
200 
201 template<class BasePhaseModel, class ThermoType>
204 (
205  const volScalarField& alphat
206 ) const
207 {
208  return thermo_->alphaEff(alphat);
209 }
210 
211 
212 template<class BasePhaseModel, class ThermoType>
215 (
216  const scalarField& alphat,
217  const label patchi
218 ) const
219 {
220  return thermo_->alphaEff(alphat, patchi);
221 }
222 
223 
224 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual tmp< volScalarField > kappa() const
Return the laminar thermal conductivity.
static const char *const typeName
Definition: Field.H:94
Calculate the matrix for the laplacian of the field.
virtual tmp< volScalarField > rho() const
Return the density field.
virtual const rhoThermo & thermo() const
Return const access to the thermophysical model.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
Calculate the first temporal derivative.
virtual tmp< volScalarField > kappaEff(const volScalarField &alphat) const
Return the laminar thermal conductivity.
virtual tmp< volScalarField > alpha() const
Return the thermal diffusivity for enthalpy.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static word groupName(Name name, const word &group)
Calulate the matrix for the first temporal derivative.
Calculate the divergence of the given field.
virtual tmp< volScalarField > mu() const
Return the laminar dynamic viscosity.
virtual tmp< volScalarField > nu() const
Return the laminar kinematic viscosity.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Calculate the matrix for the divergence of the given field and flux.
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Return the thermal diffusivity for enthalpy.
Basic thermodynamic properties based on density.
Definition: rhoThermo.H:49
ThermoPhaseModel(const phaseSystem &fluid, const word &phaseName, const label index, const bool createThermo=true)
A class for managing temporary objects.
Definition: PtrList.H:54
virtual ~ThermoPhaseModel()
Destructor.
Calculate the matrix for implicit and explicit sources.