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