From 26f0e47d4bce4a3d3a039f80b867f51048e856e3 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 25 Nov 2021 16:10:07 +0000 Subject: [PATCH] AndradeTransport: New specie transport model for liquids MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description Transport package using the Andrade function for the natural logarithm of dynamic viscosity and thermal conductivity of liquids: \verbatim log(mu) = muCoeffs[0] + muCoeffs[1]*T + muCoeffs[2]*sqr(T) + muCoeffs_[3]/(muCoeffs_[4] + T) log(kappa) = kappaCoeffs[0] + kappaCoeffs[1]*T + kappaCoeffs[2]*sqr(T) + kappaCoeffs_[3]/(kappaCoeffs_[4] + T) ); \endverbatim References: \verbatim Andrade, E. D. C. (1934). XLI. A theory of the viscosity of liquids.—Part I. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 17(112), 497-511. Andrade, E. D. C. (1934). LVIII. A theory of the viscosity of liquids.—Part II. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 17(113), 698-732. \endverbatim Usage \table Property | Description muCoeffs | Dynamic viscosity polynomial coefficients kappaCoeffs | Thermal conductivity polynomial coefficients \endtable Example of the specification of the transport properties for water@200bar: \verbatim transport { muCoeffs (-25.8542 0.031256 -2.2e-05 3289.918 -11.4784); kappaCoeffs (-2.56543 0.008794 -9.8e-06 100.368 0); } \endverbatim --- .../dynamicCode/fluidReactionThermo | 1 + etc/codeTemplates/dynamicCode/fluidThermo | 1 + etc/codeTemplates/dynamicCode/psiThermo | 2 - .../dynamicCode/psiuReactionThermo | 1 - .../transport/Andrade/AndradeTransport.C | 73 ++++++ .../transport/Andrade/AndradeTransport.H | 210 ++++++++++++++++++ .../transport/Andrade/AndradeTransportI.H | 115 ++++++++++ 7 files changed, 400 insertions(+), 3 deletions(-) create mode 100644 src/thermophysicalModels/specie/transport/Andrade/AndradeTransport.C create mode 100644 src/thermophysicalModels/specie/transport/Andrade/AndradeTransport.H create mode 100644 src/thermophysicalModels/specie/transport/Andrade/AndradeTransportI.H diff --git a/etc/codeTemplates/dynamicCode/fluidReactionThermo b/etc/codeTemplates/dynamicCode/fluidReactionThermo index c9bf80c2d8..df12a45496 100644 --- a/etc/codeTemplates/dynamicCode/fluidReactionThermo +++ b/etc/codeTemplates/dynamicCode/fluidReactionThermo @@ -56,6 +56,7 @@ transport sutherland tabulated WLF + Andrade ); thermo diff --git a/etc/codeTemplates/dynamicCode/fluidThermo b/etc/codeTemplates/dynamicCode/fluidThermo index 91fc7c55eb..1c540b085e 100644 --- a/etc/codeTemplates/dynamicCode/fluidThermo +++ b/etc/codeTemplates/dynamicCode/fluidThermo @@ -47,6 +47,7 @@ transport sutherland tabulated WLF + Andrade ); thermo diff --git a/etc/codeTemplates/dynamicCode/psiThermo b/etc/codeTemplates/dynamicCode/psiThermo index de8fd5b9ab..e8f8f7d982 100644 --- a/etc/codeTemplates/dynamicCode/psiThermo +++ b/etc/codeTemplates/dynamicCode/psiThermo @@ -39,11 +39,9 @@ mixture transport ( const - logPolynomial polynomial sutherland tabulated - WLF ); thermo diff --git a/etc/codeTemplates/dynamicCode/psiuReactionThermo b/etc/codeTemplates/dynamicCode/psiuReactionThermo index b4362950d9..0319806631 100644 --- a/etc/codeTemplates/dynamicCode/psiuReactionThermo +++ b/etc/codeTemplates/dynamicCode/psiuReactionThermo @@ -40,7 +40,6 @@ mixture transport ( const - logPolynomial polynomial sutherland ); diff --git a/src/thermophysicalModels/specie/transport/Andrade/AndradeTransport.C b/src/thermophysicalModels/specie/transport/Andrade/AndradeTransport.C new file mode 100644 index 0000000000..4a4f702016 --- /dev/null +++ b/src/thermophysicalModels/specie/transport/Andrade/AndradeTransport.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "AndradeTransport.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::AndradeTransport::AndradeTransport(const dictionary& dict) +: + Thermo(dict), + muCoeffs_(dict.subDict("transport").lookup("muCoeffs")), + kappaCoeffs_(dict.subDict("transport").lookup("kappaCoeffs")) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::AndradeTransport::write(Ostream& os) const +{ + os << this->name() << endl; + os << token::BEGIN_BLOCK << incrIndent << nl; + + Thermo::write(os); + + dictionary dict("transport"); + dict.add("muCoeffs", muCoeffs_); + dict.add("kappaCoeffs", kappaCoeffs_); + os << indent << dict.dictName() << dict; + + os << decrIndent << token::END_BLOCK << nl; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const AndradeTransport& pt +) +{ + pt.write(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/transport/Andrade/AndradeTransport.H b/src/thermophysicalModels/specie/transport/Andrade/AndradeTransport.H new file mode 100644 index 0000000000..879f904ede --- /dev/null +++ b/src/thermophysicalModels/specie/transport/Andrade/AndradeTransport.H @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::AndradeTransport + +Description + Transport package using the Andrade function for the natural logarithm of + dynamic viscosity and thermal conductivity of liquids: + + \verbatim + log(mu) = muCoeffs[0] + muCoeffs[1]*T + muCoeffs[2]*sqr(T) + + muCoeffs_[3]/(muCoeffs_[4] + T) + + log(kappa) = kappaCoeffs[0] + kappaCoeffs[1]*T + kappaCoeffs[2]*sqr(T) + + kappaCoeffs_[3]/(kappaCoeffs_[4] + T) + ); + \endverbatim + + References: + \verbatim + Andrade, E. D. C. (1934). + XLI. A theory of the viscosity of liquids.—Part I. + The London, Edinburgh, and Dublin Philosophical Magazine + and Journal of Science, 17(112), 497-511. + + Andrade, E. D. C. (1934). + LVIII. A theory of the viscosity of liquids.—Part II. + The London, Edinburgh, and Dublin Philosophical Magazine + and Journal of Science, 17(113), 698-732. + \endverbatim + +Usage + \table + Property | Description + muCoeffs | Dynamic viscosity polynomial coefficients + kappaCoeffs | Thermal conductivity polynomial coefficients + \endtable + + Example of the specification of the transport properties for water@200bar: + \verbatim + transport + { + muCoeffs (-25.8542 0.031256 -2.2e-05 3289.918 -11.4784); + kappaCoeffs (-2.56543 0.008794 -9.8e-06 100.368 0); + } + \endverbatim + +SourceFiles + AndradeTransportI.H + AndradeTransport.C + +\*---------------------------------------------------------------------------*/ + +#ifndef AndradeTransport_H +#define AndradeTransport_H + +#include "FixedList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators + +template class AndradeTransport; + +template +inline AndradeTransport operator+ +( + const AndradeTransport&, + const AndradeTransport& +); + +template +inline AndradeTransport operator* +( + const scalar, + const AndradeTransport& +); + +template +Ostream& operator<< +( + Ostream&, + const AndradeTransport& +); + + +/*---------------------------------------------------------------------------*\ + Class AndradeTransport Declaration +\*---------------------------------------------------------------------------*/ + +template +class AndradeTransport +: + public Thermo +{ + // Private Data + + typedef FixedList coeffList; + + //- Dynamic viscosity coefficients + coeffList muCoeffs_; + + //- Thermal conductivity coefficients + coeffList kappaCoeffs_; + + + // Private Member Functions + + //- Construct from components + inline AndradeTransport + ( + const Thermo& t, + const coeffList& muCoeffs, + const coeffList& kappaCoeffs + ); + + +public: + + // Constructors + + //- Construct as named copy + inline AndradeTransport + ( + const word&, + const AndradeTransport& + ); + + //- Construct from dictionary + AndradeTransport(const dictionary& dict); + + //- Construct and return a clone + inline autoPtr clone() const; + + // Selector from dictionary + inline static autoPtr New + ( + const dictionary& dict + ); + + + // Member Functions + + //- Return the instantiated type name + static word typeName() + { + return "Andrade<" + Thermo::typeName() + '>'; + } + + //- 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; + + //- Write to Ostream + void write(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const AndradeTransport& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "AndradeTransportI.H" + +#ifdef NoRepository + #include "AndradeTransport.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/transport/Andrade/AndradeTransportI.H b/src/thermophysicalModels/specie/transport/Andrade/AndradeTransportI.H new file mode 100644 index 0000000000..4c5bb4e4bb --- /dev/null +++ b/src/thermophysicalModels/specie/transport/Andrade/AndradeTransportI.H @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "specie.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +inline Foam::AndradeTransport::AndradeTransport +( + const Thermo& t, + const coeffList& muCoeffs, + const coeffList& kappaCoeffs +) +: + Thermo(t), + muCoeffs_(muCoeffs), + kappaCoeffs_(kappaCoeffs) +{} + + +template +inline Foam::AndradeTransport::AndradeTransport +( + const word& name, + const AndradeTransport& pt +) +: + Thermo(name, pt), + muCoeffs_(pt.muCoeffs_), + kappaCoeffs_(pt.kappaCoeffs_) +{} + + +template +inline Foam::autoPtr> +Foam::AndradeTransport::clone() const +{ + return autoPtr> + ( + new AndradeTransport(*this) + ); +} + + +template +inline Foam::autoPtr> +Foam::AndradeTransport::New(const dictionary& dict) +{ + return autoPtr> + ( + new AndradeTransport(dict) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::AndradeTransport::mu +( + const scalar p, + const scalar T +) const +{ + return exp + ( + muCoeffs_[0] + + muCoeffs_[1]*T + + muCoeffs_[2]*sqr(T) + + muCoeffs_[3]/(muCoeffs_[4] + T) + ); +} + + +template +inline Foam::scalar Foam::AndradeTransport::kappa +( + const scalar p, + const scalar T +) const +{ + return exp + ( + kappaCoeffs_[0] + + kappaCoeffs_[1]*T + + kappaCoeffs_[2]*sqr(T) + + kappaCoeffs_[3]/(kappaCoeffs_[4] + T) + ); +} + + +// ************************************************************************* //