print mix avg D and mu over hard coded temperature range

This commit is contained in:
Yeongdo Park 2018-10-31 03:15:27 -04:00
parent 69ed413f5c
commit b55541d32e
3 changed files with 39 additions and 9 deletions

View file

@ -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 \

View file

@ -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;

View file

@ -62,3 +62,5 @@
0.0
)
);
diffusivityModel diff(thermo);