Skip to content
Snippets Groups Projects
Commit 3ab7d6a0 authored by Kutalmış Berçin's avatar Kutalmış Berçin
Browse files

ENH: outletMappedUniformInletHeatAddition: add Function1-type Q input

parent a445dd10
No related branches found
No related tags found
1 merge request!722RELEASE: develop branch to master
...@@ -41,9 +41,9 @@ outletMappedUniformInletHeatAdditionFvPatchField ...@@ -41,9 +41,9 @@ outletMappedUniformInletHeatAdditionFvPatchField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
Qptr_(nullptr),
outletPatchName_(), outletPatchName_(),
phiName_("phi"), phiName_("phi"),
Q_(0),
TMin_(0), TMin_(0),
TMax_(5000) TMax_(5000)
{} {}
...@@ -59,9 +59,9 @@ outletMappedUniformInletHeatAdditionFvPatchField ...@@ -59,9 +59,9 @@ outletMappedUniformInletHeatAdditionFvPatchField
) )
: :
fixedValueFvPatchScalarField(ptf, p, iF, mapper), fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Qptr_(ptf.Qptr_.clone()),
outletPatchName_(ptf.outletPatchName_), outletPatchName_(ptf.outletPatchName_),
phiName_(ptf.phiName_), phiName_(ptf.phiName_),
Q_(ptf.Q_),
TMin_(ptf.TMin_), TMin_(ptf.TMin_),
TMax_(ptf.TMax_) TMax_(ptf.TMax_)
{} {}
...@@ -76,9 +76,9 @@ outletMappedUniformInletHeatAdditionFvPatchField ...@@ -76,9 +76,9 @@ outletMappedUniformInletHeatAdditionFvPatchField
) )
: :
fixedValueFvPatchScalarField(p, iF, dict), fixedValueFvPatchScalarField(p, iF, dict),
Qptr_(Function1<scalar>::New("Q", dict, &db())),
outletPatchName_(dict.get<word>("outletPatch")), outletPatchName_(dict.get<word>("outletPatch")),
phiName_(dict.getOrDefault<word>("phi", "phi")), phiName_(dict.getOrDefault<word>("phi", "phi")),
Q_(dict.get<scalar>("Q")),
TMin_(dict.getOrDefault<scalar>("TMin", 0)), TMin_(dict.getOrDefault<scalar>("TMin", 0)),
TMax_(dict.getOrDefault<scalar>("TMax", 5000)) TMax_(dict.getOrDefault<scalar>("TMax", 5000))
{} {}
...@@ -92,9 +92,9 @@ outletMappedUniformInletHeatAdditionFvPatchField ...@@ -92,9 +92,9 @@ outletMappedUniformInletHeatAdditionFvPatchField
) )
: :
fixedValueFvPatchScalarField(ptf), fixedValueFvPatchScalarField(ptf),
Qptr_(ptf.Qptr_.clone()),
outletPatchName_(ptf.outletPatchName_), outletPatchName_(ptf.outletPatchName_),
phiName_(ptf.phiName_), phiName_(ptf.phiName_),
Q_(ptf.Q_),
TMin_(ptf.TMin_), TMin_(ptf.TMin_),
TMax_(ptf.TMax_) TMax_(ptf.TMax_)
{} {}
...@@ -109,9 +109,9 @@ outletMappedUniformInletHeatAdditionFvPatchField ...@@ -109,9 +109,9 @@ outletMappedUniformInletHeatAdditionFvPatchField
) )
: :
fixedValueFvPatchScalarField(ptf, iF), fixedValueFvPatchScalarField(ptf, iF),
Qptr_(ptf.Qptr_.clone()),
outletPatchName_(ptf.outletPatchName_), outletPatchName_(ptf.outletPatchName_),
phiName_(ptf.phiName_), phiName_(ptf.phiName_),
Q_(ptf.Q_),
TMin_(ptf.TMin_), TMin_(ptf.TMin_),
TMax_(ptf.TMax_) TMax_(ptf.TMax_)
{} {}
...@@ -166,11 +166,14 @@ void Foam::outletMappedUniformInletHeatAdditionFvPatchField::updateCoeffs() ...@@ -166,11 +166,14 @@ void Foam::outletMappedUniformInletHeatAdditionFvPatchField::updateCoeffs()
scalar averageOutletField = scalar averageOutletField =
gSum(outletPatchPhi*outletPatchField)/sumOutletPatchPhi; gSum(outletPatchPhi*outletPatchField)/sumOutletPatchPhi;
// Calculate Q as a function of average outlet temperature
const scalar Q = Qptr_->value(averageOutletField);
const scalarField Cpf(thermo.Cp(pp, pT, outletPatchID)); const scalarField Cpf(thermo.Cp(pp, pT, outletPatchID));
scalar totalPhiCp = gSum(outletPatchPhi)*gAverage(Cpf); scalar totalPhiCp = gSum(outletPatchPhi)*gAverage(Cpf);
operator==(clamp(averageOutletField + Q_/totalPhiCp, TMin_, TMax_)); operator==(clamp(averageOutletField + Q/totalPhiCp, TMin_, TMax_));
} }
else else
{ {
...@@ -193,7 +196,9 @@ void Foam::outletMappedUniformInletHeatAdditionFvPatchField::write ...@@ -193,7 +196,9 @@ void Foam::outletMappedUniformInletHeatAdditionFvPatchField::write
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeEntry("outletPatch", outletPatchName_); os.writeEntry("outletPatch", outletPatchName_);
os.writeEntryIfDifferent<word>("phi", "phi", phiName_); os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
os.writeEntry("Q", Q_);
Qptr_->writeData(os);
os.writeEntry("TMin", TMin_); os.writeEntry("TMin", TMin_);
os.writeEntry("TMax", TMax_); os.writeEntry("TMax", TMax_);
......
...@@ -72,6 +72,7 @@ SourceFiles ...@@ -72,6 +72,7 @@ SourceFiles
#include "fixedValueFvPatchFields.H" #include "fixedValueFvPatchFields.H"
#include "fvPatchFields.H" #include "fvPatchFields.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...@@ -88,15 +89,15 @@ class outletMappedUniformInletHeatAdditionFvPatchField ...@@ -88,15 +89,15 @@ class outletMappedUniformInletHeatAdditionFvPatchField
{ {
// Private data // Private data
//- Input energy
autoPtr<Function1<scalar>> Qptr_;
//- Name of the outlet patch to be mapped //- Name of the outlet patch to be mapped
word outletPatchName_; word outletPatchName_;
//- Name of the flux transporting the field //- Name of the flux transporting the field
word phiName_; word phiName_;
//- Input energy
scalar Q_;
//- Minimum Temperature Limit //- Minimum Temperature Limit
scalar TMin_; scalar TMin_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment