diff --git a/src/ThermophysicalTransportModels/solid/anisotropic/anisotropic.C b/src/ThermophysicalTransportModels/solid/anisotropic/anisotropic.C index c1bb47287a..a0c72c4661 100644 --- a/src/ThermophysicalTransportModels/solid/anisotropic/anisotropic.C +++ b/src/ThermophysicalTransportModels/solid/anisotropic/anisotropic.C @@ -131,15 +131,15 @@ Foam::solidThermophysicalTransportModels::anisotropic::anisotropic { if (iter().isDict()) { - const word& name = iter().keyword(); + const word& zoneName = iter().keyword(); const dictionary& dict = iter().dict(); - Info<< " " << name << endl; + Info<< " " << zoneName << endl; zoneCoordinateSystems_.insert ( - name, - coordinateSystem::New(name, dict).ptr() + zoneName, + coordinateSystem::New(zoneName, dict).ptr() ); } } @@ -266,11 +266,13 @@ Foam::solidThermophysicalTransportModels::anisotropic::Kappa() const const labelList& zoneCells = mesh.cellZones()[iter().name()]; const coordinateSystem& cs = iter(); + symmTensorField& KappaIf = Kappa; + forAll(zoneCells, i) { const label celli = zoneCells[i]; - Kappa[celli] = + KappaIf[celli] = cs.R().transformDiagTensor ( mesh.C()[celli], diff --git a/src/thermophysicalModels/solidThermo/Make/files b/src/thermophysicalModels/solidThermo/Make/files index 858b87cf29..79e2deea97 100644 --- a/src/thermophysicalModels/solidThermo/Make/files +++ b/src/thermophysicalModels/solidThermo/Make/files @@ -1,5 +1,6 @@ solidThermo/solidThermo.C solidThermo/solidThermos.C constSolidThermo/constSolidThermo.C +constAnisoSolidThermo/constAnisoSolidThermo.C LIB = $(FOAM_LIBBIN)/libsolidThermo diff --git a/src/thermophysicalModels/solidThermo/constAnisoSolidThermo/constAnisoSolidThermo.C b/src/thermophysicalModels/solidThermo/constAnisoSolidThermo/constAnisoSolidThermo.C new file mode 100644 index 0000000000..fd1d364a74 --- /dev/null +++ b/src/thermophysicalModels/solidThermo/constAnisoSolidThermo/constAnisoSolidThermo.C @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "constAnisoSolidThermo.H" +#include "addToRunTimeSelectionTable.H" + +/* * * * * * * * * * * * * * * Private Static Data * * * * * * * * * * * * * */ + +namespace Foam +{ + defineTypeNameAndDebug(constAnisoSolidThermo, 0); + addToRunTimeSelectionTable(basicThermo, constAnisoSolidThermo, fvMesh); + addToRunTimeSelectionTable(solidThermo, constAnisoSolidThermo, fvMesh); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::constAnisoSolidThermo::constAnisoSolidThermo +( + const fvMesh& mesh, + const word& phaseName +) +: + constSolidThermo(mesh, false, phaseName), + Kappa_(readProperty("Kappa", kappa_.dimensions())) +{ + kappa_ = mag(Kappa_); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::constAnisoSolidThermo::~constAnisoSolidThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::volScalarField& Foam::constAnisoSolidThermo::kappa() const +{ + NotImplemented; + return kappa_; +} + + +const Foam::volVectorField& Foam::constAnisoSolidThermo::Kappa() const +{ + return Kappa_; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/constAnisoSolidThermo/constAnisoSolidThermo.H b/src/thermophysicalModels/solidThermo/constAnisoSolidThermo/constAnisoSolidThermo.H new file mode 100644 index 0000000000..4ee025e0e8 --- /dev/null +++ b/src/thermophysicalModels/solidThermo/constAnisoSolidThermo/constAnisoSolidThermo.H @@ -0,0 +1,188 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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::constAnisoSolidThermo + +Description + Uniform or non-uniform constant anisotropic solid thermodynamic properties + + Each physical property can specified as either \c uniform in which case the + value entry is read, \c zonal in which case the value entry and zone list + are read or \c file in which case the field file in read from the constant + directory. The thermal conductivity \c Kappa is anisotropic and read as a + diagonal tensor or diagonal tensor field provided in the form of a vector + or vector field. + +Usage + Example of uniform constant solid properties specification: + \verbatim + thermoType constAnisoSolidThermo; + + rho + { + type uniform; + value 8940; + } + + Cv + { + type uniform; + value 385; + } + + Kappa + { + type uniform; + value (380 100 100); + } + \endverbatim + + Example of zonal constant solid properties specification where Kappa is + different in different zones: + \verbatim + thermoType constSolidThermo; + + rho + { + type uniform; + value 8940; + } + + Cv + { + type uniform; + value 385; + } + + Kappa + { + type zonal; + value (380 380 380); + + zones + { + heater (560 560 560); + insulation (10 100 100); + } + } + \endverbatim + + Example of non-uniform constant solid properties specification: + \verbatim + thermoType constAnisoSolidThermo; + + rho + { + type file; + } + + Cv + { + type file; + } + + Kappa + { + type file; + } + \endverbatim + where each of the field files are read from the constant directory. + +SourceFiles + constAnisoSolidThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constAnisoSolidThermo_H +#define constAnisoSolidThermo_H + +#include "constSolidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class constAnisoSolidThermo Declaration +\*---------------------------------------------------------------------------*/ + +class constAnisoSolidThermo +: + public constSolidThermo +{ + // Private data + + //- Anisotropic thermal conductivity [W/m/K] + volVectorField Kappa_; + + +public: + + //- Runtime type information + TypeName("constAnisoSolidThermo"); + + + // Constructors + + //- Construct from mesh and phase name + constAnisoSolidThermo + ( + const fvMesh&, + const word& phaseName = word::null + ); + + + //- Destructor + virtual ~constAnisoSolidThermo(); + + + // Member Functions + + // Access to transport state variables + + //- Return false as the thermal conductivity is anisotropic + virtual bool isotropic() const + { + return false; + } + + //- Isotropic thermal conductivity [W/m/K] + // Not implemented + virtual const volScalarField& kappa() const; + + //- Anisotropic thermal conductivity [W/m/K] + virtual const volVectorField& Kappa() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //