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-2018 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 {
34  defineTypeNameAndDebug(phaseModel, 0);
35  defineRunTimeSelectionTable(phaseModel, phaseSystem);
36 }
37 
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 (
43  const phaseSystem& fluid,
44  const word& phaseName,
45  const label index
46 )
47 :
49  (
50  IOobject
51  (
52  IOobject::groupName("alpha", phaseName),
53  fluid.mesh().time().timeName(),
54  fluid.mesh(),
55  IOobject::READ_IF_PRESENT,
56  IOobject::AUTO_WRITE
57  ),
58  fluid.mesh(),
59  dimensionedScalar("alpha", dimless, 0)
60  ),
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  diameterModel_->correct();
143 }
144 
145 
147 {}
148 
149 
151 {}
152 
153 
155 {}
156 
157 
159 {}
160 
161 
163 {
164  return diameterModel_->read(fluid_.subDict(name_));
165 }
166 
167 
169 {
170  surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef();
171  const volScalarField::Boundary& alphaBf = boundaryField();
172  const surfaceScalarField::Boundary& phiBf = phi()().boundaryField();
173 
174  forAll(alphaPhiBf, patchi)
175  {
176  fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi];
177 
178  if (!alphaPhip.coupled())
179  {
180  alphaPhip = phiBf[patchi]*alphaBf[patchi];
181  }
182  }
183 }
184 
185 
186 // ************************************************************************* //
fvsPatchField< scalar > fvsPatchScalarField
void correctInflowOutflow(surfaceScalarField &alphaPhi) const
Ensure that the flux at inflow/outflow BCs is preserved.
label index() const
Return the index of the phase.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
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
const surfaceScalarField & phi() const
Return the volumetric flux.
virtual void correctKinematics()
Correct the kinematics.
autoPtr< phaseModel > clone() const
Return clone.
const word & name() const
Definition: phaseModel.H:109
Generic dimensioned Type class.
tmp< volScalarField > d() const
phaseModel(const word &phaseName, const volScalarField &p, const volScalarField &T)
Construct from components.
static autoPtr< diameterModel > New(const dictionary &dict, const phaseModel &phase)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
virtual ~phaseModel()
Destructor.
stressControl lookup("compactNormalStress") >> compactNormalStress
dynamicFvMesh & mesh
virtual bool read()
Read phase properties dictionary.
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:67
A class for handling words, derived from string.
Definition: word.H:59
const word & keyword() const
Definition: phaseModel.H:114
word timeName
Definition: getTimeIndex.H:3
const dimensionedScalar & residualAlpha() const
Return the residual phase-fraction for given phase.
void correct()
Correct the laminar viscosity.
scalar alphaMax() const
Return the maximum phase-fraction (e.g. packing limit)
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
label patchi
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const phaseSystem & fluid() const
Return the system to which this phase belongs.
const autoPtr< diameterModel > & dPtr() const
Return const-reference to diameterModel of the phase.
virtual void correctThermo()
Correct the thermodynamics.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
virtual void correctEnergyTransport()
Correct the energy transport.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
virtual void correctTurbulence()
Correct the turbulence.
Namespace for OpenFOAM.