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 #include "multiComponentMixture.H"
00027
00028
00029
00030 template<class ThermoType>
00031 const ThermoType& Foam::multiComponentMixture<ThermoType>::constructSpeciesData
00032 (
00033 const dictionary& thermoDict
00034 )
00035 {
00036 forAll(species_, i)
00037 {
00038 speciesData_.set
00039 (
00040 i,
00041 new ThermoType(thermoDict.lookup(species_[i]))
00042 );
00043 }
00044
00045 return speciesData_[0];
00046 }
00047
00048
00049 template<class ThermoType>
00050 void Foam::multiComponentMixture<ThermoType>::correctMassFractions()
00051 {
00052 volScalarField Yt = Y_[0];
00053
00054 for (label n=1; n<Y_.size(); n++)
00055 {
00056 Yt += Y_[n];
00057 }
00058
00059 forAll (Y_, n)
00060 {
00061 Y_[n] /= Yt;
00062 }
00063 }
00064
00065
00066
00067
00068 template<class ThermoType>
00069 Foam::multiComponentMixture<ThermoType>::multiComponentMixture
00070 (
00071 const dictionary& thermoDict,
00072 const wordList& specieNames,
00073 const HashPtrTable<ThermoType>& specieThermoData,
00074 const fvMesh& mesh
00075 )
00076 :
00077 basicMultiComponentMixture(thermoDict, specieNames, mesh),
00078 speciesData_(species_.size()),
00079 mixture_("mixture", *specieThermoData[specieNames[0]])
00080 {
00081 forAll(species_, i)
00082 {
00083 speciesData_.set
00084 (
00085 i,
00086 new ThermoType(*specieThermoData[species_[i]])
00087 );
00088 }
00089
00090 correctMassFractions();
00091 }
00092
00093
00094 template<class ThermoType>
00095 Foam::multiComponentMixture<ThermoType>::multiComponentMixture
00096 (
00097 const dictionary& thermoDict,
00098 const fvMesh& mesh
00099 )
00100 :
00101 basicMultiComponentMixture(thermoDict, thermoDict.lookup("species"), mesh),
00102 speciesData_(species_.size()),
00103 mixture_("mixture", constructSpeciesData(thermoDict))
00104 {
00105 correctMassFractions();
00106 }
00107
00108
00109
00110
00111 template<class ThermoType>
00112 const ThermoType& Foam::multiComponentMixture<ThermoType>::cellMixture
00113 (
00114 const label celli
00115 ) const
00116 {
00117 mixture_ = Y_[0][celli]/speciesData_[0].W()*speciesData_[0];
00118
00119 for (label n=1; n<Y_.size(); n++)
00120 {
00121 mixture_ += Y_[n][celli]/speciesData_[n].W()*speciesData_[n];
00122 }
00123
00124 return mixture_;
00125 }
00126
00127
00128 template<class ThermoType>
00129 const ThermoType& Foam::multiComponentMixture<ThermoType>::patchFaceMixture
00130 (
00131 const label patchi,
00132 const label facei
00133 ) const
00134 {
00135 mixture_ =
00136 Y_[0].boundaryField()[patchi][facei]
00137 /speciesData_[0].W()*speciesData_[0];
00138
00139 for (label n=1; n<Y_.size(); n++)
00140 {
00141 mixture_ +=
00142 Y_[n].boundaryField()[patchi][facei]
00143 /speciesData_[n].W()*speciesData_[n];
00144 }
00145
00146 return mixture_;
00147 }
00148
00149
00150 template<class ThermoType>
00151 void Foam::multiComponentMixture<ThermoType>::read
00152 (
00153 const dictionary& thermoDict
00154 )
00155 {
00156 forAll(species_, i)
00157 {
00158 speciesData_[i] = ThermoType(thermoDict.lookup(species_[i]));
00159 }
00160 }
00161
00162
00163