From fb11bcc8749f8df610b1b8588735bd43bfe16e8a Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Wed, 26 Aug 2015 15:37:52 +0100 Subject: [PATCH] TurbulenceModels/compressible: Added correctEnergyTransport() function to allow the turbulent energy transport properties to be updated for every energy solution if required. Added correctEnergyTransport() call to reactingTwoPhaseEulerFoam --- .../MovingPhaseModel/MovingPhaseModel.C | 8 + .../MovingPhaseModel/MovingPhaseModel.H | 3 + .../phaseModel/phaseModel/phaseModel.C | 4 + .../phaseModel/phaseModel/phaseModel.H | 3 + .../phaseSystems/phaseSystem/phaseSystem.C | 9 ++ .../phaseSystems/phaseSystem/phaseSystem.H | 3 + .../reactingTwoPhaseEulerFoam/EEqns.H | 2 + .../EddyDiffusivity/EddyDiffusivity.C | 7 + .../EddyDiffusivity/EddyDiffusivity.H | 3 + src/TurbulenceModels/compressible/Make/files | 2 + .../ThermalDiffusivity/ThermalDiffusivity.C | 5 + .../ThermalDiffusivity/ThermalDiffusivity.H | 3 + .../compressibleTurbulenceModel.H | 3 + ...haseChangeWallFunctionFvPatchScalarField.C | 122 +++++++++++++++ ...haseChangeWallFunctionFvPatchScalarField.H | 147 ++++++++++++++++++ 15 files changed, 324 insertions(+) create mode 100644 src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C create mode 100644 src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index b1869b9fbfe..d64a5c862ef 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -243,6 +243,14 @@ void Foam::MovingPhaseModel<BasePhaseModel>::correctTurbulence() } +template<class BasePhaseModel> +void Foam::MovingPhaseModel<BasePhaseModel>::correctEnergyTransport() +{ + BasePhaseModel::correctEnergyTransport(); + turbulence_->correctEnergyTransport(); +} + + template<class BasePhaseModel> Foam::tmp<Foam::fvVectorMatrix> Foam::MovingPhaseModel<BasePhaseModel>::UEqn() diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H index 14e9c057b7e..fc719c18ca6 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H @@ -125,6 +125,9 @@ public: //- Correct the turbulence virtual void correctTurbulence(); + //- Correct the energy transport e.g. alphat + virtual void correctEnergyTransport(); + //- Return the momentum equation virtual tmp<fvVectorMatrix> UEqn(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C index 61ea75e586c..2fbd56db2f5 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C @@ -128,6 +128,10 @@ void Foam::phaseModel::correctTurbulence() {} +void Foam::phaseModel::correctEnergyTransport() +{} + + bool Foam::phaseModel::read() { return diameterModel_->read(fluid_.subDict(name_)); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H index 34e371a0407..191cc35700d 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H @@ -151,6 +151,9 @@ public: //- Correct the turbulence virtual void correctTurbulence(); + //- Correct the energy transport e.g. alphat + virtual void correctEnergyTransport(); + //- Return the momentum equation virtual tmp<fvVectorMatrix> UEqn() = 0; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C index 3bbb6e82de4..97f139c57cb 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C @@ -334,6 +334,15 @@ void Foam::phaseSystem::correctTurbulence() } +void Foam::phaseSystem::correctEnergyTransport() +{ + forAllIter(phaseModelTable, phaseModels_, phaseModelIter) + { + phaseModelIter()->correctEnergyTransport(); + } +} + + bool Foam::phaseSystem::read() { if (regIOobject::read()) diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H index 81bfd708f8a..8f50c5c17a5 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H @@ -348,6 +348,9 @@ public: //- Correct the turbulence virtual void correctTurbulence(); + //- Correct the energy transport e.g. alphat + virtual void correctEnergyTransport(); + //- Read base phaseProperties dictionary virtual bool read(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H index ff72d8d94e0..27db7d1a362 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H @@ -1,4 +1,6 @@ { + fluid.correctEnergyTransport(); + autoPtr<phaseSystem::heatTransferTable> heatTransferPtr(fluid.heatTransfer()); diff --git a/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.C b/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.C index eec1be8c8ee..1647c88ca82 100644 --- a/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.C +++ b/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.C @@ -106,4 +106,11 @@ bool Foam::EddyDiffusivity<BasicTurbulenceModel>::read() } +template<class BasicTurbulenceModel> +void Foam::EddyDiffusivity<BasicTurbulenceModel>::correctEnergyTransport() +{ + EddyDiffusivity<BasicTurbulenceModel>::correctNut(); +} + + // ************************************************************************* // diff --git a/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.H b/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.H index a6693fac10b..82ba1221d91 100644 --- a/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.H +++ b/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.H @@ -142,6 +142,9 @@ public: { return this->transport_.alphaEff(alphat(patchi), patchi); } + + //- Correct the turbulence thermal diffusivity for energy transport + virtual void correctEnergyTransport(); }; diff --git a/src/TurbulenceModels/compressible/Make/files b/src/TurbulenceModels/compressible/Make/files index 2f6e9f1dd35..1f7f2fa12da 100644 --- a/src/TurbulenceModels/compressible/Make/files +++ b/src/TurbulenceModels/compressible/Make/files @@ -16,4 +16,6 @@ $(BCs)/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +/*turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C*/ + LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModels diff --git a/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.C b/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.C index 4a85a59d074..6f678ce21a2 100644 --- a/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.C +++ b/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.C @@ -149,4 +149,9 @@ Foam::ThermalDiffusivity<BasicTurbulenceModel>::alphat } +template<class BasicTurbulenceModel> +void Foam::ThermalDiffusivity<BasicTurbulenceModel>::correctEnergyTransport() +{} + + // ************************************************************************* // diff --git a/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.H b/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.H index 2066e44a1da..8d00e9f08b4 100644 --- a/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.H +++ b/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.H @@ -166,6 +166,9 @@ public: { return alpha(patchi); } + + //- Correct the turbulence thermal diffusivity for energy transport + virtual void correctEnergyTransport(); }; diff --git a/src/TurbulenceModels/compressible/compressibleTurbulenceModel.H b/src/TurbulenceModels/compressible/compressibleTurbulenceModel.H index 8ecf2f51fff..5d0c95b5cc0 100644 --- a/src/TurbulenceModels/compressible/compressibleTurbulenceModel.H +++ b/src/TurbulenceModels/compressible/compressibleTurbulenceModel.H @@ -120,6 +120,9 @@ public: //- Return the source term for the momentum equation virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const = 0; + + //- Correct the turbulence thermal diffusivity for energy transport + virtual void correctEnergyTransport() = 0; }; diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C new file mode 100644 index 00000000000..1df17993a7f --- /dev/null +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +alphatPhaseChangeWallFunctionFvPatchScalarField:: +alphatPhaseChangeWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(p, iF), + dmdt_(p.size(), 0.0) +{} + + +alphatPhaseChangeWallFunctionFvPatchScalarField:: +alphatPhaseChangeWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + dmdt_(p.size(), 0.0) +{ + if (dict.found("dmdt")) + { + dmdt_ = scalarField("dmdt", dict, p.size()); + } +} + + +alphatPhaseChangeWallFunctionFvPatchScalarField:: +alphatPhaseChangeWallFunctionFvPatchScalarField +( + const alphatPhaseChangeWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + dmdt_(ptf.dmdt_, mapper) +{} + + +alphatPhaseChangeWallFunctionFvPatchScalarField:: +alphatPhaseChangeWallFunctionFvPatchScalarField +( + const alphatPhaseChangeWallFunctionFvPatchScalarField& awfpsf +) +: + fixedValueFvPatchScalarField(awfpsf), + dmdt_(awfpsf.dmdt_) +{} + + +alphatPhaseChangeWallFunctionFvPatchScalarField:: +alphatPhaseChangeWallFunctionFvPatchScalarField +( + const alphatPhaseChangeWallFunctionFvPatchScalarField& awfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(awfpsf, iF), + dmdt_(awfpsf.dmdt_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void alphatPhaseChangeWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField<scalar>::write(os); + dmdt_.writeEntry("dmdt", os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H new file mode 100644 index 00000000000..fb424995a81 --- /dev/null +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>. + +Class + Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField + +Group + grpCmpWallFunctions + +Description + Abstract base-class for all alphatWallFunctions supporting phase-change. + +SeeAlso + Foam::alphatWallFunction + +SourceFiles + alphatPhaseChangeWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef compressibleAlphatWallFunctionPhaseChangeFvPatchScalarField_H +#define compressibleAlphatWallFunctionPhaseChangeFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class alphatPhaseChangeWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class alphatPhaseChangeWallFunctionFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ +protected: + + // Protected data + + //- Rate of phase-change + scalarField dmdt_; + + +public: + + //- Runtime type information + TypeName("compressible::alphatPhaseChangeWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // alphatPhaseChangeWallFunctionFvPatchScalarField + // onto a new patch + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + const alphatPhaseChangeWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + const alphatPhaseChangeWallFunctionFvPatchScalarField& + ); + + //- Construct as copy setting internal field reference + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + const alphatPhaseChangeWallFunctionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + + // Member functions + + //- Return the rate of phase-change + const scalarField& dmdt() const + { + return dmdt_; + } + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs() = 0; + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // -- GitLab