1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "SingleMixtureFraction.H"
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31 template<class CloudType>
32 void Foam::SingleMixtureFraction<CloudType>::constructIds()
34 forAll(this->phaseProps(), phaseI)
36 switch (this->phaseProps()[phaseI].phase())
38 case phaseProperties::GAS:
43 case phaseProperties::LIQUID:
48 case phaseProperties::SOLID:
57 "void Foam::SingleMixtureFraction<CloudType>::"
59 ) << "Unknown phase enumeration" << nl << abort(FatalError);
66 FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
67 << "No gas phase found in phase list:" << nl
68 << this->phaseTypes() << nl << endl;
72 FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
73 << "No liquid phase found in phase list:" << nl
74 << this->phaseTypes() << nl << endl;
78 FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
79 << "No solid phase found in phase list:" << nl
80 << this->phaseTypes() << nl << endl;
85 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
87 template<class CloudType>
88 Foam::SingleMixtureFraction<CloudType>::SingleMixtureFraction
90 const dictionary& dict,
94 CompositionModel<CloudType>(dict, owner, typeName),
104 if (this->phaseProps().size() != 3)
108 "Foam::SingleMixtureFraction<CloudType>::"
109 "SingleMixtureFraction"
111 "const dictionary&, "
114 ) << "Incorrect numebr of phases: " << nl
115 << " Please specify 1 gas, 1 liquid and 1 solid" << nl
119 this->coeffDict().lookup("YGasTot0") >> YMixture0_[idGas_];
120 this->coeffDict().lookup("YLiquidTot0") >> YMixture0_[idLiquid_];
121 this->coeffDict().lookup("YSolidTot0") >> YMixture0_[idSolid_];
123 if (mag(sum(YMixture0_) - 1.0) > SMALL)
127 "Foam::SingleMixtureFraction<CloudType>::"
128 "SingleMixtureFraction"
130 "const dictionary&, "
133 ) << "Sum of phases should be 1. Phase fractions:" << nl
134 << YMixture0_ << nl << exit(FatalError);
139 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
141 template<class CloudType>
142 Foam::SingleMixtureFraction<CloudType>::~SingleMixtureFraction()
146 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
148 template<class CloudType>
149 const Foam::scalarField&
150 Foam::SingleMixtureFraction<CloudType>::YGas0() const
152 return this->phaseProps()[idGas_].Y();
156 template<class CloudType>
157 const Foam::scalarField&
158 Foam::SingleMixtureFraction<CloudType>::YLiquid0() const
160 return this->phaseProps()[idLiquid_].Y();
164 template<class CloudType>
165 const Foam::scalarField&
166 Foam::SingleMixtureFraction<CloudType>::YSolid0() const
168 return this->phaseProps()[idSolid_].Y();
172 template<class CloudType>
173 const Foam::scalarField&
174 Foam::SingleMixtureFraction<CloudType>::YMixture0() const
180 template<class CloudType>
181 Foam::label Foam::SingleMixtureFraction<CloudType>::idGas() const
187 template<class CloudType>
188 Foam::label Foam::SingleMixtureFraction<CloudType>::idLiquid() const
194 template<class CloudType>
195 Foam::label Foam::SingleMixtureFraction<CloudType>::idSolid() const
201 // ************************************************************************* //