diff --git a/src/dfCombustionModels/CombustionModel/ThermoCombustion/ThermoCombustion.C b/src/dfCombustionModels/CombustionModel/ThermoCombustion/ThermoCombustion.C new file mode 100755 index 000000000..c2fb017a5 --- /dev/null +++ b/src/dfCombustionModels/CombustionModel/ThermoCombustion/ThermoCombustion.C @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2012-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 "ThermoCombustion.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ThermoCombustion::ThermoCombustion +( + const word& modelType, + ReactionThermo& thermo, + const compressibleTurbulenceModel& turb +) +: + CombustionModel + ( + modelType, + thermo, + turb, + combustionModel::combustionPropertiesName + ), + thermo_(thermo) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::ThermoCombustion::~ThermoCombustion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +ReactionThermo& +Foam::ThermoCombustion::thermo() +{ + return thermo_; +} + + +template +const ReactionThermo& +Foam::ThermoCombustion::thermo() const +{ + return thermo_; +} + + +// ************************************************************************* // diff --git a/src/dfCombustionModels/CombustionModel/ThermoCombustion/ThermoCombustion.H b/src/dfCombustionModels/CombustionModel/ThermoCombustion/ThermoCombustion.H new file mode 100755 index 000000000..a772f1c26 --- /dev/null +++ b/src/dfCombustionModels/CombustionModel/ThermoCombustion/ThermoCombustion.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2012-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 . + +Class + Foam::ThermoCombustion + +Description + Thermo model wrapper for combustion models + +SourceFiles + ThermoCombustion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ThermoCombustion_H +#define ThermoCombustion_H + +#include "autoPtr.H" +#include "CombustionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + class ThermoCombustion Declaration +\*---------------------------------------------------------------------------*/ + +template +class ThermoCombustion +: + public CombustionModel +{ +protected: + + // Protected data + + //- Thermo + ReactionThermo& thermo_; + + +public: + + // Constructors + + //- Construct from components + ThermoCombustion + ( + const word& modelType, + ReactionThermo& thermo, + const compressibleTurbulenceModel& turb + ); + + + //- Destructor + virtual ~ThermoCombustion(); + + + // Member Functions + + //- Return access to the thermo package + virtual ReactionThermo& thermo(); + + //- Return const access to the thermo package + virtual const ReactionThermo& thermo() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "ThermoCombustion.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dfCombustionModels/Make/files b/src/dfCombustionModels/Make/files index fb57b6ac0..6667f6f2c 100644 --- a/src/dfCombustionModels/Make/files +++ b/src/dfCombustionModels/Make/files @@ -4,7 +4,8 @@ CombustionModel/CombustionModel/CombustionModels.C FGM/FGMLiquidEvaporationBoil/FGMLiquidEvaporationBoils.C /*diffusion/diffusions.C*/ -/*infinitelyFastChemistry/infinitelyFastChemistrys.C*/ +infinitelyFastChemistry/infinitelyFastChemistrys.C +eddyDissipationModel/eddyDissipationModels.C PaSR/PaSRs.C EDC/EDCs.C diff --git a/src/dfCombustionModels/eddyDissipationModel/eddyDissipationModel.C b/src/dfCombustionModels/eddyDissipationModel/eddyDissipationModel.C new file mode 100644 index 000000000..c61fd3a4e --- /dev/null +++ b/src/dfCombustionModels/eddyDissipationModel/eddyDissipationModel.C @@ -0,0 +1,218 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2015 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 "eddyDissipationModel.H" +#include "turbulenceModel.H" +#include "turbulentFluidThermoModel.H" +#include "volFields.H" + +namespace Foam +{ +namespace combustionModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +eddyDissipationModel::eddyDissipationModel +( + const word& modelType, + ReactionThermo& thermo, + const compressibleTurbulenceModel& turb, + const word& combustionProperties +) +: + singleStepCombustion + ( + modelType, + thermo, + turb, + combustionProperties + ), + C_(readScalar(this->coeffs().lookup("C_EDC"))), + Cd_(readScalar(this->coeffs().lookup("C_Diff"))), + Cstiff_(readScalar(this->coeffs().lookup("C_Stiff"))), + PV_ + ( + IOobject + ( + "PV", + this->mesh().time().timeName(), + this->mesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + this->mesh(), + dimensionedScalar("zero",dimless,1.0) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +eddyDissipationModel::~eddyDissipationModel() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +Foam::tmp +eddyDissipationModel::rtTurb() const +{ + return C_*this->turbulence().epsilon()/ + max(this->turbulence().k(), + dimensionedScalar("SMALL",dimVelocity*dimVelocity,SMALL)); +} + +template +Foam::tmp +eddyDissipationModel::rtDiff() const +{ + const CanteraMixture& mixture_ = dynamic_cast(this->thermo()); + const volScalarField& YO2 = mixture_.Y("O2"); + const compressible::LESModel& lesModel = + YO2.db().lookupObject + ( + turbulenceModel::propertiesName + ); + + return Cd_*this->thermo().alpha()/this->rho()/sqr(lesModel.delta()); +} + +template +void eddyDissipationModel::correct() +{ + //- Set the product volume field, needed by alphat BC + calcPV(); + + this->wFuel_ == + dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0); + + // if (this->active()) + { + CanteraMixture& mixture_ = dynamic_cast(this->thermo()); + this->singleMixture_.fresCorrect(); + + const label fuelI = this->singleMixture_.fuelIndex(); + + const volScalarField& YFuel = mixture_.Y(fuelI); + + const dimensionedScalar s = this->singleMixture_.s(); + + if (mixture_.species().contains("O2")) + { + const volScalarField& YO2 = mixture_.Y("O2"); + +// this->wFuel_ == +// this->rho()/(this->mesh().time().deltaT()*C_) +// *min(YFuel, YO2/s.value()); + +/* + this->wFuel_ == + C_ + * this->rho() + * this->turbulence().epsilon() + / max(this->turbulence().k(), + dimensionedScalar("SMALL",dimVelocity*dimVelocity,SMALL)) + * min(YFuel, YO2/s.value()); +*/ + +/* + this->wFuel_ == + this->rho() + * min(YFuel, YO2/s.value()) + * max(rtTurb(),rtDiff()); +*/ + + volScalarField rt(max(rtTurb(),rtDiff())); + + // clipping of wFuel to prevent negative HRR + // this->wFuel_ == + // this->rho() + // * min(max(0*YFuel,YFuel), max(0*YO2,YO2)/s.value()) + // / this->mesh_.time().deltaT() * + // min(1./ Cstiff_* (1 - exp(- Cstiff_*this->mesh_.time().deltaT() * rt)),1.0); + + this->wFuel_ == + this->rho() + * min(YFuel, YO2/s.value()) + / this->mesh_.time().deltaT() / Cstiff_ + * (1 - exp(- Cstiff_*this->mesh_.time().deltaT() * rt)); + } + } +} + + +template +bool eddyDissipationModel::read() +{ + if (singleStepCombustion::read()) + { + this->coeffs().lookup("C") >> C_ ; + return true; + } + else + { + return false; + } +} + +template +label eddyDissipationModel::getParameter() const +{ + return 123; +} + +template +void eddyDissipationModel::calcPV() +{ + CanteraMixture& mixture_ = dynamic_cast(this->thermo()); + //- Get species mass fraction + const label fuelI = this->singleMixture_.fuelIndex(); + const volScalarField& YFuel = mixture_.Y(fuelI); + const volScalarField& YO2 = mixture_.Y("O2"); + const volScalarField& YCO2 = mixture_.Y("CO2"); + + const dimensionedScalar s = this->singleMixture_.s(); + + //- Get Mspecies/Mfuel from reaction equation + scalar rCO2(this->singleMixture_.specieStoichCoeffs() + [mixture_.species()["CO2"]]); + scalar rH2O(this->singleMixture_.specieStoichCoeffs() + [mixture_.species()["H2O"]]); + + PV_ = (YCO2*(1.0+rH2O/rCO2)+SMALL)/(YCO2*(1.0+rH2O/rCO2)+SMALL + min(YFuel,YO2/s.value())*(1.0+s.value())); + + return; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dfCombustionModels/eddyDissipationModel/eddyDissipationModel.H b/src/dfCombustionModels/eddyDissipationModel/eddyDissipationModel.H new file mode 100644 index 000000000..485c328b0 --- /dev/null +++ b/src/dfCombustionModels/eddyDissipationModel/eddyDissipationModel.H @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2015 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 . + +Class + Foam::combustionModels::eddyDissipationModel + +Group + grpCombustionModels + +Description + Simple infinitely fast chemistry combustion model based on the principle + mixed is burnt. Additional parameter C is used to distribute the heat + release rate.in time + +SourceFiles + eddyDissipationModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef eddyDissipationModel_H +#define eddyDissipationModel_H + +#include "singleStepCombustion.H" + +#include "LESModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + Class eddyDissipationModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class eddyDissipationModel +: + public singleStepCombustion +{ + // Private data + + //- Model constant + scalar C_; + + scalar Cd_; + + scalar Cstiff_; + + //- Product volume - used by alphat BC + + volScalarField PV_; + + // Private Member Functions + + //- Return the reciprocal of the turbulent mixing time scale + tmp rtTurb() const; + + //- Return the reciprocal of the diffusion time scale + tmp rtDiff() const; + + //- Calculate the product volume + void calcPV(); + + //- No copy construct + eddyDissipationModel(const eddyDissipationModel&) = delete; + + //- No copy assignment + void operator=(const eddyDissipationModel&) = delete; + + +public: + + //- Runtime type information + TypeName("eddyDissipationModel"); + + + // Constructors + + //- Construct from components + eddyDissipationModel + ( + const word& modelType, + ReactionThermo& thermo, + const compressibleTurbulenceModel& turb, + const word& combustionProperties + ); + + + //- Destructor + virtual ~eddyDissipationModel(); + + + // Member Functions + + //- Correct combustion rate + virtual void correct(); + + //- Update properties + virtual bool read(); + + label getParameter() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "eddyDissipationModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dfCombustionModels/eddyDissipationModel/eddyDissipationModels.C b/src/dfCombustionModels/eddyDissipationModel/eddyDissipationModels.C new file mode 100644 index 000000000..c039a03d3 --- /dev/null +++ b/src/dfCombustionModels/eddyDissipationModel/eddyDissipationModels.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2015 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 "makeCombustionTypes.H" +#include "basicThermo.H" +#include "eddyDissipationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +makeCombustionTypes +( + eddyDissipationModel, + basicThermo +); + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dfCombustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C b/src/dfCombustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C new file mode 100755 index 000000000..be43d17d5 --- /dev/null +++ b/src/dfCombustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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 "infinitelyFastChemistry.H" + +namespace Foam +{ +namespace combustionModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +infinitelyFastChemistry::infinitelyFastChemistry +( + const word& modelType, + ReactionThermo& thermo, + const compressibleTurbulenceModel& turb, + const word& combustionProperties +) +: + singleStepCombustion + ( + modelType, + thermo, + turb, + combustionProperties + ), + C_(readScalar(this->coeffs().lookup("C"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +infinitelyFastChemistry::~infinitelyFastChemistry() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +void infinitelyFastChemistry::correct() +{ + this->wFuel_ == + dimensionedScalar(dimMass/pow3(dimLength)/dimTime, 0); + + this->singleMixture_.fresCorrect(); + + const label fuelI = this->singleMixture_.fuelIndex(); + + const volScalarField& YFuel = this->singleMixture_.Y()[fuelI]; + + const dimensionedScalar s = this->singleMixture_.s(); + + if (this->singleMixture_.species().contains("O2")) + { + const volScalarField& YO2 = this->singleMixture_.Y("O2"); + + this->wFuel_ == + this->rho()/(this->mesh().time().deltaT()*C_) + *min(YFuel, YO2/s.value()); + } +} + + +template +bool infinitelyFastChemistry::read() +{ + if (singleStepCombustion::read()) + { + this->coeffs().lookup("C") >> C_ ; + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dfCombustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H b/src/dfCombustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H new file mode 100755 index 000000000..0d10aa6dc --- /dev/null +++ b/src/dfCombustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2019 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 . + +Class + Foam::combustionModels::infinitelyFastChemistry + +Description + Simple infinitely fast chemistry combustion model based on the principle + mixed is burnt. Additional parameter C is used to distribute the heat + release rate.in time + +SourceFiles + infinitelyFastChemistry.C + +\*---------------------------------------------------------------------------*/ + +#ifndef infinitelyFastChemistry_H +#define infinitelyFastChemistry_H + +#include "singleStepCombustion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + Class infinitelyFastChemistry Declaration +\*---------------------------------------------------------------------------*/ + +template +class infinitelyFastChemistry +: + public singleStepCombustion +{ + // Private Data + + //- Model constant + scalar C_; + + +public: + + //- Runtime type information + TypeName("infinitelyFastChemistry"); + + + // Constructors + + //- Construct from components + infinitelyFastChemistry + ( + const word& modelType, + ReactionThermo& thermo, + const compressibleTurbulenceModel& turb, + const word& combustionProperties + ); + + //- Disallow default bitwise copy construction + infinitelyFastChemistry(const infinitelyFastChemistry&); + + + //- Destructor + virtual ~infinitelyFastChemistry(); + + + // Member Functions + + //- Correct combustion rate + virtual void correct(); + + //- Update properties + virtual bool read(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const infinitelyFastChemistry&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "infinitelyFastChemistry.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dfCombustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C b/src/dfCombustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C new file mode 100755 index 000000000..e5ea04b04 --- /dev/null +++ b/src/dfCombustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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 "makeCombustionTypes.H" + +//#include "thermoPhysicsTypes.H" +//#include "psiReactionThermo.H" +//#include "rhoReactionThermo.H" +#include "basicThermo.H" +#include "infinitelyFastChemistry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Combustion models based on sensibleEnthalpy + +makeCombustionTypes +( + infinitelyFastChemistry, + basicThermo +); + + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dfCombustionModels/singleStepCombustion/singleStepCombustion.C b/src/dfCombustionModels/singleStepCombustion/singleStepCombustion.C new file mode 100755 index 000000000..575694af5 --- /dev/null +++ b/src/dfCombustionModels/singleStepCombustion/singleStepCombustion.C @@ -0,0 +1,141 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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 "singleStepCombustion.H" +#include "fvmSup.H" + +namespace Foam +{ +namespace combustionModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +singleStepCombustion::singleStepCombustion +( + const word& modelType, + ReactionThermo& thermo, + const compressibleTurbulenceModel& turb, + const word& combustionProperties +) +: + ThermoCombustion(modelType, thermo, turb), + singleMixture_(dynamic_cast(thermo)), + wFuel_ + ( + IOobject + ( + this->thermo().phasePropertyName("wFuel"), + this->mesh().time().timeName(), + this->mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mesh(), + dimensionedScalar(dimMass/dimVolume/dimTime, 0) + ), + semiImplicit_(readBool(this->coeffs_.lookup("semiImplicit"))) +{ + if (semiImplicit_) + { + Info<< "Combustion mode: semi-implicit" << endl; + } + else + { + Info<< "Combustion mode: explicit" << endl; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +singleStepCombustion::~singleStepCombustion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +tmp singleStepCombustion::R +( + volScalarField& Y +) const +{ + const label specieI =singleMixture_.species()[Y.member()]; + + volScalarField wSpecie + ( + wFuel_*singleMixture_.specieStoichCoeffs()[specieI] + ); + + if (semiImplicit_) + { + const label fNorm = singleMixture_.specieProd()[specieI]; + const volScalarField fres(singleMixture_.fres(specieI)); + wSpecie /= max(fNorm*(Y - fres), scalar(1e-2)); + + return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y); + } + else + { + return wSpecie + fvm::Sp(0.0*wSpecie, Y); + } +} + + +template +tmp +singleStepCombustion::Qdot() const +{ + const label fuelI = singleMixture_.fuelIndex(); + volScalarField& YFuel = + const_cast(singleMixture_.Y(fuelI)); + + return -singleMixture_.qFuel()*(R(YFuel) & YFuel); +} + + +template +bool singleStepCombustion::read() +{ + if (ThermoCombustion::read()) + { + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dfCombustionModels/singleStepCombustion/singleStepCombustion.H b/src/dfCombustionModels/singleStepCombustion/singleStepCombustion.H new file mode 100755 index 000000000..26f1497aa --- /dev/null +++ b/src/dfCombustionModels/singleStepCombustion/singleStepCombustion.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2019 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 . + +Class + Foam::combustionModels::singleStepCombustion + +Description + Base class for combustion models using singleStepReactingMixture. + +SourceFiles + singleStepCombustion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef singleStepCombustion_H +#define singleStepCombustion_H + +#include "dfSingleStepReactingMixture.H" +#include "ThermoCombustion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + Class singleStepCombustion Declaration +\*---------------------------------------------------------------------------*/ + +template +class singleStepCombustion +: + public ThermoCombustion +{ +protected: + + // Protected data + + //- Pointer to singleStepReactingMixture mixture + dfSingleStepReactingMixture& singleMixture_; + + //- Fuel consumption rate + volScalarField wFuel_; + + //- Semi-implicit (true) or explicit (false) treatment + bool semiImplicit_; + + +public: + + // Constructors + + //- Construct from components + singleStepCombustion + ( + const word& modelType, + ReactionThermo& thermo, + const compressibleTurbulenceModel& turb, + const word& combustionProperties + ); + + //- Disallow default bitwise copy construction + singleStepCombustion(const singleStepCombustion&); + + + //- Destructor + virtual ~singleStepCombustion(); + + + // Member Functions + + //- Fuel consumption rate matrix + virtual tmp R(volScalarField& Y) const; + + //- Heat release rate [kg/m/s^3] + virtual tmp Qdot() const; + + //- Update properties from given dictionary + virtual bool read(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const singleStepCombustion&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "singleStepCombustion.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //