mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: outletMappedUniformInlet BC - Cp only calculated for patch and not entire domain; input keywords updated for consistency
This commit is contained in:
@ -42,8 +42,8 @@ outletMappedUniformInletHeatAdditionFvPatchField
|
|||||||
outletPatchName_(),
|
outletPatchName_(),
|
||||||
phiName_("phi"),
|
phiName_("phi"),
|
||||||
Q_(0),
|
Q_(0),
|
||||||
minTempLimit_(0),
|
TMin_(0),
|
||||||
maxTempLimit_(5000)
|
TMax_(5000)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -60,8 +60,8 @@ outletMappedUniformInletHeatAdditionFvPatchField
|
|||||||
outletPatchName_(ptf.outletPatchName_),
|
outletPatchName_(ptf.outletPatchName_),
|
||||||
phiName_(ptf.phiName_),
|
phiName_(ptf.phiName_),
|
||||||
Q_(ptf.Q_),
|
Q_(ptf.Q_),
|
||||||
minTempLimit_(ptf.minTempLimit_),
|
TMin_(ptf.TMin_),
|
||||||
maxTempLimit_(ptf.maxTempLimit_)
|
TMax_(ptf.TMax_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -77,8 +77,8 @@ outletMappedUniformInletHeatAdditionFvPatchField
|
|||||||
outletPatchName_(dict.lookup("outletPatch")),
|
outletPatchName_(dict.lookup("outletPatch")),
|
||||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
Q_(readScalar(dict.lookup("Q"))),
|
Q_(readScalar(dict.lookup("Q"))),
|
||||||
minTempLimit_(dict.lookupOrDefault<scalar>("minTempLimit", 0)),
|
TMin_(dict.lookupOrDefault<scalar>("TMin", 0)),
|
||||||
maxTempLimit_(dict.lookupOrDefault<scalar>("maxTempLimit", 5000))
|
TMax_(dict.lookupOrDefault<scalar>("TMax", 5000))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -93,8 +93,8 @@ outletMappedUniformInletHeatAdditionFvPatchField
|
|||||||
outletPatchName_(ptf.outletPatchName_),
|
outletPatchName_(ptf.outletPatchName_),
|
||||||
phiName_(ptf.phiName_),
|
phiName_(ptf.phiName_),
|
||||||
Q_(ptf.Q_),
|
Q_(ptf.Q_),
|
||||||
minTempLimit_(ptf.minTempLimit_),
|
TMin_(ptf.TMin_),
|
||||||
maxTempLimit_(ptf.maxTempLimit_)
|
TMax_(ptf.TMax_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -110,8 +110,8 @@ outletMappedUniformInletHeatAdditionFvPatchField
|
|||||||
outletPatchName_(ptf.outletPatchName_),
|
outletPatchName_(ptf.outletPatchName_),
|
||||||
phiName_(ptf.phiName_),
|
phiName_(ptf.phiName_),
|
||||||
Q_(ptf.Q_),
|
Q_(ptf.Q_),
|
||||||
minTempLimit_(ptf.minTempLimit_),
|
TMin_(ptf.TMin_),
|
||||||
maxTempLimit_(ptf.maxTempLimit_)
|
TMax_(ptf.TMax_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -125,18 +125,15 @@ void Foam::outletMappedUniformInletHeatAdditionFvPatchField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GeometricField<scalar, fvPatchField, volMesh>& f
|
const volScalarField& vsf =
|
||||||
(
|
(
|
||||||
dynamic_cast<const GeometricField<scalar, fvPatchField, volMesh>&>
|
dynamic_cast<const volScalarField&>(this->internalField())
|
||||||
(
|
|
||||||
this->internalField()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const fvPatch& p = this->patch();
|
const fvPatch& fvp = this->patch();
|
||||||
|
|
||||||
label outletPatchID =
|
label outletPatchID =
|
||||||
p.patch().boundaryMesh().findPatchID(outletPatchName_);
|
fvp.patch().boundaryMesh().findPatchID(outletPatchName_);
|
||||||
|
|
||||||
if (outletPatchID < 0)
|
if (outletPatchID < 0)
|
||||||
{
|
{
|
||||||
@ -145,16 +142,13 @@ void Foam::outletMappedUniformInletHeatAdditionFvPatchField::updateCoeffs()
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fvPatch& outletPatch = p.boundaryMesh()[outletPatchID];
|
const fvPatch& outletPatch = fvp.boundaryMesh()[outletPatchID];
|
||||||
|
|
||||||
const fvPatchField<scalar>& outletPatchField =
|
const fvPatchField<scalar>& outletPatchField =
|
||||||
f.boundaryField()[outletPatchID];
|
vsf.boundaryField()[outletPatchID];
|
||||||
|
|
||||||
const surfaceScalarField& phi =
|
const surfaceScalarField& phi =
|
||||||
this->db().lookupObject<surfaceScalarField>
|
db().lookupObject<surfaceScalarField>(phiName_);
|
||||||
(
|
|
||||||
phiName_
|
|
||||||
);
|
|
||||||
|
|
||||||
const scalarField& outletPatchPhi = phi.boundaryField()[outletPatchID];
|
const scalarField& outletPatchPhi = phi.boundaryField()[outletPatchID];
|
||||||
scalar sumOutletPatchPhi = gSum(outletPatchPhi);
|
scalar sumOutletPatchPhi = gSum(outletPatchPhi);
|
||||||
@ -162,27 +156,19 @@ void Foam::outletMappedUniformInletHeatAdditionFvPatchField::updateCoeffs()
|
|||||||
if (sumOutletPatchPhi > SMALL)
|
if (sumOutletPatchPhi > SMALL)
|
||||||
{
|
{
|
||||||
const basicThermo& thermo =
|
const basicThermo& thermo =
|
||||||
this->db().lookupObject<basicThermo>(basicThermo::dictName);
|
db().lookupObject<basicThermo>(basicThermo::dictName);
|
||||||
|
|
||||||
|
const scalarField& pp = thermo.p().boundaryField()[outletPatchID];
|
||||||
|
const scalarField& pT = thermo.T().boundaryField()[outletPatchID];
|
||||||
|
|
||||||
scalar averageOutletField =
|
scalar averageOutletField =
|
||||||
gSum(outletPatchPhi*outletPatchField)/sumOutletPatchPhi;
|
gSum(outletPatchPhi*outletPatchField)/sumOutletPatchPhi;
|
||||||
|
|
||||||
const scalarField Cpf(thermo.Cp()().boundaryField()[outletPatchID]);
|
const scalarField Cpf(thermo.Cp(pp, pT, outletPatchID));
|
||||||
|
|
||||||
scalar totalPhiCp = gSum(outletPatchPhi)*gAverage(Cpf);
|
scalar totalPhiCp = gSum(outletPatchPhi)*gAverage(Cpf);
|
||||||
|
|
||||||
operator==
|
operator==(min(max(averageOutletField + Q_/totalPhiCp, TMin_), TMax_));
|
||||||
(
|
|
||||||
min
|
|
||||||
(
|
|
||||||
max
|
|
||||||
(
|
|
||||||
averageOutletField + Q_/totalPhiCp,
|
|
||||||
minTempLimit_
|
|
||||||
),
|
|
||||||
maxTempLimit_
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -205,14 +191,10 @@ void Foam::outletMappedUniformInletHeatAdditionFvPatchField::write
|
|||||||
fvPatchScalarField::write(os);
|
fvPatchScalarField::write(os);
|
||||||
os.writeKeyword("outletPatch")
|
os.writeKeyword("outletPatch")
|
||||||
<< outletPatchName_ << token::END_STATEMENT << nl;
|
<< outletPatchName_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||||
|
|
||||||
os.writeKeyword("Q") << Q_ << token::END_STATEMENT << nl;
|
os.writeKeyword("Q") << Q_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("minTempLimit")
|
os.writeKeyword("TMin") << TMin_ << token::END_STATEMENT << nl;
|
||||||
<< minTempLimit_ << token::END_STATEMENT << nl;
|
os.writeKeyword("TMax") << TMax_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("maxTempLimit")
|
|
||||||
<< maxTempLimit_ << token::END_STATEMENT << nl;
|
|
||||||
|
|
||||||
this->writeEntry("value", os);
|
this->writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,17 +32,17 @@ Description
|
|||||||
This temperature boundary condition averages the temperature over the
|
This temperature boundary condition averages the temperature over the
|
||||||
"outlet" patch specified by name "outletPatchName" and applies an extra
|
"outlet" patch specified by name "outletPatchName" and applies an extra
|
||||||
heat source. This is set as a uniform temperature value on this patch.
|
heat source. This is set as a uniform temperature value on this patch.
|
||||||
Additionally minTempLimit/maxTempLimit limits can be applied
|
Additionally TMin/TMax limits can be applied
|
||||||
|
|
||||||
\heading Patch usage
|
\heading Patch usage
|
||||||
|
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
outletPatch | name of outlet patch | yes |
|
outletPatch | name of outlet patch | yes |
|
||||||
Q | Heat addition | yes
|
Q | Heat addition | yes
|
||||||
phi | flux field name | no | phi
|
phi | flux field name | no | phi
|
||||||
minTempLimit | min temperature limit | no | 0.0
|
TMin | min temperature limit | no | 0.0
|
||||||
maxTempLimit | max temperature limit | no | 5000.0
|
TMax | max temperature limit | no | 5000.0
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
Example of the boundary condition specification:
|
||||||
@ -96,10 +96,10 @@ class outletMappedUniformInletHeatAdditionFvPatchField
|
|||||||
scalar Q_;
|
scalar Q_;
|
||||||
|
|
||||||
//- Minimum Temperature Limit
|
//- Minimum Temperature Limit
|
||||||
scalar minTempLimit_;
|
scalar TMin_;
|
||||||
|
|
||||||
//- Maxmum Temperature Limit
|
//- Maxmum Temperature Limit
|
||||||
scalar maxTempLimit_;
|
scalar TMax_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -26,8 +26,8 @@ boundaryField
|
|||||||
type outletMappedUniformInletHeatAddition;
|
type outletMappedUniformInletHeatAddition;
|
||||||
outletPatchName outlet1;
|
outletPatchName outlet1;
|
||||||
Q 5; // Heat addition in W
|
Q 5; // Heat addition in W
|
||||||
minTempLimit 300;
|
TMin 300;
|
||||||
maxTempLimit 500;
|
TMax 500;
|
||||||
value $internalField;
|
value $internalField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user