From 9cf6ac4145d4d82a0d758af4b9e2c340baece13f Mon Sep 17 00:00:00 2001 From: Kutalmis Bercin Date: Tue, 10 May 2022 09:27:21 +0100 Subject: [PATCH] ENH: new tabulated anisotropic solid transport model --- .../tabulated/tabulatedAnIsoSolidTransport.C | 77 ++++++++ .../tabulated/tabulatedAnIsoSolidTransport.H | 181 ++++++++++++++++++ .../tabulated/tabulatedAnIsoSolidTransportI.H | 120 ++++++++++++ .../solidThermo/solidThermo/solidThermos.C | 13 ++ 4 files changed, 391 insertions(+) create mode 100644 src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransport.C create mode 100644 src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransport.H create mode 100644 src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransportI.H diff --git a/src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransport.C b/src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransport.C new file mode 100644 index 0000000000..4eea2a67ce --- /dev/null +++ b/src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransport.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2022 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 "tabulatedAnIsoSolidTransport.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::tabulatedAnIsoSolidTransport::tabulatedAnIsoSolidTransport +( + const dictionary& dict +) +: + Thermo(dict), + kappa_(Function1::New("kappa", dict.subDict("transport"))) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::tabulatedAnIsoSolidTransport::write(Ostream& os) const +{ + os.beginBlock(this->name()); + + Thermo::write(os); + + { + os.beginBlock("transport"); + kappa_->writeData(os); + os.endBlock(); + } + + os.endBlock(); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const tabulatedAnIsoSolidTransport& pt +) +{ + pt.write(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransport.H new file mode 100644 index 0000000000..84a72edc3b --- /dev/null +++ b/src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransport.H @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2022 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::tabulatedAnIsoSolidTransport + +Description + Transport properties package using \c Function1 type data + for anisotropic thermal conductivity. + +Usage + Example of the specification of the transport properties: + \verbatim + transport + { + // kappa >; + + kappa table + ( + // T kappa + ( 200 (2.56e-5 2e-5 2e-5) ) + ( 350 (3.33e-5 1e-5 1e-5) ) + ( 400 (4.72e-5 3e-5 3-e5) ) + ); + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Reqd | Deflt + kappa | Thermal conductivity | Function1\ | yes | - + \endtable + +SourceFiles + tabulatedAnIsoSolidTransportI.H + tabulatedAnIsoSolidTransport.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_tabulatedAnIsoSolidTransport_H +#define Foam_tabulatedAnIsoSolidTransport_H + +#include "Function1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward Declarations +template class tabulatedAnIsoSolidTransport; + +template +Ostream& operator<<(Ostream&, const tabulatedAnIsoSolidTransport&); + + +/*---------------------------------------------------------------------------*\ + Class tabulatedAnIsoSolidTransport Declaration +\*---------------------------------------------------------------------------*/ + +template +class tabulatedAnIsoSolidTransport +: + public Thermo +{ + // Private Data + + //- Thermal conductivity data [W/m/K] + autoPtr> kappa_; + + + // Constructors + + //- Construct from components + inline tabulatedAnIsoSolidTransport + ( + const Thermo& t, + const autoPtr>& kappa + ); + + +public: + + // Constructors + + //- Construct as named copy + inline tabulatedAnIsoSolidTransport + ( + const word&, + const tabulatedAnIsoSolidTransport& + ); + + //- Construct from dictionary + explicit tabulatedAnIsoSolidTransport(const dictionary& dict); + + //- 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 "tabulatedAnIso<" + Thermo::typeName() + '>'; + } + + //- Is the thermal conductivity isotropic + static const bool isotropic = false; + + //- Dynamic viscosity [kg/m/s] + inline scalar mu(const scalar p, const scalar T) const; + + //- Thermal conductivity [W/m/K] + inline scalar kappa(const scalar p, const scalar T) const; + + //- Thermal conductivity [W/m/K] + inline vector Kappa(const scalar p, const scalar T) const; + + //- Thermal diffusivity of enthalpy [kg/m/s] + inline scalar alphah(const scalar p, const scalar T) const; + + //- Write to Ostream + void write(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const tabulatedAnIsoSolidTransport& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "tabulatedAnIsoSolidTransportI.H" + +#ifdef NoRepository + #include "tabulatedAnIsoSolidTransport.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransportI.H b/src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransportI.H new file mode 100644 index 0000000000..2b85e5e423 --- /dev/null +++ b/src/thermophysicalModels/solidSpecie/transport/tabulated/tabulatedAnIsoSolidTransportI.H @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2022 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 "specie.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +inline Foam::tabulatedAnIsoSolidTransport::tabulatedAnIsoSolidTransport +( + const Thermo& t, + const autoPtr>& kappa + +) +: + Thermo(t), + kappa_(kappa.clone()) +{} + + +template +inline Foam::tabulatedAnIsoSolidTransport::tabulatedAnIsoSolidTransport +( + const word& name, + const tabulatedAnIsoSolidTransport& pt +) +: + Thermo(name, pt), + kappa_(pt.kappa_.clone()) +{} + + +template +inline Foam::autoPtr> +Foam::tabulatedAnIsoSolidTransport::clone() const +{ + return autoPtr>::New(*this); +} + + +template +inline Foam::autoPtr> +Foam::tabulatedAnIsoSolidTransport::New(const dictionary& dict) +{ + return autoPtr>::New(dict); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::tabulatedAnIsoSolidTransport::mu +( + const scalar p, + const scalar T +) const +{ + NotImplemented; + return 0; +} + + +template +inline Foam::scalar Foam::tabulatedAnIsoSolidTransport::kappa +( + const scalar p, + const scalar T +) const +{ + return mag(kappa_->value(T)); +} + + +template +inline Foam::vector Foam::tabulatedAnIsoSolidTransport::Kappa +( + const scalar p, + const scalar T +) const +{ + return kappa_->value(T); +} + + +template +inline Foam::scalar Foam::tabulatedAnIsoSolidTransport::alphah +( + const scalar p, + const scalar T +) const +{ + return kappa(p, T)/this->Cp(p, T); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C index fcc222ee71..44cf284b5e 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C @@ -43,6 +43,7 @@ License #include "exponentialSolidTransport.H" #include "polynomialSolidTransport.H" #include "tabulatedSolidTransport.H" +#include "tabulatedAnIsoSolidTransport.H" #include "pureMixture.H" #include "sensibleEnthalpy.H" #include "sensibleInternalEnergy.H" @@ -129,6 +130,18 @@ makeSolidThermo specie ); +makeSolidThermo +( + solidThermo, + heSolidThermo, + pureMixture, + tabulatedAnIsoSolidTransport, + sensibleEnthalpy, + hTabulatedThermo, + icoPolynomial, + specie +); + makeSolidThermoPhysicsType ( solidThermo,