diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C index 7cb0dee4b5..9fa097e3c4 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C @@ -57,6 +57,9 @@ makeBaseTurbulenceModel #include "Stokes.H" makeLaminarModel(Stokes); +#include "generalizedNewtonian.H" +makeLaminarModel(generalizedNewtonian); + #include "Maxwell.H" makeLaminarModel(Maxwell); diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C index 22c7fa5d9c..5dfbd29dae 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C @@ -55,6 +55,9 @@ makeBaseTurbulenceModel #include "Stokes.H" makeLaminarModel(Stokes); +#include "generalizedNewtonian.H" +makeLaminarModel(generalizedNewtonian); + #include "Maxwell.H" makeLaminarModel(Maxwell); diff --git a/src/TurbulenceModels/turbulenceModels/Make/files b/src/TurbulenceModels/turbulenceModels/Make/files index 25ef2d66df..f542cc7395 100644 --- a/src/TurbulenceModels/turbulenceModels/Make/files +++ b/src/TurbulenceModels/turbulenceModels/Make/files @@ -62,5 +62,14 @@ RASBCs = RAS/derivedFvPatchFields $(RASBCs)/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C $(RASBCs)/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +generalizedNewtonianViscosityModels = laminar/generalizedNewtonian/generalizedNewtonianViscosityModels +$(generalizedNewtonianViscosityModels)/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModel.C +$(generalizedNewtonianViscosityModels)/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModelNew.C +$(generalizedNewtonianViscosityModels)/CrossPowerLaw/CrossPowerLaw.C +$(generalizedNewtonianViscosityModels)/BirdCarreau/BirdCarreau.C +$(generalizedNewtonianViscosityModels)/Casson/Casson.C +$(generalizedNewtonianViscosityModels)/HerschelBulkley/HerschelBulkley.C +$(generalizedNewtonianViscosityModels)/powerLaw/powerLaw.C +$(generalizedNewtonianViscosityModels)/strainRateFunction/strainRateFunction.C LIB = $(FOAM_LIBBIN)/libturbulenceModels diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonian.C b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonian.C new file mode 100644 index 0000000000..17e1ddf0e2 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonian.C @@ -0,0 +1,212 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "generalizedNewtonian.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "fvcGrad.H" +#include "fvcDiv.H" +#include "fvmLaplacian.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +generalizedNewtonian::generalizedNewtonian +( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName +) +: + linearViscousStress> + ( + typeName, + alpha, + rho, + U, + alphaRhoPhi, + phi, + transport, + propertiesName + ), + + viscosityModel_ + ( + generalizedNewtonianViscosityModel::New + ( + this->coeffDict_ + ) + ), + + nu_ + ( + IOobject + ( + IOobject::groupName("generalizedNewtonian:nu", alphaRhoPhi.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + viscosityModel_->nu(this->nu(), strainRate()) + ) +{} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template +Foam::tmp +generalizedNewtonian::strainRate() const +{ + return sqrt(scalar{2})*mag(symm(fvc::grad(this->U()))); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool generalizedNewtonian::read() +{ + viscosityModel_->read(this->coeffDict_); + + return true; +} + + +template +tmp +generalizedNewtonian::nut() const +{ + return volScalarField::New + ( + IOobject::groupName("nut", this->alphaRhoPhi_.group()), + this->mesh_, + dimensionedScalar(dimViscosity, Zero) + ); +} + + +template +tmp +generalizedNewtonian::nut +( + const label patchi +) const +{ + return tmp::New(this->mesh_.boundary()[patchi].size(), Zero); +} + + +template +tmp +generalizedNewtonian::nuEff() const +{ + return volScalarField::New + ( + IOobject::groupName("nuEff", this->alphaRhoPhi_.group()), + nu_ + ); +} + + +template +tmp +generalizedNewtonian::nuEff +( + const label patchi +) const +{ + return nu_.boundaryField()[patchi]; +} + + +template +tmp +generalizedNewtonian::k() const +{ + return volScalarField::New + ( + IOobject::groupName("k", this->alphaRhoPhi_.group()), + this->mesh_, + dimensionedScalar(sqr(this->U_.dimensions()), Zero) + ); +} + + +template +tmp +generalizedNewtonian::epsilon() const +{ + return volScalarField::New + ( + IOobject::groupName("epsilon", this->alphaRhoPhi_.group()), + this->mesh_, + dimensionedScalar(sqr(this->U_.dimensions())/dimTime, Zero) + ); +} + + +template +tmp +generalizedNewtonian::R() const +{ + return volSymmTensorField::New + ( + IOobject::groupName("R", this->alphaRhoPhi_.group()), + this->mesh_, + dimensionedSymmTensor(sqr(this->U_.dimensions()), Zero) + ); +} + + +template +void generalizedNewtonian::correct() +{ + nu_ = viscosityModel_->nu(this->nu(), strainRate()); + laminarModel::correct(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace laminarModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonian.H b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonian.H new file mode 100644 index 0000000000..36f2cfbd4c --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonian.H @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation +------------------------------------------------------------------------------- +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::laminarModels::generalizedNewtonian + +Description + Turbulence model for shear-dependent Non-Newtonian flow. + +SourceFiles + generalizedNewtonian.C + +\*---------------------------------------------------------------------------*/ + +#ifndef generalizedNewtonian_H +#define generalizedNewtonian_H + +#include "laminarModel.H" +#include "linearViscousStress.H" +#include "generalizedNewtonianViscosityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ + +/*---------------------------------------------------------------------------*\ + Class generalizedNewtonian Declaration +\*---------------------------------------------------------------------------*/ + +template +class generalizedNewtonian +: + public linearViscousStress> +{ +protected: + + // Protected Data + + //- Run-time selectable non-Newtonian viscosity model + autoPtr viscosityModel_; + + //- The non-Newtonian viscosity field + volScalarField nu_; + + + // Protected Member Functions + + virtual tmp strainRate() const; + + +public: + + typedef typename BasicMomentumTransportModel::alphaField alphaField; + typedef typename BasicMomentumTransportModel::rhoField rhoField; + typedef typename BasicMomentumTransportModel::transportModel transportModel; + + + //- Runtime type information + TypeName("generalizedNewtonian"); + + + // Constructors + + //- Construct from components + generalizedNewtonian + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName + ); + + + // Selectors + + //- Return a reference to the selected turbulence model + static autoPtr New + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName + ); + + + //- Destructor + virtual ~generalizedNewtonian() = default; + + + // Member Functions + + //- Read turbulence (momentumTransport) dictionary + virtual bool read(); + + //- Return the turbulence viscosity, + virtual tmp nut() const; + + //- Return the turbulence viscosity on patch + virtual tmp nut(const label patchi) const; + + //- Return the effective viscosity + virtual tmp nuEff() const; + + //- Return the effective viscosity on patch + virtual tmp nuEff(const label patchi) const; + + //- Return the turbulence kinetic energy + virtual tmp k() const; + + //- Return the turbulence kinetic energy dissipation rate, + virtual tmp epsilon() const; + + //- Return the Reynolds stress tensor + virtual tmp R() const; + + //- Correct the generalizedNewtonian viscosity + virtual void correct(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace laminarModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "generalizedNewtonian.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/BirdCarreau/BirdCarreau.C b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/BirdCarreau/BirdCarreau.C new file mode 100644 index 0000000000..fcb6a3985a --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/BirdCarreau/BirdCarreau.C @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2017 OpenCFD Ltd +------------------------------------------------------------------------------- +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 "BirdCarreau.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + defineTypeNameAndDebug(BirdCarreau, 0); + addToRunTimeSelectionTable + ( + generalizedNewtonianViscosityModel, + BirdCarreau, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::laminarModels::generalizedNewtonianViscosityModels::BirdCarreau:: +BirdCarreau +( + const dictionary& viscosityProperties +) +: + generalizedNewtonianViscosityModel(viscosityProperties), + BirdCarreauCoeffs_ + ( + viscosityProperties.optionalSubDict(typeName + "Coeffs") + ), + nuInf_("nuInf", dimViscosity, BirdCarreauCoeffs_), + k_("k", dimTime, BirdCarreauCoeffs_), + n_("n", dimless, BirdCarreauCoeffs_), + a_ + ( + BirdCarreauCoeffs_.getOrDefault + ( + "a", + dimensionedScalar("a", dimless, 2) + ) + ) +{ + read(viscosityProperties); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::laminarModels::generalizedNewtonianViscosityModels::BirdCarreau:: +read +( + const dictionary& viscosityProperties +) +{ + generalizedNewtonianViscosityModel::read(viscosityProperties); + + BirdCarreauCoeffs_ = + viscosityProperties.optionalSubDict(typeName + "Coeffs"); + + BirdCarreauCoeffs_.readEntry("nuInf", nuInf_); + BirdCarreauCoeffs_.readEntry("k", k_); + BirdCarreauCoeffs_.readEntry("n", n_); + + a_ = BirdCarreauCoeffs_.getOrDefault + ( + "a", + dimensionedScalar("a", dimless, 2) + ); + + return true; +} + + +Foam::tmp +Foam::laminarModels::generalizedNewtonianViscosityModels::BirdCarreau:: +nu +( + const volScalarField& nu0, + const volScalarField& strainRate +) const +{ + return + ( + nuInf_ + + (nu0 - nuInf_) + * pow + ( + scalar(1) + + pow + ( + k_*strainRate, + a_ + ), + (n_ - scalar(1))/a_ + ) + ); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/BirdCarreau/BirdCarreau.H b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/BirdCarreau/BirdCarreau.H new file mode 100644 index 0000000000..1013b26b7e --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/BirdCarreau/BirdCarreau.H @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation +------------------------------------------------------------------------------- +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::laminarModels::generalizedNewtonianViscosityModels::BirdCarreau + +Description + An incompressible Bird-Carreau non-Newtonian viscosity model. + + The Bird-Carreau-Yasuda form is also supported if the optional "a" + coefficient is specified. "a" defaults to 2 for the Bird-Carreau model. + + Example specification for a polymer: + \verbatim + viscosityModel BirdCarreau; + + nuInf 0; + n 0.5; + \endverbatim + +SourceFiles + BirdCarreau.C + +\*---------------------------------------------------------------------------*/ + +#ifndef BirdCarreau_H +#define BirdCarreau_H + +#include "generalizedNewtonianViscosityModel.H" +#include "dimensionedScalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class BirdCarreau Declaration +\*---------------------------------------------------------------------------*/ + +class BirdCarreau +: + public generalizedNewtonianViscosityModel +{ + // Private Data + + dictionary BirdCarreauCoeffs_; + + dimensionedScalar nuInf_; + dimensionedScalar k_; + dimensionedScalar n_; + dimensionedScalar a_; + + +public: + + //- Runtime type information + TypeName("BirdCarreau"); + + + // Constructors + + //- Construct from dictionary (components) + explicit BirdCarreau(const dictionary& viscosityProperties); + + + //- Destructor + virtual ~BirdCarreau() = default; + + + // Member Functions + + //- Read transportProperties dictionary + virtual bool read(const dictionary& viscosityProperties); + + //- Return the laminar viscosity + virtual tmp nu + ( + const volScalarField& nu0, + const volScalarField& strainRate + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace generalizedNewtonianViscosityModels +} // End namespace laminarModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/Casson/Casson.C b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/Casson/Casson.C new file mode 100644 index 0000000000..02dcfcece7 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/Casson/Casson.C @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd +------------------------------------------------------------------------------- +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 "Casson.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + defineTypeNameAndDebug(Casson, 0); + addToRunTimeSelectionTable + ( + generalizedNewtonianViscosityModel, + Casson, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::laminarModels::generalizedNewtonianViscosityModels::Casson::Casson +( + const dictionary& viscosityProperties +) +: + generalizedNewtonianViscosityModel(viscosityProperties), + m_("m", dimViscosity, viscosityProperties), + tau0_("tau0", dimViscosity/dimTime, viscosityProperties), + nuMin_("nuMin", dimViscosity, viscosityProperties), + nuMax_("nuMax", dimViscosity, viscosityProperties) +{ + read(viscosityProperties); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::laminarModels::generalizedNewtonianViscosityModels::Casson::read +( + const dictionary& viscosityProperties +) +{ + generalizedNewtonianViscosityModel::read(viscosityProperties); + + const dictionary& coeffs = + viscosityProperties.optionalSubDict(typeName + "Coeffs"); + + coeffs.readEntry("m", m_); + coeffs.readEntry("tau0", tau0_); + coeffs.readEntry("nuMin_", nuMin_); + coeffs.readEntry("nuMax_", nuMax_); + + return true; +} + + +Foam::tmp +Foam::laminarModels::generalizedNewtonianViscosityModels::Casson:: +nu +( + const volScalarField& nu0, + const volScalarField& strainRate +) const +{ + return max + ( + nuMin_, + min + ( + nuMax_, + sqr + ( + sqrt + ( + tau0_ + /max + ( + strainRate, + dimensionedScalar("SMALL", dimless/dimTime, VSMALL) + ) + ) + sqrt(m_) + ) + ) + ); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/Casson/Casson.H b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/Casson/Casson.H new file mode 100644 index 0000000000..52f81b0e03 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/Casson/Casson.H @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation +------------------------------------------------------------------------------- +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::laminarModels::generalizedNewtonianViscosityModels::Casson + +Description + Casson generalized Newtonian viscosity model + + References: + \verbatim + Casson, N. (1959). + Rheology of disperse systems. + In Proceedings of a Conference Organized by the + British Society of Rheology. + Pergamon Press, New York. + + Fournier, R. L. (2011). + Basic transport phenomena in biomedical engineering. + CRC Press. + \endverbatim + + Example specification for blood: + \verbatim + viscosityModel Casson; + + m 3.934986e-6; + tau0 2.9032e-6; + nuMax 13.3333e-6; + nuMin 3.9047e-6; + \endverbatim + +SourceFiles + Casson.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Casson_H +#define Casson_H + +#include "generalizedNewtonianViscosityModel.H" +#include "dimensionedScalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + + +/*---------------------------------------------------------------------------*\ + Class Casson Declaration +\*---------------------------------------------------------------------------*/ + +class Casson +: + public generalizedNewtonianViscosityModel +{ + // Private Data + + dimensionedScalar m_; + dimensionedScalar tau0_; + dimensionedScalar nuMin_; + dimensionedScalar nuMax_; + + +public: + + //- Runtime type information + TypeName("Casson"); + + + // Constructors + + //- Construct from dictionary (components) + explicit Casson(const dictionary& viscosityProperties); + + + //- Destructor + virtual ~Casson() = default; + + + // Member Functions + + //- Read transportProperties dictionary + virtual bool read(const dictionary& viscosityProperties); + + //- Return the laminar viscosity + virtual tmp nu + ( + const volScalarField& nu0, + const volScalarField& strainRate + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace generalizedNewtonianViscosityModels +} // End namespace laminarModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/CrossPowerLaw/CrossPowerLaw.C b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/CrossPowerLaw/CrossPowerLaw.C new file mode 100644 index 0000000000..5dfb327b36 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/CrossPowerLaw/CrossPowerLaw.C @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "CrossPowerLaw.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + defineTypeNameAndDebug(CrossPowerLaw, 0); + + addToRunTimeSelectionTable + ( + generalizedNewtonianViscosityModel, + CrossPowerLaw, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::laminarModels::generalizedNewtonianViscosityModels::CrossPowerLaw:: +CrossPowerLaw +( + const dictionary& viscosityProperties +) +: + generalizedNewtonianViscosityModel(viscosityProperties), + CrossPowerLawCoeffs_ + ( + viscosityProperties.optionalSubDict(typeName + "Coeffs") + ), + nuInf_("nuInf", dimViscosity, CrossPowerLawCoeffs_), + m_("m", dimTime, CrossPowerLawCoeffs_), + n_("n", dimless, CrossPowerLawCoeffs_), + tauStar_("tauStar", dimViscosity/dimTime, CrossPowerLawCoeffs_) +{ + read(viscosityProperties); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::laminarModels::generalizedNewtonianViscosityModels::CrossPowerLaw:: +read +( + const dictionary& viscosityProperties +) +{ + generalizedNewtonianViscosityModel::read(viscosityProperties); + + CrossPowerLawCoeffs_ = + viscosityProperties.optionalSubDict(typeName + "Coeffs"); + + CrossPowerLawCoeffs_.readEntry("nuInf", nuInf_); + CrossPowerLawCoeffs_.readEntry("m", m_); + CrossPowerLawCoeffs_.readEntry("n", n_); + + return true; +} + + +Foam::tmp +Foam::laminarModels::generalizedNewtonianViscosityModels::CrossPowerLaw:: +nu +( + const volScalarField& nu0, + const volScalarField& strainRate +) const +{ + return + ( + nuInf_ + + (nu0 - nuInf_) + / + ( + scalar(1) + + pow + ( + (tauStar_.value() > 0) + ? nu0*strainRate/tauStar_ + : m_*strainRate, + n_ + ) + ) + ); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/CrossPowerLaw/CrossPowerLaw.H b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/CrossPowerLaw/CrossPowerLaw.H new file mode 100644 index 0000000000..f01cf1923c --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/CrossPowerLaw/CrossPowerLaw.H @@ -0,0 +1,138 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd +------------------------------------------------------------------------------- +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::laminarModels::generalizedNewtonianViscosityModels::CrossPowerLaw + +Description + Cross-Power law generalized Newtonian viscosity model + + The strain rate coefficient can be specified either as the constant \c m or + the critical stress level at the transition to shear thinning \c + tauStar if \c tauStar is provided: + + Kinematic viscosity [m^2/s] + + \f[ + \nu = \nu_\infty + \frac{(\nu_0 - \nu_\infty)}{1 + (m\gamma)^n} + \f] + + or + + \f[ + \nu = \nu_\infty + + \frac{(\nu_0 - \nu_\infty)} + {1 + \left(\frac{\nu_0\gamma}{\tau^*}\right)^n} + \f] + + Example specification: + \verbatim + viscosityModel CrossPowerLaw; + + nuInf 10; + m 0.4; + n 3; + \endverbatim + +SourceFiles + CrossPowerLaw.C + +\*---------------------------------------------------------------------------*/ + +#ifndef CrossPowerLaw_H +#define CrossPowerLaw_H + +#include "generalizedNewtonianViscosityModel.H" +#include "dimensionedScalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class CrossPowerLaw Declaration +\*---------------------------------------------------------------------------*/ + +class CrossPowerLaw +: + public generalizedNewtonianViscosityModel +{ + // Private Data + + dictionary CrossPowerLawCoeffs_; + + dimensionedScalar nuInf_; + dimensionedScalar m_; + dimensionedScalar n_; + dimensionedScalar tauStar_; + + +public: + + //- Runtime type information + TypeName("CrossPowerLaw"); + + + // Constructors + + //- Construct from dictionary (components) + explicit CrossPowerLaw(const dictionary& viscosityProperties); + + + //- Destructor + virtual ~CrossPowerLaw() = default; + + + // Member Functions + + //- Read transportProperties dictionary + virtual bool read(const dictionary& viscosityProperties); + + //- Return the laminar viscosity + virtual tmp nu + ( + const volScalarField& nu0, + const volScalarField& strainRate + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace generalizedNewtonianViscosityModels +} // End namespace laminarModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/HerschelBulkley/HerschelBulkley.C b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/HerschelBulkley/HerschelBulkley.C new file mode 100644 index 0000000000..971a695b4f --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/HerschelBulkley/HerschelBulkley.C @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "HerschelBulkley.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + defineTypeNameAndDebug(HerschelBulkley, 0); + + addToRunTimeSelectionTable + ( + generalizedNewtonianViscosityModel, + HerschelBulkley, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::laminarModels::generalizedNewtonianViscosityModels::HerschelBulkley:: +HerschelBulkley +( + const dictionary& viscosityProperties +) +: + generalizedNewtonianViscosityModel(viscosityProperties), + HerschelBulkleyCoeffs_ + ( + viscosityProperties.optionalSubDict(typeName + "Coeffs") + ), + k_("k", dimViscosity, HerschelBulkleyCoeffs_), + n_("n", dimless, HerschelBulkleyCoeffs_), + tau0_("tau0", dimViscosity/dimTime, HerschelBulkleyCoeffs_) +{ + read(viscosityProperties); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::laminarModels::generalizedNewtonianViscosityModels:: +HerschelBulkley::read +( + const dictionary& viscosityProperties +) +{ + generalizedNewtonianViscosityModel::read(viscosityProperties); + + HerschelBulkleyCoeffs_ = + viscosityProperties.optionalSubDict(typeName + "Coeffs"); + + HerschelBulkleyCoeffs_.readEntry("k", k_); + HerschelBulkleyCoeffs_.readEntry("n", n_); + HerschelBulkleyCoeffs_.readEntry("tau0", tau0_); + + return true; +} + + +Foam::tmp +Foam::laminarModels::generalizedNewtonianViscosityModels::HerschelBulkley:: +nu +( + const volScalarField& nu0, + const volScalarField& strainRate +) const +{ + const dimensionedScalar tone("tone", dimTime, 1); + const dimensionedScalar rtone("rtone", dimless/dimTime, 1); + + return + ( + min + ( + nu0, + (tau0_ + k_*rtone*pow(tone*strainRate, n_)) + /max + ( + strainRate, + dimensionedScalar("SMALL", dimless/dimTime, VSMALL) + ) + ) + ); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/HerschelBulkley/HerschelBulkley.H b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/HerschelBulkley/HerschelBulkley.H new file mode 100644 index 0000000000..0aab181594 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/HerschelBulkley/HerschelBulkley.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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::laminarModels::generalizedNewtonianViscosityModels::HerschelBulkley + +Description + Herschel-Bulkley generalized Newtonian viscosity model + +SourceFiles + HerschelBulkley.C + +\*---------------------------------------------------------------------------*/ + +#ifndef HerschelBulkley_H +#define HerschelBulkley_H + +#include "generalizedNewtonianViscosityModel.H" +#include "dimensionedScalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class HerschelBulkley Declaration +\*---------------------------------------------------------------------------*/ + +class HerschelBulkley +: + public generalizedNewtonianViscosityModel +{ + // Private Data + + dictionary HerschelBulkleyCoeffs_; + + dimensionedScalar k_; + dimensionedScalar n_; + dimensionedScalar tau0_; + + +public: + + //- Runtime type information + TypeName("HerschelBulkley"); + + + // Constructors + + //- Construct from dictionary (components) + explicit HerschelBulkley(const dictionary& viscosityProperties); + + + //- Destructor + virtual ~HerschelBulkley() = default; + + + // Member Functions + + //- Read transportProperties dictionary + virtual bool read(const dictionary& viscosityProperties); + + //- Return the laminar viscosity + virtual tmp nu + ( + const volScalarField& nu0, + const volScalarField& strainRate + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace generalizedNewtonianViscosityModels +} // End namespace laminarModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModel.C b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModel.C new file mode 100644 index 0000000000..b1433e25da --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModel.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation +------------------------------------------------------------------------------- +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 "generalizedNewtonianViscosityModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ + defineTypeNameAndDebug(generalizedNewtonianViscosityModel, 0); + defineRunTimeSelectionTable(generalizedNewtonianViscosityModel, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::laminarModels::generalizedNewtonianViscosityModel:: +generalizedNewtonianViscosityModel +( + const dictionary& viscosityProperties +) +: + viscosityProperties_(viscosityProperties) +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::laminarModels::generalizedNewtonianViscosityModel::read +( + const dictionary& viscosityProperties +) +{ + viscosityProperties_ = viscosityProperties; + + return true; +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModel.H b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModel.H new file mode 100644 index 0000000000..b801130159 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModel.H @@ -0,0 +1,156 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 . + +Namespace + Foam::laminarModels::generalizedNewtonianViscosityModels + +Description + A namespace for various generalized Newtonian viscosity model + implementations. + +Class + Foam::laminarModels::generalizedNewtonianViscosityModel + +Description + An abstract base class for generalized Newtonian viscosity models. + +SourceFiles + generalizedNewtonianViscosityModel.C + generalizedNewtonianViscosityModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef generalizedNewtonianViscosityModel_H +#define generalizedNewtonianViscosityModel_H + +#include "dictionary.H" +#include "volFieldsFwd.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ + +/*---------------------------------------------------------------------------*\ + Class generalizedNewtonianViscosityModel Declaration +\*---------------------------------------------------------------------------*/ + +class generalizedNewtonianViscosityModel +{ +protected: + + // Protected Data + + dictionary viscosityProperties_; + + +public: + + //- Runtime type information + TypeName("generalizedNewtonianViscosityModel"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + generalizedNewtonianViscosityModel, + dictionary, + ( + const dictionary& viscosityProperties + ), + (viscosityProperties) + ); + + + // Generated Methods + + //- No copy construct + generalizedNewtonianViscosityModel + ( + const generalizedNewtonianViscosityModel& + ) = delete; + + //- No copy assignment + void operator=(const generalizedNewtonianViscosityModel&) = delete; + + + // Selectors + + //- Select a viscosity model + static autoPtr New + ( + const dictionary& dict + ); + + + // Constructors + + //- Construct from dictionary (components) + explicit generalizedNewtonianViscosityModel + ( + const dictionary& viscosityProperties + ); + + + //- Destructor + virtual ~generalizedNewtonianViscosityModel() = default; + + + // Member Functions + + //- Return the phase transport properties dictionary + const dictionary& viscosityProperties() const + { + return viscosityProperties_; + } + + //- Return the laminar viscosity + virtual tmp nu + ( + const volScalarField& nu0, + const volScalarField& strainRate + ) const = 0; + + //- Read transportProperties dictionary + virtual bool read(const dictionary& viscosityProperties) = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace laminarModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModelNew.C b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModelNew.C new file mode 100644 index 0000000000..17ff06d370 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/generalizedNewtonianViscosityModel/generalizedNewtonianViscosityModelNew.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "generalizedNewtonianViscosityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::laminarModels::generalizedNewtonianViscosityModel::New +( + const dictionary& dict +) +{ + const word modelType(dict.get("viscosityModel")); + + Info<< "Selecting generalized Newtonian model " << modelType << endl; + + auto cstrIter = dictionaryConstructorTablePtr_->find(modelType); + + if (!cstrIter.found()) + { + FatalIOErrorInLookup + ( + dict, + "generalizedNewtonianViscosityModel", + modelType, + *dictionaryConstructorTablePtr_ + ) << exit(FatalIOError); + } + + return autoPtr(cstrIter()(dict)); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/powerLaw/powerLaw.C b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/powerLaw/powerLaw.C new file mode 100644 index 0000000000..833908189b --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/powerLaw/powerLaw.C @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "powerLaw.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + defineTypeNameAndDebug(powerLaw, 0); + + addToRunTimeSelectionTable + ( + generalizedNewtonianViscosityModel, + powerLaw, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::laminarModels::generalizedNewtonianViscosityModels::powerLaw::powerLaw +( + const dictionary& viscosityProperties +) +: + generalizedNewtonianViscosityModel(viscosityProperties), + powerLawCoeffs_(viscosityProperties.optionalSubDict(typeName + "Coeffs")), + k_("k", dimViscosity, powerLawCoeffs_), + n_("n", dimless, powerLawCoeffs_), + nuMin_("nuMin", dimViscosity, powerLawCoeffs_), + nuMax_("nuMax", dimViscosity, powerLawCoeffs_) +{ + read(viscosityProperties); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::laminarModels::generalizedNewtonianViscosityModels::powerLaw::read +( + const dictionary& viscosityProperties +) +{ + generalizedNewtonianViscosityModel::read(viscosityProperties); + + powerLawCoeffs_ = viscosityProperties.optionalSubDict(typeName + "Coeffs"); + + powerLawCoeffs_.readEntry("k", k_); + powerLawCoeffs_.readEntry("n", n_); + powerLawCoeffs_.readEntry("nuMin", nuMin_); + powerLawCoeffs_.readEntry("nuMax", nuMax_); + + return true; +} + + +Foam::tmp +Foam::laminarModels::generalizedNewtonianViscosityModels::powerLaw:: +nu +( + const volScalarField& nu0, + const volScalarField& strainRate +) const +{ + return max + ( + nuMin_, + min + ( + nuMax_, + k_*pow + ( + max + ( + dimensionedScalar("one", dimTime, 1)*strainRate, + dimensionedScalar("small", dimless, SMALL) + ), + n_.value() - scalar(1) + ) + ) + ); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/powerLaw/powerLaw.H b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/powerLaw/powerLaw.H new file mode 100644 index 0000000000..2b441de2d8 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/powerLaw/powerLaw.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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::laminarModels::generalizedNewtonianViscosityModels::powerLaw + +Description + Standard power-law generalized Newtonian viscosity model + +SourceFiles + powerLaw.C + +\*---------------------------------------------------------------------------*/ + +#ifndef powerLaw_H +#define powerLaw_H + +#include "generalizedNewtonianViscosityModel.H" +#include "dimensionedScalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class powerLaw Declaration +\*---------------------------------------------------------------------------*/ + +class powerLaw +: + public generalizedNewtonianViscosityModel +{ + // Private Data + + dictionary powerLawCoeffs_; + + dimensionedScalar k_; + dimensionedScalar n_; + dimensionedScalar nuMin_; + dimensionedScalar nuMax_; + + +public: + + //- Runtime type information + TypeName("powerLaw"); + + + // Constructors + + //- Construct from components + explicit powerLaw(const dictionary& viscosityProperties); + + + //- Destructor + virtual ~powerLaw() = default; + + + // Member Functions + + //- Read transportProperties dictionary + virtual bool read(const dictionary& viscosityProperties); + + //- Return the laminar viscosity + virtual tmp nu + ( + const volScalarField& nu0, + const volScalarField& strainRate + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace generalizedNewtonianViscosityModels +} // End namespace laminarModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/strainRateFunction/strainRateFunction.C b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/strainRateFunction/strainRateFunction.C new file mode 100644 index 0000000000..e86523348a --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/strainRateFunction/strainRateFunction.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "strainRateFunction.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + defineTypeNameAndDebug(strainRateFunction, 0); + + addToRunTimeSelectionTable + ( + generalizedNewtonianViscosityModel, + strainRateFunction, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::laminarModels::generalizedNewtonianViscosityModels::strainRateFunction:: +strainRateFunction +( + const dictionary& viscosityProperties +) +: + generalizedNewtonianViscosityModel(viscosityProperties), + strainRateFunctionCoeffs_ + ( + viscosityProperties.optionalSubDict(typeName + "Coeffs") + ), + strainRateFunction_ + ( + Function1::New("function", strainRateFunctionCoeffs_) + ) +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::laminarModels::generalizedNewtonianViscosityModels:: +strainRateFunction::read +( + const dictionary& viscosityProperties +) +{ + generalizedNewtonianViscosityModel::read(viscosityProperties); + + strainRateFunctionCoeffs_ = + viscosityProperties.optionalSubDict(typeName + "Coeffs"); + + strainRateFunction_.reset(); + strainRateFunction_ = Function1::New + ( + "function", + strainRateFunctionCoeffs_ + ); + + return true; +} + + +Foam::tmp +Foam::laminarModels::generalizedNewtonianViscosityModels::strainRateFunction:: +nu +( + const volScalarField& nu0, + const volScalarField& strainRate +) const +{ + auto tnu = + volScalarField::New + ( + IOobject::groupName(type() + ":nu", nu0.group()), + nu0.mesh(), + dimensionedScalar(dimViscosity, Zero) + ); + + tnu.ref().primitiveFieldRef() = strainRateFunction_->value(strainRate); + + volScalarField::Boundary& nuBf = tnu.ref().boundaryFieldRef(); + const volScalarField::Boundary& sigmaBf = strainRate.boundaryField(); + + forAll(nuBf, patchi) + { + nuBf[patchi] = strainRateFunction_->value(sigmaBf[patchi]); + } + + return tnu; +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/strainRateFunction/strainRateFunction.H b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/strainRateFunction/strainRateFunction.H new file mode 100644 index 0000000000..6caef1e224 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/generalizedNewtonian/generalizedNewtonianViscosityModels/strainRateFunction/strainRateFunction.H @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2018-2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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::laminarModels::generalizedNewtonianViscosityModels::strainRateFunction + +Description + Run-time selected strain-rate function generalized Newtonian viscosity model + + Example linear function of strain-rate: + \verbatim + generalizedNewtonianModel strainRateFunction; + + function polynomial ((0 0.1) (1 1.3)); + \endverbatim + +See also + Foam::generalizedNewtonianViscosityModel + Foam::Function1 + +SourceFiles + strainRateFunction.C + +\*---------------------------------------------------------------------------*/ + +#ifndef strainRateFunction_H +#define strainRateFunction_H + +#include "generalizedNewtonianViscosityModel.H" +#include "Function1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ +namespace generalizedNewtonianViscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class strainRateFunction Declaration +\*---------------------------------------------------------------------------*/ + +class strainRateFunction +: + public generalizedNewtonianViscosityModel +{ + // Private Data + + //- Coefficients dictionary + dictionary strainRateFunctionCoeffs_; + + //- Strain-rate function + autoPtr> strainRateFunction_; + + +public: + + //- Runtime type information + TypeName("strainRateFunction"); + + + // Constructors + + //- Construct from dictionary (components) + explicit strainRateFunction(const dictionary& viscosityProperties); + + + //- Destructor + virtual ~strainRateFunction() = default; + + + // Member Functions + + //- Read transportProperties dictionary + virtual bool read(const dictionary& viscosityProperties); + + //- Return the laminar viscosity + virtual tmp nu + ( + const volScalarField& nu0, + const volScalarField& strainRate + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace generalizedNewtonianViscosityModels +} // End namespace laminarModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C index 7789ebbe91..92116fc82d 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,6 +38,7 @@ License #include "perfectFluid.H" #include "PengRobinsonGas.H" #include "adiabaticPerfectFluid.H" +#include "icoTabulated.H" #include "hConstThermo.H" #include "eConstThermo.H" @@ -61,7 +63,7 @@ License namespace Foam { -/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * Private Static Data * * * * * * * * * * * * * */ makeThermos ( @@ -135,6 +137,18 @@ makeThermos specie ); +makeThermos +( + rhoThermo, + heRhoThermo, + pureMixture, + constTransport, + sensibleEnthalpy, + hConstThermo, + icoTabulated, + specie +); + makeThermos ( rhoThermo, @@ -195,6 +209,18 @@ makeThermos specie ); +makeThermos +( + rhoThermo, + heRhoThermo, + pureMixture, + sutherlandTransport, + sensibleEnthalpy, + hConstThermo, + icoTabulated, + specie +); + makeThermos ( rhoThermo, @@ -207,6 +233,18 @@ makeThermos specie ); +makeThermos +( + rhoThermo, + heRhoThermo, + pureMixture, + sutherlandTransport, + sensibleEnthalpy, + janafThermo, + icoTabulated, + specie +); + makeThermos ( rhoThermo, @@ -267,6 +305,18 @@ makeThermos specie ); +makeThermos +( + rhoThermo, + heRhoThermo, + pureMixture, + polynomialTransport, + sensibleEnthalpy, + hPolynomialThermo, + icoTabulated, + specie +); + makeThermos ( rhoThermo, @@ -293,6 +343,18 @@ makeThermos specie ); +makeThermos +( + rhoThermo, + heRhoThermo, + pureMixture, + constTransport, + sensibleInternalEnergy, + hConstThermo, + icoTabulated, + specie +); + makeThermos ( rhoThermo, @@ -305,6 +367,18 @@ makeThermos specie ); +makeThermos +( + rhoThermo, + heRhoThermo, + pureMixture, + sutherlandTransport, + sensibleInternalEnergy, + hConstThermo, + icoTabulated, + specie +); + makeThermos ( rhoThermo, @@ -317,6 +391,18 @@ makeThermos specie ); +makeThermos +( + rhoThermo, + heRhoThermo, + pureMixture, + sutherlandTransport, + sensibleInternalEnergy, + janafThermo, + icoTabulated, + specie +); + makeThermos ( rhoThermo, @@ -427,6 +513,18 @@ makeThermos specie ); +makeThermos +( + rhoThermo, + heRhoThermo, + pureMixture, + polynomialTransport, + sensibleInternalEnergy, + hPolynomialThermo, + icoTabulated, + specie +); + makeThermos ( rhoThermo, diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.C b/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.C index 50b2f1415e..a1e6cc4551 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.C +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.C @@ -28,12 +28,6 @@ License #include "absorptionCoeffs.H" #include "IOstreams.H" -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -Foam::radiation::absorptionCoeffs::~absorptionCoeffs() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::radiation::absorptionCoeffs::checkT(const scalar T) const diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.H b/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.H index 600a4f4d5a..3b5b7af490 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.H +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.H @@ -66,14 +66,8 @@ private: // Private data - // Temperature limits of applicability for functions - - scalar Tcommon_; - - scalar Tlow_; - - scalar Thigh_; - + // Temperature limits of applicability of functions + scalar Tlow_, Thigh_, Tcommon_; // Polynomial using inverse temperatures bool invTemp_; @@ -92,13 +86,12 @@ public: // Constructors - // Null constructor - absorptionCoeffs() - {} + //- Default construct + absorptionCoeffs() = default; //- Destructor - ~absorptionCoeffs(); + ~absorptionCoeffs() = default; // Member functions diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffsI.H b/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffsI.H index 10b8100baf..590c434d5c 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffsI.H +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffsI.H @@ -27,39 +27,39 @@ License inline bool Foam::radiation::absorptionCoeffs::invTemp() const { - return invTemp_; + return invTemp_; } inline Foam::scalar Foam::radiation::absorptionCoeffs::Tcommon() const { - return Tcommon_; + return Tcommon_; } inline Foam::scalar Foam::radiation::absorptionCoeffs::Tlow() const { - return Tlow_; + return Tlow_; } inline Foam::scalar Foam::radiation::absorptionCoeffs::Thigh() const { - return Thigh_; + return Thigh_; } inline const Foam::radiation::absorptionCoeffs::coeffArray& Foam::radiation::absorptionCoeffs::highACoeffs() const { - return highACoeffs_; + return highACoeffs_; } inline const Foam::radiation::absorptionCoeffs::coeffArray& Foam::radiation::absorptionCoeffs::lowACoeffs() const { - return lowACoeffs_; + return lowACoeffs_; } diff --git a/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.C b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.C new file mode 100644 index 0000000000..104f4b3b21 --- /dev/null +++ b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "icoTabulated.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::icoTabulated::icoTabulated(const dictionary& dict) +: + Specie(dict), + rho_("rho", dict.subDict("equationOfState")) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::icoTabulated::write(Ostream& os) const +{ + Specie::write(os); + + // Entries in dictionary format + os.beginBlock("equationOfState"); + os.writeEntry("rho", rho_); + os.endBlock(); +} + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + +template +Foam::Ostream& Foam::operator<<(Ostream& os, const icoTabulated& ip) +{ + ip.write(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.H b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.H new file mode 100644 index 0000000000..fa9c127206 --- /dev/null +++ b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.H @@ -0,0 +1,197 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenFOAM Foundation +------------------------------------------------------------------------------- +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::icoTabulated + +Description + Incompressible of equation of state using non-uniform tabulated + density vs temperature. + +Usage + \table + Property | Description + rho | Density vs temperature table + \endtable + + Example of the specification of the equation of state: + \verbatim + equationOfState + { + rho + ( + (200 1010) + (350 1000) + (400 980) + ); + } + \endverbatim + +SourceFiles + icoTabulatedI.H + icoTabulated.C + +See also + Foam::thermophysicalFunctions::nonUniformTable + +\*---------------------------------------------------------------------------*/ + +#ifndef icoTabulated_H +#define icoTabulated_H + +#include "nonUniformTableThermophysicalFunction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward Declarations + +template class icoTabulated; + +template +Ostream& operator<<(Ostream& os, const icoTabulated&); + + +/*---------------------------------------------------------------------------*\ + Class icoTabulated Declaration +\*---------------------------------------------------------------------------*/ + +template +class icoTabulated +: + public Specie +{ + // Private Data + + //- Density table [kg/m^3] + nonUniformTable rho_; + + +public: + + // Constructors + + //- Construct from components + inline icoTabulated + ( + const Specie& sp, + const nonUniformTable& rho + ); + + //- Construct from dictionary + explicit icoTabulated(const dictionary& dict); + + //- Construct as named copy + inline icoTabulated(const word& name, const icoTabulated&); + + //- Construct and return a clone + inline autoPtr clone() const; + + //- Selector from dictionary + inline static autoPtr New(const dictionary& dict); + + + // Member Functions + + //- The instantiated type name + static word typeName() + { + return "icoTabulated<" + word(Specie::typeName_()) + '>'; + } + + + // Fundamental Properties + + //- Is the equation of state is incompressible i.e. rho != f(p) + static const bool incompressible = true; + + //- Is the equation of state is isochoric i.e. rho = const + static const bool isochoric = false; + + //- Return density [kg/m^3] + inline scalar rho(scalar p, scalar T) const; + + //- Return enthalpy contribution [J/kg] + inline scalar H(const scalar p, const scalar T) const; + + //- Return Cp contribution [J/(kg K] + inline scalar Cp(scalar p, scalar T) const; + + //- Return internal energy contribution [J/kg] + inline scalar E(const scalar p, const scalar T) const; + + //- Return Cv contribution [J/(kg K] + inline scalar Cv(scalar p, scalar T) const; + + //- Return entropy contribution to the integral of Cp/T [J/kg/K] + inline scalar S(const scalar p, const scalar T) const; + + //- Return compressibility [s^2/m^2] + inline scalar psi(scalar p, scalar T) const; + + //- Return compression factor [] + inline scalar Z(scalar p, scalar T) const; + + //- Return (Cp - Cv) [J/(kg K] + inline scalar CpMCv(scalar p, scalar T) const; + + + // IO + + //- Write to Ostream + void write(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const icoTabulated& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "icoTabulatedI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "icoTabulated.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulatedI.H b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulatedI.H new file mode 100644 index 0000000000..8a7399850b --- /dev/null +++ b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulatedI.H @@ -0,0 +1,176 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "icoTabulated.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +inline Foam::icoTabulated::icoTabulated +( + const Specie& sp, + const nonUniformTable& rho +) +: + Specie(sp), + rho_(rho) +{} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +inline Foam::icoTabulated::icoTabulated +( + const word& name, + const icoTabulated& ip +) +: + Specie(name, ip), + rho_(ip.rho_) +{} + + +template +inline Foam::autoPtr> +Foam::icoTabulated::clone() const +{ + return autoPtr>::New(*this); +} + + +template +inline Foam::autoPtr> +Foam::icoTabulated::New(const dictionary& dict) +{ + return autoPtr>::New(dict); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::icoTabulated::rho +( + scalar p, + scalar T +) const +{ + return rho_.f(p, T); +} + + +template +inline Foam::scalar Foam::icoTabulated::H +( + scalar p, + scalar T +) const +{ + return p/this->rho(p, T); +} + + +template +inline Foam::scalar Foam::icoTabulated::Cp +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::E +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::Cv +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::S +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::psi +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::Z +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::CpMCv +( + scalar p, + scalar T +) const +{ + return 0; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H index 1b1c4b2eef..074b8d1c89 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H @@ -138,7 +138,7 @@ public: return "eConst<" + EquationOfState::typeName() + '>'; } - //- Limit the temperature to be in the range Tlow_ to Thigh_ + //- Limit temperature to be within the range inline scalar limit(const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermo.H b/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermo.H index 4c86f6197f..c009ccc3dc 100644 --- a/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/eRefConst/eRefConstThermo.H @@ -140,7 +140,7 @@ public: return "eRefConst<" + EquationOfState::typeName() + '>'; } - //- Limit the temperature to be in the range Tlow_ to Thigh_ + //- Limit temperature to be within the range inline scalar limit(const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H index ccc06817c5..508efec076 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H @@ -131,7 +131,7 @@ public: return "hConst<" + EquationOfState::typeName() + '>'; } - //- Limit the temperature to be in the range Tlow_ to Thigh_ + //- Limit temperature to be within the range inline scalar limit(const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H index 53fa23425d..7ab292c1b2 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H @@ -191,7 +191,7 @@ public: return "hPolynomial<" + EquationOfState::typeName() + '>'; } - //- Limit the temperature to be in the range Tlow_ to Thigh_ + //- Limit temperature to be within the range inline scalar limit(const scalar) const; diff --git a/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H index 56282a4ca5..e2479283b6 100644 --- a/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H +++ b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H @@ -152,7 +152,7 @@ public: return "hPower<" + EquationOfState::typeName() + '>'; } - //- Limit the temperature to be in the range Tlow_ to Thigh_ + //- Limit temperature to be within the range inline scalar limit(const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermo.H b/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermo.H index 17c2cdb95e..16351f452c 100644 --- a/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/hRefConst/hRefConstThermo.H @@ -89,7 +89,7 @@ class hRefConstThermo : public EquationOfState { - // Private data + // Private Data scalar Cp_; scalar Hf_; @@ -135,7 +135,7 @@ public: return "hRefConst<" + EquationOfState::typeName() + '>'; } - //- Limit the temperature to be in the range Tlow_ to Thigh_ + //- Limit temperature to be within the range inline scalar limit(const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H index 98830ce41d..72661d11bd 100644 --- a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H +++ b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H @@ -50,7 +50,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class janafThermo; @@ -92,18 +92,17 @@ class janafThermo : public EquationOfState { - public: - // Public data + // Public Data - static const int nCoeffs_ = 7; + static constexpr int nCoeffs_ = 7; typedef FixedList coeffArray; private: - // Private data + // Private Data // Temperature limits of applicability of functions scalar Tlow_, Thigh_, Tcommon_; diff --git a/src/thermophysicalModels/thermophysicalProperties/Make/files b/src/thermophysicalModels/thermophysicalProperties/Make/files index 0ca2221441..a8f3fce2c9 100644 --- a/src/thermophysicalModels/thermophysicalProperties/Make/files +++ b/src/thermophysicalModels/thermophysicalProperties/Make/files @@ -14,6 +14,8 @@ $(NSRDSfunctions)/NSRDSfunc14/NSRDSfunc14.C APIfunctions = thermophysicalFunctions/APIfunctions $(APIfunctions)/APIdiffCoefFunc/APIdiffCoefFunc.C +thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C + thermophysicalProperties/thermophysicalProperties.C diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.H index ab390b3c6b..220f962f75 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.H @@ -198,7 +198,7 @@ public: //- Solubility parameter [(J/m^3)^(1/2)] inline scalar delta() const; - //- Limit the temperature to be in the range Tlow_ to Thigh_ + //- Limit temperature to be within the range inline scalar limit(const scalar T) const; diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C new file mode 100644 index 0000000000..261df2f927 --- /dev/null +++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "nonUniformTableThermophysicalFunction.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(nonUniformTable, 0); + + addToRunTimeSelectionTable + ( + thermophysicalFunction, + nonUniformTable, + dictionary + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::nonUniformTable::nonUniformTable +( + const word& name, + const dictionary& dict +) +: + name_(name), + values_(), + Trange_(), + deltaT_(GREAT), + jumpTable_() +{ + dict.readEntry(name_, values_); + + if (values_.size() < 2) + { + FatalIOErrorInFunction(dict) + << "Table" << nl + << " " << name_ << nl + << " has fewer than 2 entries." << nl + << exit(FatalIOError); + } + + Trange_.min() = values_.first().first(); + Trange_.max() = values_.last().first(); + + for (label i = 1; i < values_.size(); ++i) + { + #ifdef FULLDEBUG + // Check list is monotonically increasing... + if (values_[i].first() <= values_[i-1].first()) + { + FatalErrorInFunction + << "Table" << nl + << " " << name_ << nl + << " out-of-order value: " << values_[i].first() + << " at index " << i << nl + << exit(FatalError); + } + #endif + + deltaT_ = min(deltaT_, values_[i].first() - values_[i-1].first()); + } + + deltaT_ *= 0.9; + + jumpTable_.resize(Trange_.mag()/deltaT_ + 1); + + label i = 0; + forAll(jumpTable_, j) + { + const scalar T = Trange_.min() + j*deltaT_; + + if (T > values_[i+1].first()) + { + ++i; + } + + jumpTable_[j] = i; + } +} + + +Foam::nonUniformTable::nonUniformTable +( + const dictionary& dict +) +: + nonUniformTable("values", dict) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::scalar Foam::nonUniformTable::f +( + scalar p, + scalar T +) const +{ + const label i = index(p, T); + const scalar Ti = values_[i].first(); + const scalar lambda = (T - Ti)/(values_[i + 1].first() - Ti); + + return + values_[i].second() + + lambda*(values_[i + 1].second() - values_[i].second()); +} + + +Foam::scalar Foam::nonUniformTable::dfdT +( + scalar p, + scalar T +) const +{ + const label i = index(p, T); + + return + (values_[i + 1].second() - values_[i].second()) + /(values_[i + 1].first() - values_[i].first()); +} + + +void Foam::nonUniformTable::writeData(Ostream& os) const +{ + os.writeEntry("values", values_); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.H b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.H new file mode 100644 index 0000000000..407f41b125 --- /dev/null +++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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::thermophysicalFunctions::nonUniformTable + +Description + Non-uniform tabulated property function that linearly interpolates between + the values. + + To speed-up the search of the non-uniform table a uniform jump-table is + created on construction which is used for fast indirect addressing into + the table. + +Usage + \nonUniformTable + Property | Description + values | List of (temperature property) value pairs + \endnonUniformTable + + Example for the density of water between 280 and 350K + \verbatim + rho + { + type nonUniformTable; + + values + ( + (280 999.87) + (300 995.1) + (350 973.7) + ); + } + \endverbatim + +\*---------------------------------------------------------------------------*/ + +#ifndef nonUniformTableThermophysicalFunction_H +#define nonUniformTableThermophysicalFunction_H + +#include "thermophysicalFunction.H" +#include "MinMax.H" +#include "Tuple2.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class nonUniformTable Declaration +\*---------------------------------------------------------------------------*/ + +class nonUniformTable +: + public thermophysicalFunction +{ + // Private Data + + //- Name of dictionary from which this function is instantiated + word name_; + + //- Table values + List> values_; + + //- Lowest/highest temperature in the table + MinMax Trange_; + + //- Temperature increment, based on Trange_ and values_.size() + scalar deltaT_; + + //- Lookup indices into values_ table based on deltaT_ + List