phaseModel.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-2026 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 "phaseModel.H"
27 #include "phaseSystem.H"
28 #include "diameterModel.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
36 }
37 
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 (
43  const phaseSystem& fluid,
44  const word& phaseName,
45  const bool referencePhase,
46  const label index
47 )
48 :
50  (
51  IOobject
52  (
53  IOobject::groupName("alpha", phaseName),
54  fluid.mesh().time().name(),
55  fluid.mesh(),
56  referencePhase ? IOobject::NO_READ : IOobject::MUST_READ,
57  IOobject::AUTO_WRITE
58  ),
59  fluid.mesh(),
61  ),
62  fluid_(fluid),
63  name_(phaseName),
64  index_(index),
65  residualAlpha_
66  (
67  "residualAlpha",
68  dimless,
69  fluid.subDict(phaseName).lookup("residualAlpha")
70  ),
71  alphaMax_(fluid.subDict(phaseName).lookupOrDefault("alphaMax", 1.0))
72 {
73  diameterModel_ = diameterModel::New(fluid.subDict(phaseName), *this);
74 }
75 
76 
78 {
80  return autoPtr<phaseModel>(nullptr);
81 }
82 
83 
84 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
85 
87 {}
88 
89 
90 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
91 
93 {
94  return name_;
95 }
96 
97 
99 {
100  return name_;
101 }
102 
103 
105 {
106  return index_;
107 }
108 
109 
111 {
112  return fluid_;
113 }
114 
115 
117 {
118  return residualAlpha_;
119 }
120 
121 
122 Foam::scalar Foam::phaseModel::alphaMax() const
123 {
124  return alphaMax_;
125 }
126 
127 
129 {
130  return diameterModel_().d();
131 }
132 
133 
135 {
136  return diameterModel_();
137 }
138 
139 
141 {
142  return diameterModel_();
143 }
144 
145 
147 {
148  diameterModel_->correct();
149 }
150 
151 
153 {}
154 
155 
157 {}
158 
159 
161 {}
162 
163 
165 {}
166 
167 
169 {}
170 
171 
173 {}
174 
175 
177 {}
178 
179 
181 {}
182 
183 
185 {}
186 
187 
189 {}
190 
191 
193 {
194  return diameterModel_->read();
195 }
196 
197 
199 {
200  surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef();
201  const volScalarField::Boundary& alphaBf = boundaryField();
202  const surfaceScalarField::Boundary& phiBf = phiRef().boundaryField();
203 
204  forAll(alphaPhiBf, patchi)
205  {
206  fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi];
207 
208  if (!alphaPhip.coupled())
209  {
210  alphaPhip = phiBf[patchi]*alphaBf[patchi];
211  }
212  }
213 }
214 
215 
216 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
Generic GeometricBoundaryField class.
Generic GeometricField class.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Abstract base-class for dispersed-phase particle diameter models.
Definition: diameterModel.H:52
static autoPtr< diameterModel > New(const dictionary &diameterProperties, const phaseModel &phase)
Select from dictionary and phase.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:778
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:86
virtual bool coupled() const
Return true if this patch field is coupled.
virtual void correctUf()
Correct the face velocity for moving meshes.
Definition: phaseModel.C:188
virtual void correctKinematics()
Correct the kinematics.
Definition: phaseModel.C:156
const phaseSystem & fluid() const
Return the system to which this phase belongs.
Definition: phaseModel.C:110
virtual void correctReactions()
Correct the reactions.
Definition: phaseModel.C:164
const dimensionedScalar & residualAlpha() const
Return the residual phase-fraction for given phase.
Definition: phaseModel.C:116
virtual void correctSpecies()
Correct the species concentrations.
Definition: phaseModel.C:168
virtual void correctThermo()
Correct the thermodynamics.
Definition: phaseModel.C:160
virtual void correct()
Correct the phase properties.
Definition: phaseModel.C:146
virtual ~phaseModel()
Destructor.
Definition: phaseModel.C:86
virtual void predictThermophysicalTransport()
Predict the energy transport.
Definition: phaseModel.C:176
virtual void correctMomentumTransport()
Correct the momentumTransport.
Definition: phaseModel.C:180
scalar alphaMax() const
Return the maximum phase-fraction (e.g. packing limit)
Definition: phaseModel.C:122
const diameterModel & diameter() const
Return a reference to the diameterModel of the phase.
Definition: phaseModel.C:134
tmp< volScalarField > d() const
Return the Sauter-mean diameter.
Definition: phaseModel.C:128
virtual void correctThermophysicalTransport()
Correct the energy transport.
Definition: phaseModel.C:184
label index() const
Return the index of the phase.
Definition: phaseModel.C:104
const word & keyword() const
Return the name of the phase for use as the keyword in PtrDictionary.
Definition: phaseModel.C:98
phaseModel(const phaseSystem &fluid, const word &phaseName, const bool referencePhase, const label index)
Definition: phaseModel.C:42
autoPtr< phaseModel > clone() const
Return clone.
Definition: phaseModel.C:77
void correctInflowOutflow(surfaceScalarField &alphaPhi) const
Ensure that the flux at inflow/outflow BCs is preserved.
Definition: phaseModel.C:198
const word & name() const
Return the name of this phase.
Definition: phaseModel.C:92
virtual void predictMomentumTransport()
Predict the momentumTransport.
Definition: phaseModel.C:172
virtual void correctContinuityError(const volScalarField &source)
Correct the continuity error.
Definition: phaseModel.C:152
virtual bool read()
Read phase properties dictionary.
Definition: phaseModel.C:192
Class to represent a system of phases.
Definition: phaseSystem.H:74
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
label patchi
const dimensionSet dimless
const dimensionSet time
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
Namespace for OpenFOAM.
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
defineRunTimeSelectionTable(fvConstraint, dictionary)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)