FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

SingleMixtureFraction.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include <lagrangianIntermediate/SingleMixtureFraction.H>
00027 
00028 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00029 
00030 template<class CloudType>
00031 void Foam::SingleMixtureFraction<CloudType>::constructIds()
00032 {
00033     forAll(this->phaseProps(), phaseI)
00034     {
00035         switch (this->phaseProps()[phaseI].phase())
00036         {
00037             case phaseProperties::GAS:
00038             {
00039                 idGas_ = phaseI;
00040                 break;
00041             }
00042             case phaseProperties::LIQUID:
00043             {
00044                 idLiquid_ = phaseI;
00045                 break;
00046             }
00047             case phaseProperties::SOLID:
00048             {
00049                 idSolid_ = phaseI;
00050                 break;
00051             }
00052             default:
00053             {
00054                 FatalErrorIn
00055                 (
00056                     "void Foam::SingleMixtureFraction<CloudType>::"
00057                     "constructIds()"
00058                 )   << "Unknown phase enumeration" << nl << abort(FatalError);
00059             }
00060         }
00061     }
00062 
00063     if (idGas_ < 0)
00064     {
00065         FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
00066             << "No gas phase found in phase list:" << nl
00067             << this->phaseTypes() << nl << endl;
00068     }
00069     if (idLiquid_ < 0)
00070     {
00071         FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
00072             << "No liquid phase found in phase list:" << nl
00073             << this->phaseTypes() << nl << endl;
00074     }
00075     if (idSolid_ < 0)
00076     {
00077         FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
00078             << "No solid phase found in phase list:" << nl
00079             << this->phaseTypes() << nl << endl;
00080     }
00081 }
00082 
00083 
00084 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00085 
00086 template<class CloudType>
00087 Foam::SingleMixtureFraction<CloudType>::SingleMixtureFraction
00088 (
00089     const dictionary& dict,
00090     CloudType& owner
00091 )
00092 :
00093     CompositionModel<CloudType>(dict, owner, typeName),
00094 
00095     idGas_(-1),
00096     idLiquid_(-1),
00097     idSolid_(-1),
00098 
00099     YMixture0_(3)
00100 {
00101     constructIds();
00102 
00103     if (this->phaseProps().size() != 3)
00104     {
00105         FatalErrorIn
00106         (
00107             "Foam::SingleMixtureFraction<CloudType>::"
00108             "SingleMixtureFraction"
00109             "("
00110                 "const dictionary&, "
00111                 "CloudType&"
00112             ")"
00113         )   << "Incorrect numebr of phases: " << nl
00114             << "    Please specify 1 gas, 1 liquid and 1 solid" << nl
00115             << exit(FatalError);
00116     }
00117 
00118     this->coeffDict().lookup("YGasTot0") >> YMixture0_[idGas_];
00119     this->coeffDict().lookup("YLiquidTot0") >> YMixture0_[idLiquid_];
00120     this->coeffDict().lookup("YSolidTot0") >> YMixture0_[idSolid_];
00121 
00122     if (mag(sum(YMixture0_) - 1.0) > SMALL)
00123     {
00124         FatalErrorIn
00125         (
00126             "Foam::SingleMixtureFraction<CloudType>::"
00127             "SingleMixtureFraction"
00128             "("
00129                 "const dictionary&, "
00130                 "CloudType&"
00131             ")"
00132         )   << "Sum of phases should be 1. Phase fractions:" << nl
00133             << YMixture0_ << nl << exit(FatalError);
00134     }
00135 }
00136 
00137 
00138 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00139 
00140 template<class CloudType>
00141 Foam::SingleMixtureFraction<CloudType>::~SingleMixtureFraction()
00142 {}
00143 
00144 
00145 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00146 
00147 template<class CloudType>
00148 const Foam::scalarField&
00149 Foam::SingleMixtureFraction<CloudType>::YGas0() const
00150 {
00151     return this->phaseProps()[idGas_].Y();
00152 }
00153 
00154 
00155 template<class CloudType>
00156 const Foam::scalarField&
00157 Foam::SingleMixtureFraction<CloudType>::YLiquid0() const
00158 {
00159     return this->phaseProps()[idLiquid_].Y();
00160 }
00161 
00162 
00163 template<class CloudType>
00164 const Foam::scalarField&
00165 Foam::SingleMixtureFraction<CloudType>::YSolid0() const
00166 {
00167     return this->phaseProps()[idSolid_].Y();
00168 }
00169 
00170 
00171 template<class CloudType>
00172 const Foam::scalarField&
00173 Foam::SingleMixtureFraction<CloudType>::YMixture0() const
00174 {
00175     return YMixture0_;
00176 }
00177 
00178 
00179 template<class CloudType>
00180 Foam::label Foam::SingleMixtureFraction<CloudType>::idGas() const
00181 {
00182     return idGas_;
00183 }
00184 
00185 
00186 template<class CloudType>
00187 Foam::label Foam::SingleMixtureFraction<CloudType>::idLiquid() const
00188 {
00189     return idLiquid_;
00190 }
00191 
00192 
00193 template<class CloudType>
00194 Foam::label Foam::SingleMixtureFraction<CloudType>::idSolid() const
00195 {
00196     return idSolid_;
00197 }
00198 
00199 
00200 // ************************ vim: set sw=4 sts=4 et: ************************ //
00201 
00202 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines