SingleMixtureFraction.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "SingleMixtureFraction.H"
00028
00029
00030
00031 template<class CloudType>
00032 void Foam::SingleMixtureFraction<CloudType>::constructIds()
00033 {
00034 forAll(this->phaseProps(), phaseI)
00035 {
00036 switch (this->phaseProps()[phaseI].phase())
00037 {
00038 case phaseProperties::GAS:
00039 {
00040 idGas_ = phaseI;
00041 break;
00042 }
00043 case phaseProperties::LIQUID:
00044 {
00045 idLiquid_ = phaseI;
00046 break;
00047 }
00048 case phaseProperties::SOLID:
00049 {
00050 idSolid_ = phaseI;
00051 break;
00052 }
00053 default:
00054 {
00055 FatalErrorIn
00056 (
00057 "void Foam::SingleMixtureFraction<CloudType>::"
00058 "constructIds()"
00059 ) << "Unknown phase enumeration" << nl << abort(FatalError);
00060 }
00061 }
00062 }
00063
00064 if (idGas_ < 0)
00065 {
00066 FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
00067 << "No gas phase found in phase list:" << nl
00068 << this->phaseTypes() << nl << endl;
00069 }
00070 if (idLiquid_ < 0)
00071 {
00072 FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
00073 << "No liquid phase found in phase list:" << nl
00074 << this->phaseTypes() << nl << endl;
00075 }
00076 if (idSolid_ < 0)
00077 {
00078 FatalErrorIn("Foam::SingleMixtureFraction<CloudType>::constructIds()")
00079 << "No solid phase found in phase list:" << nl
00080 << this->phaseTypes() << nl << endl;
00081 }
00082 }
00083
00084
00085
00086
00087 template<class CloudType>
00088 Foam::SingleMixtureFraction<CloudType>::SingleMixtureFraction
00089 (
00090 const dictionary& dict,
00091 CloudType& owner
00092 )
00093 :
00094 CompositionModel<CloudType>(dict, owner, typeName),
00095
00096 idGas_(-1),
00097 idLiquid_(-1),
00098 idSolid_(-1),
00099
00100 YMixture0_(3)
00101 {
00102 constructIds();
00103
00104 if (this->phaseProps().size() != 3)
00105 {
00106 FatalErrorIn
00107 (
00108 "Foam::SingleMixtureFraction<CloudType>::"
00109 "SingleMixtureFraction"
00110 "("
00111 "const dictionary&, "
00112 "CloudType&"
00113 ")"
00114 ) << "Incorrect numebr of phases: " << nl
00115 << " Please specify 1 gas, 1 liquid and 1 solid" << nl
00116 << exit(FatalError);
00117 }
00118
00119 this->coeffDict().lookup("YGasTot0") >> YMixture0_[idGas_];
00120 this->coeffDict().lookup("YLiquidTot0") >> YMixture0_[idLiquid_];
00121 this->coeffDict().lookup("YSolidTot0") >> YMixture0_[idSolid_];
00122
00123 if (mag(sum(YMixture0_) - 1.0) > SMALL)
00124 {
00125 FatalErrorIn
00126 (
00127 "Foam::SingleMixtureFraction<CloudType>::"
00128 "SingleMixtureFraction"
00129 "("
00130 "const dictionary&, "
00131 "CloudType&"
00132 ")"
00133 ) << "Sum of phases should be 1. Phase fractions:" << nl
00134 << YMixture0_ << nl << exit(FatalError);
00135 }
00136 }
00137
00138
00139
00140
00141 template<class CloudType>
00142 Foam::SingleMixtureFraction<CloudType>::~SingleMixtureFraction()
00143 {}
00144
00145
00146
00147
00148 template<class CloudType>
00149 const Foam::scalarField&
00150 Foam::SingleMixtureFraction<CloudType>::YGas0() const
00151 {
00152 return this->phaseProps()[idGas_].Y();
00153 }
00154
00155
00156 template<class CloudType>
00157 const Foam::scalarField&
00158 Foam::SingleMixtureFraction<CloudType>::YLiquid0() const
00159 {
00160 return this->phaseProps()[idLiquid_].Y();
00161 }
00162
00163
00164 template<class CloudType>
00165 const Foam::scalarField&
00166 Foam::SingleMixtureFraction<CloudType>::YSolid0() const
00167 {
00168 return this->phaseProps()[idSolid_].Y();
00169 }
00170
00171
00172 template<class CloudType>
00173 const Foam::scalarField&
00174 Foam::SingleMixtureFraction<CloudType>::YMixture0() const
00175 {
00176 return YMixture0_;
00177 }
00178
00179
00180 template<class CloudType>
00181 Foam::label Foam::SingleMixtureFraction<CloudType>::idGas() const
00182 {
00183 return idGas_;
00184 }
00185
00186
00187 template<class CloudType>
00188 Foam::label Foam::SingleMixtureFraction<CloudType>::idLiquid() const
00189 {
00190 return idLiquid_;
00191 }
00192
00193
00194 template<class CloudType>
00195 Foam::label Foam::SingleMixtureFraction<CloudType>::idSolid() const
00196 {
00197 return idSolid_;
00198 }
00199
00200
00201
00202
Copyright © 2000-2009 OpenCFD Ltd