SingleMixtureFraction.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) 2011-2015 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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
29
30// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31
32template<class CloudType>
34{
35 forAll(this->phaseProps(), phaseI)
36 {
37 switch (this->phaseProps()[phaseI].phase())
38 {
39 case phaseProperties::GAS:
40 {
41 idGas_ = phaseI;
42 break;
43 }
44 case phaseProperties::LIQUID:
45 {
46 idLiquid_ = phaseI;
47 break;
48 }
49 case phaseProperties::SOLID:
50 {
51 idSolid_ = phaseI;
52 break;
53 }
54 default:
55 {
57 << "Unknown phase enumeration" << nl << abort(FatalError);
58 }
59 }
60 }
61
62 if (idGas_ < 0)
63 {
65 << "No gas phase found in phase list:" << nl
66 << this->phaseTypes() << exit(FatalError);
67 }
68 if (idLiquid_ < 0)
69 {
71 << "No liquid phase found in phase list:" << nl
72 << this->phaseTypes() << exit(FatalError);
73 }
74 if (idSolid_ < 0)
75 {
77 << "No solid phase found in phase list:" << nl
78 << this->phaseTypes() << exit(FatalError);
79 }
80}
81
82
83// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
84
85template<class CloudType>
87(
88 const dictionary& dict,
89 CloudType& owner
90)
91:
92 CompositionModel<CloudType>(dict, owner, typeName),
93
94 idGas_(-1),
95 idLiquid_(-1),
96 idSolid_(-1),
97
98 YMixture0_(3)
99{
100 constructIds();
101
102 if (this->phaseProps().size() != 3)
103 {
105 << "Incorrect number of phases:" << nl
106 << " Please specify 1 gas, 1 liquid and 1 solid"
107 << exit(FatalError);
108 }
109
110 this->coeffDict().readEntry("YGasTot0", YMixture0_[idGas_]);
111 this->coeffDict().readEntry("YLiquidTot0", YMixture0_[idLiquid_]);
112 this->coeffDict().readEntry("YSolidTot0", YMixture0_[idSolid_]);
113
114 if (mag(sum(YMixture0_) - 1.0) > SMALL)
115 {
117 << "Sum of phases should be 1. Phase fractions:" << nl
118 << YMixture0_ << exit(FatalError);
119 }
120}
121
122
123template<class CloudType>
125(
127)
128:
130 idGas_(cm.idGas_),
131 idLiquid_(cm.idLiquid_),
132 idSolid_(cm.idSolid_),
133 YMixture0_(cm.YMixture0_)
134{}
135
136
137// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
138
139template<class CloudType>
141{}
142
143
144// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
145
146template<class CloudType>
149{
150 return YMixture0_;
151}
152
153
154template<class CloudType>
156{
157 return idGas_;
158}
159
160
161template<class CloudType>
163{
164 return idLiquid_;
165}
166
167
168template<class CloudType>
170{
171 return idSolid_;
172}
173
174
175// ************************************************************************* //
Templated reacting parcel composition model class Consists of carrier species (via thermo package),...
const phasePropertiesList & phaseProps() const
Return the list of phase properties.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
Templated parcel multi-phase, multi-component class.
virtual const scalarField & YMixture0() const
Return the list of mixture mass fractions.
virtual ~SingleMixtureFraction()
Destructor.
virtual label idGas() const
Gas id.
virtual label idLiquid() const
Liquid id.
virtual label idSolid() const
Solid id.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
Definition: subModelBase.C:131
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
Definition: errorManip.H:144
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333