ThermoPhaseModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2015-2023 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 #include "phaseSystem.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class BasePhaseModel, class ThermoModel>
33 (
34  const phaseSystem& fluid,
35  const word& phaseName,
36  const bool referencePhase,
37  const label index
38 )
39 :
40  BasePhaseModel(fluid, phaseName, referencePhase, index),
41  viscosity(),
42  thermo_(ThermoModel::New(fluid.mesh(), this->name()))
43 {
44  thermo_->validate
45  (
47  "h",
48  "e"
49  );
50 }
51 
52 
53 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
54 
55 template<class BasePhaseModel, class ThermoModel>
57 {}
58 
59 
60 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
61 
62 template<class BasePhaseModel, class ThermoModel>
64 {
65  return thermo_().incompressible();
66 }
67 
68 
69 template<class BasePhaseModel, class ThermoModel>
71 {
72  return thermo_().isochoric();
73 }
74 
75 
76 template<class BasePhaseModel, class ThermoModel>
77 const Foam::rhoThermo&
79 {
80  return thermo_();
81 }
82 
83 
84 template<class BasePhaseModel, class ThermoModel>
87 {
88  return thermo_();
89 }
90 
91 
92 template<class BasePhaseModel, class ThermoModel>
95 {
96  return thermo_->rho();
97 }
98 
99 
100 template<class BasePhaseModel, class ThermoModel>
103 {
104  return thermo_->rho();
105 }
106 
107 
108 template<class BasePhaseModel, class ThermoModel>
111 {
112  return thermo_->mu();
113 }
114 
115 
116 template<class BasePhaseModel, class ThermoModel>
119 (
120  const label patchi
121 ) const
122 {
123  return thermo_->mu(patchi);
124 }
125 
126 
127 template<class BasePhaseModel, class ThermoModel>
130 {
131  return thermo_->nu();
132 }
133 
134 
135 template<class BasePhaseModel, class ThermoModel>
138 (
139  const label patchi
140 ) const
141 {
142  return thermo_->nu(patchi);
143 }
144 
145 
146 // ************************************************************************* //
static const char *const typeName
Definition: Field.H:105
Generic GeometricField class.
static word groupName(Name name, const word &group)
virtual const rhoThermo & thermo() const
Return the thermophysical model.
ThermoPhaseModel(const phaseSystem &fluid, const word &phaseName, const bool referencePhase, const label index)
virtual const volScalarField & rho() const
Return the density field.
virtual tmp< volScalarField > mu() const
Return the laminar dynamic viscosity.
virtual tmp< volScalarField > nu() const
Return the laminar kinematic viscosity.
virtual ~ThermoPhaseModel()
Destructor.
autoPtr< ThermoModel > thermo_
Thermophysical model.
virtual bool isochoric() const
Return whether the phase is constant density.
virtual bool incompressible() const
Return whether the phase is incompressible.
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:73
Base-class for fluid thermodynamic properties based on density.
Definition: rhoThermo.H:55
A class for managing temporary objects.
Definition: tmp.H:55
Abstract base class for all fluid physical properties.
Definition: viscosity.H:50
A class for handling words, derived from string.
Definition: word.H:62
label patchi
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
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
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47