/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2026 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 "FSD.H" #include "addToRunTimeSelectionTable.H" #include "LESModel.H" #include "fviGrad.H" #include "fviDiv.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { namespace reactionModels { defineTypeNameAndDebug(FSD, 0); addToRunTimeSelectionTable(reactionModel, FSD, dictionary); } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::reactionModels::FSD::FSD ( const word& modelType, const fluidMulticomponentThermo& thermo, const compressibleMomentumTransportModel& turb, const word& reactionProperties ) : singleStepReaction ( modelType, thermo, turb, reactionProperties ), reactionRateFlameArea_ ( reactionRateFlameArea::New ( this->coeffs(), this->mesh(), *this ) ), ft_ ( IOobject ( this->thermo().phasePropertyName("ft"), this->mesh().time().name(), this->mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), this->mesh(), dimensionedScalar(dimless, 0) ), YFuelFuelStream_(dimensionedScalar(dimless, 1.0)), YO2OxiStream_(dimensionedScalar(dimless, 0.23)), Cv_(this->coeffs().template lookup("Cv")), C_(5), ftMin_(0), ftMax_(1), ftDim_(300), ftVarMin_(this->coeffs().template lookup("ftVarMin")) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::reactionModels::FSD::~FSD() {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // void Foam::reactionModels::FSD::calculateSourceNorm() { this->fresCorrect(); const label fuelI = this->fuelIndex(); const volScalarField& YFuel = this->thermo().Y()[fuelI]; const volScalarField& YO2 = this->thermo().Y("O2"); const dimensionedScalar s = this->s(); ft_ = (s*YFuel - (YO2 - YO2OxiStream_))/(s*YFuelFuelStream_ + YO2OxiStream_); volInternalVectorField nft(fvi::grad(ft_)); volInternalScalarField mgft(mag(nft)); const volInternalScalarField cAux(scalar(1) - ft_()); const dimensionedScalar dMgft = 1e-3* sum(ft_()*cAux*mgft*this->mesh().V()) /( sum(ft_()*cAux*this->mesh().V()) + dimensionedScalar(dimVolume, rootVSmall) ) + dimensionedScalar(mgft.dimensions(), small); mgft += dMgft; nft /= mgft; const volVectorField& U = YO2.db().lookupObject("U"); const volInternalScalarField sigma ( (nft & nft)*fvi::div(U) - (nft & fvi::grad(U) & nft) ); reactionRateFlameArea_->correct(sigma); const volScalarField& omegaFuel = reactionRateFlameArea_->omega(); const scalar ftStoich = YO2OxiStream_.value() /( s.value()*YFuelFuelStream_.value() + YO2OxiStream_.value() ); tmp tPc ( volScalarField::New ( this->thermo().phasePropertyName("Pc"), U.mesh(), dimensionedScalar(dimless, 0) ) ); volScalarField& pc = tPc.ref(); tmp tomegaFuel ( volScalarField::New ( this->thermo().phasePropertyName("omegaFuelBar"), U.mesh(), dimensionedScalar(omegaFuel.dimensions(), 0) ) ); volScalarField& omegaFuelBar = tomegaFuel.ref(); // Calculation of the mixture fraction variance (ftVar) const compressible::LESModel& lesModel = YO2.db().lookupObject ( momentumTransportModel::typeName ); const volInternalScalarField& delta = lesModel.delta(); const volInternalScalarField ftVar(Cv_*sqr(delta)*sqr(mgft)); // Thickened flame (average flame thickness for counterflow configuration // is 1.5 mm) const volScalarField deltaF ( lesModel.delta()/dimensionedScalar(dimensions::length, 1.5e-3) ); // Linear correlation between delta and flame thickness const volScalarField omegaF(max(deltaF*(4.0/3.0) + (2.0/3.0), scalar(1))); const scalar deltaFt = 1/ftDim_; forAll(ft_, celli) { if (ft_[celli] > ftMin_ && ft_[celli] < ftMax_) { const scalar ftCell = ft_[celli]; if (ftVar[celli] > ftVarMin_) // sub-grid beta pdf of ft_ { const scalar ftVarc = ftVar[celli]; const scalar a = max(ftCell*(ftCell*(1 - ftCell)/ftVarc - 1), 0); const scalar b = max(a/ftCell - a, 0); for (int i=1; i productsIndex(2, label(-1)); { label i = 0; forAll(this->specieProd(), specieI) { if (this->specieProd()[specieI] < 0) { productsIndex[i] = specieI; i++; } } } // Flamelet probability of the progress c based on IFC (reuse pc) scalar YprodTotal = 0; forAll(productsIndex, j) { YprodTotal += this->Yprod0()[productsIndex[j]]; } forAll(ft_, celli) { if (ft_[celli] < ftStoich) { pc[celli] = ft_[celli]*(YprodTotal/ftStoich); } else { pc[celli] = (1 - ft_[celli])*(YprodTotal/(1 - ftStoich)); } } tmp tproducts ( volScalarField::New ( this->thermo().phasePropertyName("products"), U.mesh(), dimensionedScalar(dimless, 0) ) ); volScalarField& products = tproducts.ref(); forAll(productsIndex, j) { const label specieI = productsIndex[j]; const volScalarField& Yp = this->thermo().Y()[specieI]; products += Yp; } volScalarField c ( max(scalar(1) - products/max(pc, scalar(1e-5)), scalar(0)) ); pc = min(C_*c, scalar(1)); const volScalarField fres(this->fres(fuelI)); this->wFuel_ = mgft*pc()*omegaFuelBar(); } void Foam::reactionModels::FSD::correct() { this->wFuel_ = dimensionedScalar(dimensions::density/dimensions::time, 0); calculateSourceNorm(); } bool Foam::reactionModels::FSD::read() { if (singleStepReaction::read()) { this->coeffs().lookup("Cv") >> Cv_ ; this->coeffs().lookup("ftVarMin") >> ftVarMin_; reactionRateFlameArea_->read(this->coeffs()); return true; } else { return false; } } // ************************************************************************* //