fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / lagrangian / intermediate / submodels / Reacting / CompositionModel / SingleMixtureFraction / SingleMixtureFraction.C
blob239d976b0f81d4c296c9de54ef1008120aa8ca47
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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)
35     {
36         switch (this->phaseProps()[phaseI].phase())
37         {
38             case phaseProperties::GAS:
39             {
40                 idGas_ = phaseI;
41                 break;
42             }
43             case phaseProperties::LIQUID:
44             {
45                 idLiquid_ = phaseI;
46                 break;
47             }
48             case phaseProperties::SOLID:
49             {
50                 idSolid_ = phaseI;
51                 break;
52             }
53             default:
54             {
55                 FatalErrorIn
56                 (
57                     "void Foam::SingleMixtureFraction<CloudType>::"
58                     "constructIds()"
59                 )   << "Unknown phase enumeration" << nl << abort(FatalError);
60             }
61         }
62     }
64     if (idGas_ < 0)
65     {
66         FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
67             << "No gas phase found in phase list:" << nl
68             << this->phaseTypes() << nl << endl;
69     }
70     if (idLiquid_ < 0)
71     {
72         FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
73             << "No liquid phase found in phase list:" << nl
74             << this->phaseTypes() << nl << endl;
75     }
76     if (idSolid_ < 0)
77     {
78         FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
79             << "No solid phase found in phase list:" << nl
80             << this->phaseTypes() << nl << endl;
81     }
85 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
87 template<class CloudType>
88 Foam::SingleMixtureFraction<CloudType>::SingleMixtureFraction
90     const dictionary& dict,
91     CloudType& owner
94     CompositionModel<CloudType>(dict, owner, typeName),
96     idGas_(-1),
97     idLiquid_(-1),
98     idSolid_(-1),
100     YMixture0_(3)
102     constructIds();
104     if (this->phaseProps().size() != 3)
105     {
106         FatalErrorIn
107         (
108             "Foam::SingleMixtureFraction<CloudType>::"
109             "SingleMixtureFraction"
110             "("
111                 "const dictionary&, "
112                 "CloudType&"
113             ")"
114         )   << "Incorrect numebr of phases: " << nl
115             << "    Please specify 1 gas, 1 liquid and 1 solid" << nl
116             << exit(FatalError);
117     }
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)
124     {
125         FatalErrorIn
126         (
127             "Foam::SingleMixtureFraction<CloudType>::"
128             "SingleMixtureFraction"
129             "("
130                 "const dictionary&, "
131                 "CloudType&"
132             ")"
133         )   << "Sum of phases should be 1. Phase fractions:" << nl
134             << YMixture0_ << nl << exit(FatalError);
135     }
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
176     return YMixture0_;
180 template<class CloudType>
181 Foam::label Foam::SingleMixtureFraction<CloudType>::idGas() const
183     return idGas_;
187 template<class CloudType>
188 Foam::label Foam::SingleMixtureFraction<CloudType>::idLiquid() const
190     return idLiquid_;
194 template<class CloudType>
195 Foam::label Foam::SingleMixtureFraction<CloudType>::idSolid() const
197     return idSolid_;
201 // ************************************************************************* //