diff --git a/testApp/Make/options b/testApp/Make/options index d57f8a5..3c940bf 100644 --- a/testApp/Make/options +++ b/testApp/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I../diffusivityModel/diffusivityModel \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ @@ -12,6 +13,7 @@ EXE_LIBS = \ -lchemistryModel \ -lfiniteVolume \ -lmeshTools \ + -L$(FOAM_USER_LIBBIN) -ldiffusivityModel \ -pthread \ -lcantera \ -lsundials_cvodes -lsundials_ida -lsundials_nvecserial \ diff --git a/testApp/chemFoam.C b/testApp/chemFoam.C index bd6efe7..922ca53 100644 --- a/testApp/chemFoam.C +++ b/testApp/chemFoam.C @@ -43,6 +43,8 @@ Description #include "basicMultiComponentMixture.H" #include "cellModeller.H" +#include "diffusivityModel.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) @@ -62,34 +64,58 @@ int main(int argc, char *argv[]) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nStarting time loop\n" << endl; + Info<< "\nCreate Cantera object\n" << endl; Cantera::IdealGasMix gas_ ("gri30.xml", "gri30_mix"); Cantera::Transport *tr_ = Cantera::newTransportMgr("Mix", &gas_); label nCanteraSp_ = gas_.nSpecies(); - scalarField XY(nCanteraSp_, 0.0); + + Info<< "\nCreate temperature space\n" << endl; scalar Tl = 300; scalar Tu = 3000; - scalarField T01(100, 0.0); - forAll (T01, i) + scalarField T(100, 0.0); + forAll (T, i) { - T01[i] = i * (Tu - Tl) / 100. + Tl; + T[i] = i * (Tu - Tl) / scalar(T.size()) + Tl; } + + // initialize composition array + + scalarField XY(nCanteraSp_, 0.0); forAll(thermo.composition().species(), i) { XY[i] = Y[i][0]; } - forAll(T01, i) + + Info<< "\nTemperature Loop\n" << endl; + + forAll(T, i) { - gas_.setState_TPY(T01[i], p0, XY.data()); - Info << tr_->viscosity() << endl; + // OpenFOAM diffusivity model + thermo.T()[0] = T[i]; + thermo.he() = thermo.he(p, thermo.T()); + thermo.correct(); + diff.correct(); + + // Cantera gas transport + gas_.setState_TPY(T[i], p0, XY.data()); + + + scalarField Dc (composition.species().size(), 0.0); + tr_->getMixDiffCoeffsMass(Dc.data()); + + forAll(thermo.composition().species(), k) + { + Info << thermo.composition().species()[k] << tab << 100. * (diff.D(k)[0] - Dc[k]) / Dc[k] << endl; + } + + Info << "mu" << tab << 100.*(diff.mu()[0] - tr_->viscosity())/tr_->viscosity() << endl; } - Info << "Number of steps = " << runTime.timeIndex() << endl; Info << "End" << nl << endl; return 0; diff --git a/testApp/createFields.H b/testApp/createFields.H index f0d1a2b..9e0d087 100644 --- a/testApp/createFields.H +++ b/testApp/createFields.H @@ -62,3 +62,5 @@ 0.0 ) ); + + diffusivityModel diff(thermo);