From 020463b64e35a9acf724dc851a9d6b3a16b4e98f Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 14 Sep 2023 16:33:52 +0100 Subject: [PATCH] multiphaseEuler::SolidThermalPhaseModel: New thermal phase model for solid phases which provides the energy equation specific for stationary solid phases. --- .../multiphaseEuler/thermophysicalPredictor.C | 3 - .../AnisothermalPhaseModel.C | 6 +- .../AnisothermalPhaseModel.H | 7 ++ .../SolidThermalPhaseModel.C | 91 ++++++++++++++++ .../SolidThermalPhaseModel.H | 101 ++++++++++++++++++ .../phaseModel/phaseModel/phaseModels.C | 3 +- 6 files changed, 205 insertions(+), 6 deletions(-) create mode 100644 applications/modules/multiphaseEuler/phaseSystems/phaseModel/SolidThermalPhaseModel/SolidThermalPhaseModel.C create mode 100644 applications/modules/multiphaseEuler/phaseSystems/phaseModel/SolidThermalPhaseModel/SolidThermalPhaseModel.H diff --git a/applications/modules/multiphaseEuler/multiphaseEuler/thermophysicalPredictor.C b/applications/modules/multiphaseEuler/multiphaseEuler/thermophysicalPredictor.C index 3436d613bc..145c6cf046 100644 --- a/applications/modules/multiphaseEuler/multiphaseEuler/thermophysicalPredictor.C +++ b/applications/modules/multiphaseEuler/multiphaseEuler/thermophysicalPredictor.C @@ -85,15 +85,12 @@ void Foam::solvers::multiphaseEuler::energyPredictor() const volScalarField& alpha = phase; const volScalarField& rho = phase.rho(); - const tmp tU(phase.U()); - const volVectorField& U(tU()); fvScalarMatrix EEqn ( phase.heEqn() == *heatTransfer[phase.name()] - + alpha*rho*(U&buoyancy.g) + fvModels().source(alpha, rho, phase.thermo().he()) ); diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C index e87d345936..d25e42ca4b 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.C @@ -71,7 +71,8 @@ Foam::AnisothermalPhaseModel::AnisothermalPhaseModel const label index ) : - BasePhaseModel(fluid, phaseName, referencePhase, index) + BasePhaseModel(fluid, phaseName, referencePhase, index), + g_(fluid.mesh().lookupObject("g")) {} @@ -132,7 +133,8 @@ Foam::AnisothermalPhaseModel::heEqn() + this->divq(he) == - alpha*this->Qdot() + alpha*rho*(U&g_) + + alpha*this->Qdot() ); // Add the appropriate pressure-work term diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.H b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.H index cce30c98f3..2336fea55e 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.H +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/AnisothermalPhaseModel/AnisothermalPhaseModel.H @@ -37,6 +37,7 @@ SourceFiles #define AnisothermalPhaseModel_H #include "phaseModel.H" +#include "uniformDimensionedFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,6 +53,12 @@ class AnisothermalPhaseModel : public BasePhaseModel { + // Private Member Data + + //- Gravitational acceleration + const uniformDimensionedVectorField& g_; + + // Private Member Functions //- Optionally filter the pressure work term as the phase-fraction -> 0 diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/SolidThermalPhaseModel/SolidThermalPhaseModel.C b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/SolidThermalPhaseModel/SolidThermalPhaseModel.C new file mode 100644 index 0000000000..dde7d6c15b --- /dev/null +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/SolidThermalPhaseModel/SolidThermalPhaseModel.C @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "SolidThermalPhaseModel.H" +#include "fvmDdt.H" +#include "fvmSup.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::SolidThermalPhaseModel::SolidThermalPhaseModel +( + const phaseSystem& fluid, + const word& phaseName, + const bool referencePhase, + const label index +) +: + BasePhaseModel(fluid, phaseName, referencePhase, index) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::SolidThermalPhaseModel::~SolidThermalPhaseModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::SolidThermalPhaseModel::correctThermo() +{ + BasePhaseModel::correctThermo(); + + this->thermo_->correct(); +} + + +template +bool Foam::SolidThermalPhaseModel::isothermal() const +{ + return false; +} + + +template +Foam::tmp +Foam::SolidThermalPhaseModel::heEqn() +{ + const volScalarField& alpha = *this; + const volScalarField& rho = this->rho(); + + volScalarField& he = this->thermo_->he(); + + tmp tEEqn + ( + fvm::ddt(alpha, rho, he) + + this->divq(he) + == + alpha*this->Qdot() + ); + + return tEEqn; +} + + +// ************************************************************************* // diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/SolidThermalPhaseModel/SolidThermalPhaseModel.H b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/SolidThermalPhaseModel/SolidThermalPhaseModel.H new file mode 100644 index 0000000000..76aee368ec --- /dev/null +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/SolidThermalPhaseModel/SolidThermalPhaseModel.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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::SolidThermalPhaseModel + +Description + Class which represents a solid stationary phase for which the temperature + (strictly energy) varies. Returns the energy equation and corrects the + thermodynamic model. + +SourceFiles + SolidThermalPhaseModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SolidThermalPhaseModel_H +#define SolidThermalPhaseModel_H + +#include "phaseModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class SolidThermalPhaseModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class SolidThermalPhaseModel +: + public BasePhaseModel +{ + +public: + + // Constructors + + SolidThermalPhaseModel + ( + const phaseSystem& fluid, + const word& phaseName, + const bool referencePhase, + const label index + ); + + + //- Destructor + virtual ~SolidThermalPhaseModel(); + + + // Member Functions + + //- Correct the thermodynamics + virtual void correctThermo(); + + //- Return whether the phase is isothermal + virtual bool isothermal() const; + + //- Return the enthalpy equation + virtual tmp heEqn(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "SolidThermalPhaseModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModels.C b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModels.C index 3e41fb4352..de77b6739f 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModels.C +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModels.C @@ -34,6 +34,7 @@ License #include "ThermoPhaseModel.H" #include "IsothermalPhaseModel.H" #include "AnisothermalPhaseModel.H" +#include "SolidThermalPhaseModel.H" #include "PurePhaseModel.H" #include "MulticomponentPhaseModel.H" #include "InertPhaseModel.H" @@ -74,7 +75,7 @@ namespace Foam ); typedef - AnisothermalPhaseModel + SolidThermalPhaseModel < PurePhaseModel <