diff --git a/src/ThermophysicalTransportModels/fluidReactionThermo/fluidReactionThermophysicalTransportModels.C b/src/ThermophysicalTransportModels/fluidReactionThermo/fluidReactionThermophysicalTransportModels.C index d18a7542e6..d5b3416ada 100644 --- a/src/ThermophysicalTransportModels/fluidReactionThermo/fluidReactionThermophysicalTransportModels.C +++ b/src/ThermophysicalTransportModels/fluidReactionThermo/fluidReactionThermophysicalTransportModels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,6 +45,9 @@ makeLaminarThermophysicalTransportModel(Fourier); #include "unityLewisFourier.H" makeLaminarThermophysicalTransportModel(unityLewisFourier); +#include "FickianFourier.H" +makeLaminarThermophysicalTransportModel(FickianFourier); + // -------------------------------------------------------------------------- // // RAS models diff --git a/src/ThermophysicalTransportModels/laminar/Fickian/Fickian.C b/src/ThermophysicalTransportModels/laminar/Fickian/Fickian.C new file mode 100644 index 0000000000..026ce20ea7 --- /dev/null +++ b/src/ThermophysicalTransportModels/laminar/Fickian/Fickian.C @@ -0,0 +1,391 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 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 "Fickian.H" +#include "fvcDiv.H" +#include "fvcLaplacian.H" +#include "fvcSnGrad.H" +#include "fvmSup.H" +#include "surfaceInterpolate.H" +#include "Function2Evaluate.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Fickian:: +Fickian +( + const word& type, + const momentumTransportModel& momentumTransport, + const thermoModel& thermo +) +: + BasicThermophysicalTransportModel + ( + type, + momentumTransport, + thermo + ), + + D_(this->thermo().composition().species().size()), + DT_ + ( + this->coeffDict_.found("DT") + ? this->thermo().composition().species().size() + : 0 + ) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool +Fickian::read() +{ + if + ( + BasicThermophysicalTransportModel::read() + ) + { + const speciesTable& species = this->thermo().composition().species(); + const dictionary& Ddict = this->coeffDict_.subDict("D"); + + forAll(species, i) + { + D_.set(i, Function2::New(species[i], Ddict).ptr()); + } + + if (this->coeffDict_.found("DT")) + { + const dictionary& DTdict = this->coeffDict_.subDict("DT"); + + forAll(species, i) + { + DT_.set(i, Function2::New(species[i], DTdict).ptr()); + } + } + + return true; + } + else + { + return false; + } +} + + +template +tmp +Fickian::DEff +( + const volScalarField& Yi +) const +{ + const basicSpecieMixture& composition = + this->thermo().composition(); + + return volScalarField::New + ( + "DEff", + this->momentumTransport().rho() + *evaluate + ( + D_[composition.index(Yi)], + dimViscosity, + this->thermo().p(), + this->thermo().T() + ) + ); +} + + +template +tmp +Fickian::DEff +( + const volScalarField& Yi, + const label patchi +) const +{ + const basicSpecieMixture& composition = + this->thermo().composition(); + + return + this->momentumTransport().rho().boundaryField()[patchi] + *D_[composition.index(Yi)].value + ( + this->thermo().p().boundaryField()[patchi], + this->thermo().T().boundaryField()[patchi] + ); +} + + +template +tmp +Fickian::q() const +{ + tmp tmpq + ( + surfaceScalarField::New + ( + IOobject::groupName + ( + "q", + this->momentumTransport().alphaRhoPhi().group() + ), + -fvc::interpolate(this->alpha()*this->kappaEff()) + *fvc::snGrad(this->thermo().T()) + ) + ); + + const basicSpecieMixture& composition = this->thermo().composition(); + const PtrList& Y = composition.Y(); + + if (Y.size()) + { + surfaceScalarField sumJ + ( + surfaceScalarField::New + ( + "sumJ", + Y[0].mesh(), + dimensionedScalar(dimMass/dimArea/dimTime, 0) + ) + ); + + surfaceScalarField sumJh + ( + surfaceScalarField::New + ( + "sumJh", + Y[0].mesh(), + dimensionedScalar(sumJ.dimensions()*dimEnergy/dimMass, 0) + ) + ); + + forAll(Y, i) + { + if (i != composition.defaultSpecie()) + { + const volScalarField hi + ( + composition.HE(i, this->thermo().p(), this->thermo().T()) + ); + + const surfaceScalarField ji(this->j(Y[i])); + sumJ += ji; + + sumJh += ji*fvc::interpolate(hi); + } + } + + { + const label i = composition.defaultSpecie(); + + const volScalarField hi + ( + composition.HE(i, this->thermo().p(), this->thermo().T()) + ); + + sumJh -= sumJ*fvc::interpolate(hi); + } + + tmpq.ref() += sumJh; + } + + return tmpq; +} + + +template +tmp +Fickian::divq(volScalarField& he) const +{ + tmp tmpDivq + ( + fvm::Su + ( + -fvc::laplacian(this->alpha()*this->kappaEff(), this->thermo().T()), + he + ) + ); + + const basicSpecieMixture& composition = this->thermo().composition(); + const PtrList& Y = composition.Y(); + + if (!Y.size()) + { + tmpDivq.ref() -= + correction(fvm::laplacian(this->alpha()*this->alphaEff(), he)); + } + else + { + tmpDivq.ref() -= fvm::laplacian(this->alpha()*this->alphaEff(), he); + + volScalarField heNew + ( + volScalarField::New + ( + "he", + he.mesh(), + dimensionedScalar(he.dimensions(), 0) + ) + ); + + surfaceScalarField sumJ + ( + surfaceScalarField::New + ( + "sumJ", + he.mesh(), + dimensionedScalar(dimMass/dimArea/dimTime, 0) + ) + ); + + surfaceScalarField sumJh + ( + surfaceScalarField::New + ( + "sumJh", + he.mesh(), + dimensionedScalar(sumJ.dimensions()*he.dimensions(), 0) + ) + ); + + forAll(Y, i) + { + if (i != composition.defaultSpecie()) + { + const volScalarField hi + ( + composition.HE(i, this->thermo().p(), this->thermo().T()) + ); + + heNew += Y[i]*hi; + + const surfaceScalarField ji(this->j(Y[i])); + sumJ += ji; + + sumJh += ji*fvc::interpolate(hi); + } + } + + { + const label i = composition.defaultSpecie(); + + const volScalarField hi + ( + composition.HE(i, this->thermo().p(), this->thermo().T()) + ); + + heNew += Y[i]*hi; + + sumJh -= sumJ*fvc::interpolate(hi); + } + + tmpDivq.ref() += + fvc::laplacian(this->alpha()*this->alphaEff(), heNew); + + tmpDivq.ref() += fvc::div(sumJh*he.mesh().magSf()); + } + + return tmpDivq; +} + + +template +tmp +Fickian::j +( + const volScalarField& Yi +) const +{ + if (DT_.size()) + { + const basicSpecieMixture& composition = this->thermo().composition(); + const volScalarField& p = this->thermo().T(); + const volScalarField& T = this->thermo().T(); + + return + BasicThermophysicalTransportModel::j(Yi) + - fvc::interpolate + ( + evaluate(DT_[composition.index(Yi)], dimDynamicViscosity, p, T) + ) + *fvc::snGrad(T)/fvc::interpolate(T); + } + else + { + return BasicThermophysicalTransportModel::j(Yi); + } +} + + +template +tmp +Fickian::divj(volScalarField& Yi) const +{ + if (DT_.size()) + { + const basicSpecieMixture& composition = this->thermo().composition(); + const volScalarField& p = this->thermo().T(); + const volScalarField& T = this->thermo().T(); + + return + BasicThermophysicalTransportModel::divj(Yi) + - fvc::div + ( + fvc::interpolate + ( + evaluate + ( + DT_[composition.index(Yi)], + dimDynamicViscosity, + p, + T + ) + ) + *fvc::snGrad(T)/fvc::interpolate(T) + *T.mesh().magSf() + ); + } + else + { + return BasicThermophysicalTransportModel::divj(Yi); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/laminar/Fickian/Fickian.H b/src/ThermophysicalTransportModels/laminar/Fickian/Fickian.H new file mode 100644 index 0000000000..bbd6e1cf71 --- /dev/null +++ b/src/ThermophysicalTransportModels/laminar/Fickian/Fickian.H @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 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::turbulenceThermophysicalTransportModels::Fickian + +Description + Base class for multi-component Fickian based temperature gradient heat + flux models with optional Soret thermal diffusion of species. + + Currently the diffusion coefficients are constant but temperature and + pressure dependency will be added. + + The heat flux source is implemented as an implicit energy correction to the + temperature gradient based flux source. At convergence the energy + correction is 0. + +SourceFiles + Fickian.C + +\*---------------------------------------------------------------------------*/ + +#include "Function2.H" + +#ifndef Fickian_H +#define Fickian_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class Fickian Declaration +\*---------------------------------------------------------------------------*/ + +template +class Fickian +: + public BasicThermophysicalTransportModel +{ + +protected: + + // Protected data + + // Model coefficients + + //- List of specie mass diffusion coefficient functions + // w.r.t the mixture [m^2/s] + PtrList> D_; + + //- List of specie Soret thermal diffusion coefficient + // functions [kg/m/s] + PtrList> DT_; + + +public: + + typedef typename BasicThermophysicalTransportModel::alphaField + alphaField; + + typedef typename + BasicThermophysicalTransportModel::momentumTransportModel + momentumTransportModel; + + typedef typename BasicThermophysicalTransportModel::thermoModel + thermoModel; + + + // Constructors + + //- Construct from a momentum transport model and a thermo model + Fickian + ( + const word& type, + const momentumTransportModel& momentumTransport, + const thermoModel& thermo + ); + + + //- Destructor + virtual ~Fickian() + {} + + + // Member Functions + + //- Read thermophysicalTransport dictionary + virtual bool read(); + + //- Effective mass diffusivity for a given specie mass-fraction [kg/m/s] + virtual tmp DEff(const volScalarField& Yi) const; + + //- Effective mass diffusivity for a given specie mass-fraction + // for patch [kg/m/s] + virtual tmp DEff + ( + const volScalarField& Yi, + const label patchi + ) const; + + //- Return the heat flux [W/m^2] + virtual tmp q() const; + + //- Return the source term for the energy equation + virtual tmp divq(volScalarField& he) const; + + //- Return the specie flux for the given specie mass-fraction [kg/m^2/s] + virtual tmp j(const volScalarField& Yi) const; + + //- Return the source term for the given specie mass-fraction equation + virtual tmp divj(volScalarField& Yi) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "Fickian.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/laminar/FickianFourier/FickianFourier.C b/src/ThermophysicalTransportModels/laminar/FickianFourier/FickianFourier.C new file mode 100644 index 0000000000..394298619d --- /dev/null +++ b/src/ThermophysicalTransportModels/laminar/FickianFourier/FickianFourier.C @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020-2021 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 "FickianFourier.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarThermophysicalTransportModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +FickianFourier:: +FickianFourier +( + const momentumTransportModel& momentumTransport, + const thermoModel& thermo +) +: + Fickian> + ( + typeName, + momentumTransport, + thermo + ) +{ + read(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool +FickianFourier::read() +{ + return Fickian + < + unityLewisFourier + >::read(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace laminarThermophysicalTransportModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/laminar/FickianFourier/FickianFourier.H b/src/ThermophysicalTransportModels/laminar/FickianFourier/FickianFourier.H new file mode 100644 index 0000000000..ed0655bcc7 --- /dev/null +++ b/src/ThermophysicalTransportModels/laminar/FickianFourier/FickianFourier.H @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020-2021 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::laminarThermophysicalTransportModels::FickianFourier + +Description + Multi-component Fickian and Fourier based temperature gradient heat flux + model laminar flow with optional Soret thermal diffusion of species. + + Currently the diffusion coefficients are constant but temperature and + pressure dependency will be added. + + The heat flux source is implemented as an implicit energy correction to the + temperature gradient based flux source. At convergence the energy + correction is 0. + +Usage + \verbatim + laminar + { + model FickianFourier; + + D (1e-5 2e-5 1e-5); // [m^2/s] + DT (1e-5 2e-5 1e-5); // [kg/m/s] Optional + } + \endverbatim + +SourceFiles + FickianFourier.C + +\*---------------------------------------------------------------------------*/ + +#include "Fickian.H" +#include "unityLewisFourier.H" + +#ifndef FickianFourier_H +#define FickianFourier_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarThermophysicalTransportModels +{ + +/*---------------------------------------------------------------------------*\ + Class FickianFourier Declaration +\*---------------------------------------------------------------------------*/ + +template +class FickianFourier +: + public Fickian + < + unityLewisFourier + > +{ + +protected: + + // Protected data + + // Model coefficients + + //- Turbulent Schmidt number [] + dimensionedScalar Sct_; + + +public: + + typedef typename laminarThermophysicalTransportModel::alphaField + alphaField; + + typedef typename + laminarThermophysicalTransportModel::momentumTransportModel + momentumTransportModel; + + typedef typename laminarThermophysicalTransportModel::thermoModel + thermoModel; + + + //- Runtime type information + TypeName("FickianFourier"); + + + // Constructors + + //- Construct from a momentum transport model and a thermo model + FickianFourier + ( + const momentumTransportModel& momentumTransport, + const thermoModel& thermo + ); + + + //- Destructor + virtual ~FickianFourier() + {} + + + // Member Functions + + //- Read thermophysicalTransport dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace laminarThermophysicalTransportModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "FickianFourier.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/ThermophysicalTransportModels/laminar/unityLewisFourier/unityLewisFourier.C b/src/ThermophysicalTransportModels/laminar/unityLewisFourier/unityLewisFourier.C index f2d613135d..e19cc84b9c 100644 --- a/src/ThermophysicalTransportModels/laminar/unityLewisFourier/unityLewisFourier.C +++ b/src/ThermophysicalTransportModels/laminar/unityLewisFourier/unityLewisFourier.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,7 +44,7 @@ unityLewisFourier::unityLewisFourier const thermoModel& thermo ) : - laminarThermophysicalTransportModel + unityLewisFourier ( typeName, momentumTransport, @@ -53,6 +53,23 @@ unityLewisFourier::unityLewisFourier {} +template +unityLewisFourier::unityLewisFourier +( + const word& type, + const momentumTransportModel& momentumTransport, + const thermoModel& thermo +) +: + laminarThermophysicalTransportModel + ( + type, + momentumTransport, + thermo + ) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -120,7 +137,7 @@ tmp unityLewisFourier:: divj(volScalarField& Yi) const { - return -fvm::laplacian(this->alpha()*this->thermo().alpha(), Yi); + return -fvm::laplacian(this->alpha()*this->DEff(Yi), Yi); } diff --git a/src/ThermophysicalTransportModels/laminar/unityLewisFourier/unityLewisFourier.H b/src/ThermophysicalTransportModels/laminar/unityLewisFourier/unityLewisFourier.H index 9081502dc7..f64a04cf83 100644 --- a/src/ThermophysicalTransportModels/laminar/unityLewisFourier/unityLewisFourier.H +++ b/src/ThermophysicalTransportModels/laminar/unityLewisFourier/unityLewisFourier.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,13 +76,22 @@ public: // Constructors - //- Construct from components + //- Construct from a momentum transport model and a thermo model unityLewisFourier ( const momentumTransportModel& momentumTransport, const thermoModel& thermo ); + //- Construct from a type name, a momentum transport model and a thermo + // model + unityLewisFourier + ( + const word& type, + const momentumTransportModel& momentumTransport, + const thermoModel& thermo + ); + //- Destructor virtual ~unityLewisFourier() diff --git a/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.C b/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.C index c31f4277f3..cf05dac6f2 100644 --- a/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.C +++ b/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.C @@ -24,12 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "FickianEddyDiffusivity.H" -#include "fvcDiv.H" -#include "fvcLaplacian.H" -#include "fvcSnGrad.H" -#include "fvmSup.H" -#include "surfaceInterpolate.H" -#include "Function2Evaluate.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,23 +42,14 @@ FickianEddyDiffusivity const thermoModel& thermo ) : - unityLewisEddyDiffusivity + Fickian> ( typeName, momentumTransport, - thermo, - false + thermo ), - Sct_("Sct", dimless, this->coeffDict_), - - D_(this->thermo().composition().species().size()), - DT_ - ( - this->coeffDict_.found("DT") - ? this->thermo().composition().species().size() - : 0 - ) + Sct_("Sct", dimless, this->coeffDict_) { read(); } @@ -78,30 +63,14 @@ FickianEddyDiffusivity::read() { if ( - unityLewisEddyDiffusivity - ::read() + Fickian + < + unityLewisEddyDiffusivity + >::read() ) { Sct_.read(this->coeffDict()); - const speciesTable& species = this->thermo().composition().species(); - const dictionary& Ddict = this->coeffDict_.subDict("D"); - - forAll(species, i) - { - D_.set(i, Function2::New(species[i], Ddict).ptr()); - } - - if (this->coeffDict_.found("DT")) - { - const dictionary& DTdict = this->coeffDict_.subDict("DT"); - - forAll(species, i) - { - DT_.set(i, Function2::New(species[i], DTdict).ptr()); - } - } - return true; } else @@ -118,20 +87,13 @@ FickianEddyDiffusivity::DEff const volScalarField& Yi ) const { - const basicSpecieMixture& composition = - this->thermo().composition(); - return volScalarField::New ( "DEff", - this->momentumTransport().rho() - *evaluate - ( - D_[composition.index(Yi)], - dimViscosity, - this->thermo().p(), - this->thermo().T() - ) + Fickian + < + unityLewisEddyDiffusivity + >::DEff(Yi) + (this->Prt_/Sct_)*this->alphat() ); } @@ -145,227 +107,15 @@ FickianEddyDiffusivity::DEff const label patchi ) const { - const basicSpecieMixture& composition = - this->thermo().composition(); - return - this->momentumTransport().rho().boundaryField()[patchi] - *D_[composition.index(Yi)].value - ( - this->thermo().p().boundaryField()[patchi], - this->thermo().T().boundaryField()[patchi] - ) + Fickian + < + unityLewisEddyDiffusivity + >::DEff(Yi, patchi) + this->Prt_.value()/Sct_.value()*this->alphat(patchi); } -template -tmp -FickianEddyDiffusivity::j -( - const volScalarField& Yi -) const -{ - if (DT_.size()) - { - const basicSpecieMixture& composition = this->thermo().composition(); - const volScalarField& p = this->thermo().T(); - const volScalarField& T = this->thermo().T(); - - return - unityLewisEddyDiffusivity:: - j(Yi) - - fvc::interpolate - ( - evaluate(DT_[composition.index(Yi)], dimDynamicViscosity, p, T) - ) - *fvc::snGrad(T)/fvc::interpolate(T); - } - else - { - return - unityLewisEddyDiffusivity:: - j(Yi); - } -} - - -template -tmp -FickianEddyDiffusivity::q() const -{ - tmp tmpq - ( - surfaceScalarField::New - ( - IOobject::groupName - ( - "q", - this->momentumTransport().alphaRhoPhi().group() - ), - -fvc::interpolate(this->alpha()*this->kappaEff()) - *fvc::snGrad(this->thermo().T()) - ) - ); - - const basicSpecieMixture& composition = this->thermo().composition(); - const PtrList& Y = composition.Y(); - - if (Y.size()) - { - surfaceScalarField sumJ - ( - surfaceScalarField::New - ( - "sumJ", - Y[0].mesh(), - dimensionedScalar(dimMass/dimArea/dimTime, 0) - ) - ); - - surfaceScalarField sumJh - ( - surfaceScalarField::New - ( - "sumJh", - Y[0].mesh(), - dimensionedScalar(sumJ.dimensions()*dimEnergy/dimMass, 0) - ) - ); - - forAll(Y, i) - { - if (i != composition.defaultSpecie()) - { - const volScalarField hi - ( - composition.HE(i, this->thermo().p(), this->thermo().T()) - ); - - const surfaceScalarField ji(this->j(Y[i])); - sumJ += ji; - - sumJh += ji*fvc::interpolate(hi); - } - } - - { - const label i = composition.defaultSpecie(); - - const volScalarField hi - ( - composition.HE(i, this->thermo().p(), this->thermo().T()) - ); - - sumJh -= sumJ*fvc::interpolate(hi); - } - - tmpq.ref() += sumJh; - } - - return tmpq; -} - - -template -tmp -FickianEddyDiffusivity::divq -( - volScalarField& he -) const -{ - tmp tmpDivq - ( - fvm::Su - ( - -fvc::laplacian(this->alpha()*this->kappaEff(), this->thermo().T()), - he - ) - ); - - const basicSpecieMixture& composition = this->thermo().composition(); - const PtrList& Y = composition.Y(); - - if (!Y.size()) - { - tmpDivq.ref() -= - correction(fvm::laplacian(this->alpha()*this->alphaEff(), he)); - } - else - { - tmpDivq.ref() -= fvm::laplacian(this->alpha()*this->alphaEff(), he); - - volScalarField heNew - ( - volScalarField::New - ( - "he", - he.mesh(), - dimensionedScalar(he.dimensions(), 0) - ) - ); - - surfaceScalarField sumJ - ( - surfaceScalarField::New - ( - "sumJ", - he.mesh(), - dimensionedScalar(dimMass/dimArea/dimTime, 0) - ) - ); - - surfaceScalarField sumJh - ( - surfaceScalarField::New - ( - "sumJh", - he.mesh(), - dimensionedScalar(sumJ.dimensions()*he.dimensions(), 0) - ) - ); - - forAll(Y, i) - { - if (i != composition.defaultSpecie()) - { - const volScalarField hi - ( - composition.HE(i, this->thermo().p(), this->thermo().T()) - ); - - heNew += Y[i]*hi; - - const surfaceScalarField ji(this->j(Y[i])); - sumJ += ji; - - sumJh += ji*fvc::interpolate(hi); - } - } - - { - const label i = composition.defaultSpecie(); - - const volScalarField hi - ( - composition.HE(i, this->thermo().p(), this->thermo().T()) - ); - - heNew += Y[i]*hi; - - sumJh -= sumJ*fvc::interpolate(hi); - } - - tmpDivq.ref() += - fvc::laplacian(this->alpha()*this->alphaEff(), heNew); - - tmpDivq.ref() += fvc::div(sumJh*he.mesh().magSf()); - } - - return tmpDivq; -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace turbulenceThermophysicalTransportModels diff --git a/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.H b/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.H index 77cf22d80b..8dbd955576 100644 --- a/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.H +++ b/src/ThermophysicalTransportModels/turbulence/FickianEddyDiffusivity/FickianEddyDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,8 +41,10 @@ Usage RAS { model FickianEddyDiffusivity; + Prt 0.85; Sct 0.7; + D (1e-5 2e-5 1e-5); // [m^2/s] DT (1e-5 2e-5 1e-5); // [kg/m/s] Optional } @@ -53,8 +55,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ +#include "Fickian.H" #include "unityLewisEddyDiffusivity.H" -#include "Function2.H" #ifndef FickianEddyDiffusivity_H #define FickianEddyDiffusivity_H @@ -73,7 +75,10 @@ namespace turbulenceThermophysicalTransportModels template class FickianEddyDiffusivity : - public unityLewisEddyDiffusivity + public Fickian + < + unityLewisEddyDiffusivity + > { protected: @@ -85,14 +90,6 @@ protected: //- Turbulent Schmidt number [] dimensionedScalar Sct_; - //- List of specie mass diffusion coefficient functions - // w.r.t the mixture [m^2/s] - PtrList> D_; - - //- List of specie Soret thermal diffusion coefficient - // functions [kg/m/s] - PtrList> DT_; - public: @@ -141,15 +138,6 @@ public: const volScalarField& Yi, const label patchi ) const; - - //- Return the heat flux [W/m^2] - virtual tmp q() const; - - //- Return the source term for the energy equation - virtual tmp divq(volScalarField& he) const; - - //- Return the specie flux for the given specie mass-fraction [kg/m^2/s] - virtual tmp j(const volScalarField& Yi) const; }; diff --git a/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H b/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H index e279a4ed58..a53e43c1fa 100644 --- a/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H +++ b/src/ThermophysicalTransportModels/turbulence/unityLewisEddyDiffusivity/unityLewisEddyDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -117,7 +117,7 @@ public: const word& type, const momentumTransportModel& momentumTransport, const thermoModel& thermo, - const bool allowDefaultPrt + const bool allowDefaultPrt = false );