#### View Issue Details

ID Project Category View Status Date Submitted Last Update 0003411 OpenFOAM Contribution public 2019-12-12 23:01 2020-01-13 09:58 blttkgl low feature N/A new open Unix Other (please specify) dev 0003411: MIxture fraction functionObject Mixture fraction (Z) is a normalized quantity for measuring the fuel/oxidizer ratio in a mixture, where Z=0 corresponds to pure oxidizer, and Z=1 corresponds to pure fuel. It is widely used by the researchers in combustion field. I attach a patch which includes a functionObject to create the mixture fraction Z field for multi-species solvers, for example reactingFoam, based on Armin Wehrfritz's original implementation. To be able to define what "oxidizer" and "fuel" are, user should define their chemical composition in a mixtureFractionProperties dictionary. That's why, I have also modified the counterFlowFlame2D_GRI tutorial to use this new mixtureFraction functionObject. The implementation is templated on the XiReactionRate functionObject, so I would say it follows OpenFOAM coding guidelines pretty well. Please let me know if you want something changed. Best, Bulut No tags attached.

#### Activities

 2019-12-12 23:01 reporter mixtureFraction.patch (18,563 bytes) `diff --git a/src/functionObjects/field/Make/files b/src/functionObjects/field/Make/files index 2b950187e..ad1c7705f 100644 --- a/src/functionObjects/field/Make/files +++ b/src/functionObjects/field/Make/files @@ -59,6 +59,7 @@ writeCellCentres/writeCellCentres.C writeCellVolumes/writeCellVolumes.C XiReactionRate/XiReactionRate.C +mixtureFraction/mixtureFraction.C streamFunction/streamFunction.C fieldsExpression/fieldsExpression.C diff --git a/src/functionObjects/field/Make/options b/src/functionObjects/field/Make/options index 5613d538a..d9a0004a8 100644 --- a/src/functionObjects/field/Make/options +++ b/src/functionObjects/field/Make/options @@ -11,7 +11,10 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ - -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude LIB_LIBS = \ -lfiniteVolume \ @@ -27,4 +30,5 @@ LIB_LIBS = \ -llagrangian \ -lfileFormats \ -lsampling \ - -lsurfMesh + -lsurfMesh \ + -lchemistryModel diff --git a/src/functionObjects/field/mixtureFraction/mixtureFraction.C b/src/functionObjects/field/mixtureFraction/mixtureFraction.C new file mode 100644 index 000000000..11a84947e --- /dev/null +++ b/src/functionObjects/field/mixtureFraction/mixtureFraction.C @@ -0,0 +1,337 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "mixtureFraction.H" +#include "volFields.H" +#include "fvcGrad.H" +#include "addToRunTimeSelectionTable.H" +#include "atomicWeights.H" +#include "psiReactionThermo.H" +#include "BasicChemistryModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + defineTypeNameAndDebug(mixtureFraction, 0); + addToRunTimeSelectionTable(functionObject, mixtureFraction, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::functionObjects::mixtureFraction::mixtureFraction +( + const word& name, + const Time& runTime, + const dictionary& dict +) +: + fvMeshFunctionObject(name, runTime, dict), + alpha(init_alpha()), + beta_of(init_beta()) +{ + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::functionObjects::mixtureFraction::~mixtureFraction() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +Foam::List Foam::functionObjects::mixtureFraction::init_alpha() const{ + + const IOdictionary mixFracDict + ( + IOobject + ( + "mixtureFractionProperties", + mesh_.time().constant(), + mesh_, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + const psiReactionThermo& thermo = mesh_.lookupObject("thermophysicalProperties"); + + const wordList& species_ = thermo.composition().species(); + List alpha(species_.size(), 0.0); + + forAll(alpha, i) + { + const dictionary& dict = mixFracDict.subDict(species_[i]).subDict("elements"); + scalar a0 + ( + 2.0 + *dict.lookupOrDefault