mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: variableHeightFlowRateInletVelocity BC - update for moving meshes. See #3012
Dynamic mesh updates trigger a velocity field update. For [this] BC the update can fail if the dependent alpha field has not already been updated.
This commit is contained in:
@ -101,18 +101,29 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
|
void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
||||||
::updateCoeffs()
|
|
||||||
{
|
{
|
||||||
if (updated())
|
if (updated())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scalarField alphap
|
const auto& mesh = patch().boundaryMesh().mesh();
|
||||||
(
|
auto& alpha = mesh.lookupObjectRef<volScalarField>(alphaName_);
|
||||||
patch().lookupPatchField<volScalarField>(alphaName_)
|
|
||||||
);
|
// Update alpha boundary (if needed) due to mesh changes
|
||||||
|
if (!mesh.upToDatePoints(alpha))
|
||||||
|
{
|
||||||
|
auto& alphabf = alpha.boundaryFieldRef();
|
||||||
|
|
||||||
|
if (!alphabf[patch().index()].updated())
|
||||||
|
{
|
||||||
|
DebugInfo<< "Updating alpha BC due to mesh changes" << endl;
|
||||||
|
alphabf.evaluateSelected(labelList({ patch().index() }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scalarField alphap(alpha.boundaryField()[patch().index()]);
|
||||||
|
|
||||||
alphap = max(alphap, scalar(0));
|
alphap = max(alphap, scalar(0));
|
||||||
alphap = min(alphap, scalar(1));
|
alphap = min(alphap, scalar(1));
|
||||||
|
|||||||
Reference in New Issue
Block a user