Skip to content
Snippets Groups Projects
Commit e1b6dfa6 authored by mattijs's avatar mattijs
Browse files

ENH: flowRateVelocityInlet: fall back to rhoInlet

parent beb2943d
Branches
Tags
No related merge requests found
......@@ -72,7 +72,7 @@ flowRateInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(p, iF),
rhoInlet_(0.0)
rhoInlet_(dict.lookupOrDefault<scalar>("rhoInlet", -VGREAT))
{
if (dict.found("volumetricFlowRate"))
{
......@@ -107,14 +107,9 @@ flowRateInletVelocityFvPatchVectorField
vectorField("value", dict, p.size())
);
}
else if (volumetric_)
{
evaluate(Pstream::blocking);
}
else
{
rhoInlet_ = readScalar(dict.lookup("rhoInlet"));
updateCoeffs(rhoInlet_);
evaluate(Pstream::blocking);
}
}
......@@ -202,10 +197,30 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
else
{
// mass flow-rate
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
operator==(n*avgU/rhop);
if
(
patch().boundaryMesh().mesh().foundObject<volScalarField>(rhoName_)
)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
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();
......@@ -219,7 +234,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
if (!volumetric_)
{
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
os.writeKeyword("rhoInlet") << rhoInlet_ << token::END_STATEMENT << nl;
writeEntryIfDifferent<scalar>(os, "rhoInlet", -VGREAT, rhoInlet_);
}
writeEntry("value", os);
}
......
......@@ -29,7 +29,7 @@ Description
magnitude as an integral over its area.
Either specify 'volumetricFlowRate' or 'massFlowRate' (requires additional
'rho' entry).
'rho' or 'rhoInlet' entry).
Example of the boundary condition specification:
\verbatim
......@@ -44,9 +44,10 @@ Description
inlet
{
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]
value uniform (0 0 0); // placeholder
rhoInlet 1.0 // uniform rho if no rho field registered
// (e.g. at startup)
}
\endverbatim
......
......@@ -33,17 +33,13 @@ boundaryField
{
type flowRateInletVelocity;
massFlowRate constant 0.00379;
//volumetricFlowRate constant 0.00379;
rhoInlet 1.0;
value uniform (0 14.68 0);
rhoInlet 1.0; // fallback value for e.g. potentialFoam
}
inletSides
{
type flowRateInletVelocity;
massFlowRate constant 0.00832;
//volumetricFlowRate constant 0.00832;
rhoInlet 1.0;
value uniform (0 17.79 0);
rhoInlet 1.0; // fallback value for e.g. potentialFoam
}
outlet
{
......
......@@ -14,9 +14,6 @@ runApplication potentialFoam
rm -f 0/phi
# change flowRateInletVelocity to massFlowRate
runApplication changeDictionary
# run the solver
runApplication `getApplication`
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment