Commit ef48fa18 authored by Henry Weller's avatar Henry Weller Committed by Andrew Heather
Browse files

flowRateInletVelocity extrapolated: Removed reverse flow and correct only the normal component

Improved stability and convergence.
parent 823d83b3
...@@ -156,31 +156,43 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateValues ...@@ -156,31 +156,43 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateValues
{ {
const scalar t = db().time().timeOutputValue(); const scalar t = db().time().timeOutputValue();
tmp<vectorField> n = patch().nf(); const vectorField n(patch().nf());
if (extrapolateProfile_) if (extrapolateProfile_)
{ {
vectorField newValues(this->patchInternalField()); vectorField Up(this->patchInternalField());
scalar flowRate = flowRate_->value(t); // Patch normal extrapolated velocity
scalar estimatedFlowRate = -gSum(rho*(this->patch().Sf() & newValues)); scalarField nUp(n & Up);
// Remove the normal component of the extrapolate patch velocity
Up -= nUp*n;
// Remove any reverse flow
nUp = min(nUp, 0.0);
const scalar flowRate = flowRate_->value(t);
const scalar estimatedFlowRate = -gSum(rho*(this->patch().magSf()*nUp));
if (estimatedFlowRate/flowRate > 0.5) if (estimatedFlowRate/flowRate > 0.5)
{ {
newValues *= (mag(flowRate)/mag(estimatedFlowRate)); nUp *= (mag(flowRate)/mag(estimatedFlowRate));
} }
else else
{ {
newValues -= nUp -= ((flowRate - estimatedFlowRate)/gSum(rho*patch().magSf()));
((flowRate - estimatedFlowRate)/gSum(rho*patch().magSf()))*n;
} }
this->operator==(newValues); // Add the corrected normal component of velocity to the patch velocity
Up += nUp*n;
// Correct the patch velocity
this->operator==(Up);
} }
else else
{ {
const scalar avgU = -flowRate_->value(t)/gSum(rho*patch().magSf()); const scalar avgU = -flowRate_->value(t)/gSum(rho*patch().magSf());
operator==(n*avgU); operator==(avgU*n);
} }
} }
......
...@@ -160,10 +160,10 @@ void Foam::flowRateOutletVelocityFvPatchVectorField::updateValues ...@@ -160,10 +160,10 @@ void Foam::flowRateOutletVelocityFvPatchVectorField::updateValues
Up -= nUp*n; Up -= nUp*n;
// Remove any reverse flow // Remove any reverse flow
nUp = min(nUp, 0.0); nUp = max(nUp, 0.0);
const scalar flowRate = flowRate_->value(t); const scalar flowRate = flowRate_->value(t);
const scalar estimatedFlowRate = -gSum(rho*(this->patch().magSf()*nUp)); const scalar estimatedFlowRate = gSum(rho*(this->patch().magSf()*nUp));
if (estimatedFlowRate/flowRate > 0.5) if (estimatedFlowRate/flowRate > 0.5)
{ {
...@@ -171,7 +171,7 @@ void Foam::flowRateOutletVelocityFvPatchVectorField::updateValues ...@@ -171,7 +171,7 @@ void Foam::flowRateOutletVelocityFvPatchVectorField::updateValues
} }
else else
{ {
nUp -= ((flowRate - estimatedFlowRate)/gSum(rho*patch().magSf())); nUp += ((flowRate - estimatedFlowRate)/gSum(rho*patch().magSf()));
} }
// Add the corrected normal component of velocity to the patch velocity // Add the corrected normal component of velocity to the patch velocity
......
Supports Markdown
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