mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: flowRateVelocityInlet: fall back to rhoInlet
This commit is contained in:
@ -72,7 +72,7 @@ flowRateInletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(p, iF),
|
fixedValueFvPatchField<vector>(p, iF),
|
||||||
rhoInlet_(0.0)
|
rhoInlet_(dict.lookupOrDefault<scalar>("rhoInlet", -VGREAT))
|
||||||
{
|
{
|
||||||
if (dict.found("volumetricFlowRate"))
|
if (dict.found("volumetricFlowRate"))
|
||||||
{
|
{
|
||||||
@ -107,14 +107,9 @@ flowRateInletVelocityFvPatchVectorField
|
|||||||
vectorField("value", dict, p.size())
|
vectorField("value", dict, p.size())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (volumetric_)
|
|
||||||
{
|
|
||||||
evaluate(Pstream::blocking);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rhoInlet_ = readScalar(dict.lookup("rhoInlet"));
|
evaluate(Pstream::blocking);
|
||||||
updateCoeffs(rhoInlet_);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,10 +197,30 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// mass flow-rate
|
// mass flow-rate
|
||||||
const fvPatchField<scalar>& rhop =
|
if
|
||||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
(
|
||||||
|
patch().boundaryMesh().mesh().foundObject<volScalarField>(rhoName_)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const fvPatchField<scalar>& rhop =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
|
|
||||||
operator==(n*avgU/rhop);
|
operator==(n*avgU/rhop);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use constant density
|
||||||
|
if (rhoInlet_ < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"flowRateInletVelocityFvPatchVectorField::updateCoeffs()"
|
||||||
|
) << "Did not find registered density field " << rhoName_
|
||||||
|
<< " and no constant density 'rhoInlet' specified"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
operator==(n*avgU/rhoInlet_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedValueFvPatchField<vector>::updateCoeffs();
|
fixedValueFvPatchField<vector>::updateCoeffs();
|
||||||
@ -219,7 +234,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
|
|||||||
if (!volumetric_)
|
if (!volumetric_)
|
||||||
{
|
{
|
||||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||||
os.writeKeyword("rhoInlet") << rhoInlet_ << token::END_STATEMENT << nl;
|
writeEntryIfDifferent<scalar>(os, "rhoInlet", -VGREAT, rhoInlet_);
|
||||||
}
|
}
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Description
|
|||||||
magnitude as an integral over its area.
|
magnitude as an integral over its area.
|
||||||
|
|
||||||
Either specify 'volumetricFlowRate' or 'massFlowRate' (requires additional
|
Either specify 'volumetricFlowRate' or 'massFlowRate' (requires additional
|
||||||
'rho' entry).
|
'rho' or 'rhoInlet' entry).
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
Example of the boundary condition specification:
|
||||||
\verbatim
|
\verbatim
|
||||||
@ -44,9 +44,10 @@ Description
|
|||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
volumetricFlowRate 0.2; // mass flow rate [kg/s]
|
massFlowRate 0.2; // mass flow rate [kg/s]
|
||||||
rho rho; // rho [m3/s or kg/s]
|
rho rho; // rho [m3/s or kg/s]
|
||||||
value uniform (0 0 0); // placeholder
|
rhoInlet 1.0 // uniform rho if no rho field registered
|
||||||
|
// (e.g. at startup)
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
|||||||
@ -33,17 +33,13 @@ boundaryField
|
|||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
massFlowRate constant 0.00379;
|
massFlowRate constant 0.00379;
|
||||||
//volumetricFlowRate constant 0.00379;
|
rhoInlet 1.0; // fallback value for e.g. potentialFoam
|
||||||
rhoInlet 1.0;
|
|
||||||
value uniform (0 14.68 0);
|
|
||||||
}
|
}
|
||||||
inletSides
|
inletSides
|
||||||
{
|
{
|
||||||
type flowRateInletVelocity;
|
type flowRateInletVelocity;
|
||||||
massFlowRate constant 0.00832;
|
massFlowRate constant 0.00832;
|
||||||
//volumetricFlowRate constant 0.00832;
|
rhoInlet 1.0; // fallback value for e.g. potentialFoam
|
||||||
rhoInlet 1.0;
|
|
||||||
value uniform (0 17.79 0);
|
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,9 +14,6 @@ runApplication potentialFoam
|
|||||||
|
|
||||||
rm -f 0/phi
|
rm -f 0/phi
|
||||||
|
|
||||||
# change flowRateInletVelocity to massFlowRate
|
|
||||||
runApplication changeDictionary
|
|
||||||
|
|
||||||
# run the solver
|
# run the solver
|
||||||
runApplication `getApplication`
|
runApplication `getApplication`
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user