Option to restrict Nu number scaling to predefined cell set.

This commit is contained in:
Thomas Lichtenegger
2023-06-22 07:52:13 +02:00
parent cd1ddfa16a
commit 41d49e98d3
4 changed files with 58 additions and 4 deletions

View File

@ -51,6 +51,9 @@ heatTransferGunn::heatTransferGunn
implicit_(propsDict_.lookupOrDefault<bool>("implicit",true)),
calcTotalHeatFlux_(propsDict_.lookupOrDefault<bool>("calcTotalHeatFlux",true)),
initPartTemp_(propsDict_.lookupOrDefault<bool>("initPartTemp",false)),
scaleNuCellsName_(propsDict_.lookupOrDefault<word>("scaleNuCellsName","all")),
scaleNuCells_(),
allScaleNuCells_(false),
Tmin_(propsDict_.lookupOrDefault<scalar>("Tmin",0.0)),
Tmax_(propsDict_.lookupOrDefault<scalar>("Tmax",1e6)),
totalHeatFlux_(0.0),
@ -166,7 +169,12 @@ heatTransferGunn::heatTransferGunn
if (propsDict_.found("NusseltScalingFactor"))
{
NusseltScalingFactor_=readScalar(propsDict_.lookup ("NusseltScalingFactor"));
Info << "NusseltScalingFactor set to: " << NusseltScalingFactor_ << endl;
if(scaleNuCellsName_ != "all")
{
scaleNuCells_.set(new cellSet(particleCloud_.mesh(),scaleNuCellsName_));
}
else allScaleNuCells_ = true;
Info << "NusseltScalingFactor set to: " << NusseltScalingFactor_ << " in cellSet " << scaleNuCellsName_ << endl;
}
if (propsDict_.found("maxSource"))
@ -237,6 +245,11 @@ heatTransferGunn::~heatTransferGunn()
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
bool heatTransferGunn::scaleNuCell(label cell) const
{
if (allScaleNuCells_) return true;
else return scaleNuCells_()[cell];
}
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
@ -359,7 +372,11 @@ void heatTransferGunn::calcEnergyContribution()
Pr = max(SMALL, Cp * muf / kf0);
Nup = Nusselt(voidfraction, Rep, Pr);
}
Nup *= NusseltScalingFactor_;
if (scaleNuCell(cellI))
{
Nup *= NusseltScalingFactor_;
}
Tsum += partTemp_[index][0];
Nsum += 1.0;

View File

@ -28,6 +28,8 @@ License
#include "fvCFD.H"
#include "cfdemCloudEnergy.H"
#include "energyModel.H"
#include "autoPtr.H"
#include "cellSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,6 +62,12 @@ protected:
bool initPartTemp_;
word scaleNuCellsName_;
autoPtr<cellSet> scaleNuCells_;
bool allScaleNuCells_;
scalar Tmin_;
scalar Tmax_;
@ -128,6 +136,8 @@ protected:
scalar Nusselt(scalar, scalar, scalar) const;
bool scaleNuCell(label) const;
virtual void giveData();
virtual void heatFlux(label, scalar, scalar, scalar, scalar cg3 = 1.0);

View File

@ -50,6 +50,9 @@ heatTransferRanzMarshall::heatTransferRanzMarshall
implicit_(propsDict_.lookupOrDefault<bool>("implicit",true)),
calcTotalHeatFlux_(propsDict_.lookupOrDefault<bool>("calcTotalHeatFlux",true)),
initPartTemp_(propsDict_.lookupOrDefault<bool>("initPartTemp",false)),
scaleNuCellsName_(propsDict_.lookupOrDefault<word>("scaleNuCellsName","all")),
scaleNuCells_(),
allScaleNuCells_(false),
Tmin_(propsDict_.lookupOrDefault<scalar>("Tmin",0.0)),
Tmax_(propsDict_.lookupOrDefault<scalar>("Tmax",1e6)),
totalHeatFlux_(0.0),
@ -166,7 +169,12 @@ heatTransferRanzMarshall::heatTransferRanzMarshall
if (propsDict_.found("NusseltScalingFactor"))
{
NusseltScalingFactor_=readScalar(propsDict_.lookup ("NusseltScalingFactor"));
Info << "NusseltScalingFactor set to: " << NusseltScalingFactor_ << endl;
if(scaleNuCellsName_ != "all")
{
scaleNuCells_.set(new cellSet(particleCloud_.mesh(),scaleNuCellsName_));
}
else allScaleNuCells_ = true;
Info << "NusseltScalingFactor set to: " << NusseltScalingFactor_ << " in cellSet " << scaleNuCellsName_ << endl;
}
if (NusseltConstParameter_ < 0.6 || NusseltConstParameter_ > 1.8)
@ -246,6 +254,11 @@ heatTransferRanzMarshall::~heatTransferRanzMarshall()
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
bool heatTransferRanzMarshall::scaleNuCell(label cell) const
{
if (allScaleNuCells_) return true;
else return scaleNuCells_()[cell];
}
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
@ -369,7 +382,11 @@ void heatTransferRanzMarshall::calcEnergyContribution()
Pr = max(SMALL, Cp * muf / kf0);
Nup = Nusselt(voidfraction, Rep, Pr);
}
Nup *= NusseltScalingFactor_;
if (scaleNuCell(cellI))
{
Nup *= NusseltScalingFactor_;
}
Tsum += partTemp_[index][0];
Nsum += 1.0;

View File

@ -28,6 +28,8 @@ License
#include "fvCFD.H"
#include "cfdemCloudEnergy.H"
#include "energyModel.H"
#include "autoPtr.H"
#include "cellSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -59,6 +61,12 @@ protected:
bool initPartTemp_;
word scaleNuCellsName_;
autoPtr<cellSet> scaleNuCells_;
bool allScaleNuCells_;
scalar Tmin_;
scalar Tmax_;
@ -129,6 +137,8 @@ protected:
scalar Nusselt(scalar, scalar, scalar) const;
bool scaleNuCell(label) const;
virtual void giveData();
virtual void heatFlux(label, scalar, scalar, scalar, scalar cg3 = 1.0);