fvOptions::damping: Corrected handling of multiple damping regions

Resolves bug-report https://bugs.openfoam.org/view.php?id=3302
This commit is contained in:
Henry Weller
2019-07-04 14:25:21 +01:00
parent 4915a13260
commit 1cd4b292eb

View File

@ -58,15 +58,15 @@ Foam::tmp<Foam::volScalarField::Internal> Foam::fv::damping::forceCoeff() const
); );
scalarField& forceCoeff = tforceCoeff.ref(); scalarField& forceCoeff = tforceCoeff.ref();
const scalar lambda = lambda_.value();
forAll(origins_, i) forAll(origins_, i)
{ {
const vectorField& c = mesh_.cellCentres(); const vectorField& c = mesh_.cellCentres();
const scalarField x((c - origins_[i]) & directions_[i]); const scalarField x((c - origins_[i]) & directions_[i]);
forceCoeff = lambda*max(forceCoeff, scale_->value(x)); forceCoeff = max(forceCoeff, scale_->value(x));
} }
forceCoeff *= lambda_.value();
// Write out the force coefficient for debugging // Write out the force coefficient for debugging
if (debug && mesh_.time().writeTime()) if (debug && mesh_.time().writeTime())
{ {