ENH: velocityDampingConstraint - updated to operate on a cell section. See #2301

This commit is contained in:
Andrew Heather
2022-01-11 17:13:29 +00:00
parent 7825d24de1
commit 83ef7aa5d2

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -64,14 +64,14 @@ void Foam::fv::velocityDampingConstraint::addDamping(fvMatrix<vector>& eqn)
label nDamped = 0; label nDamped = 0;
forAll(U, cellI) for (label celli : cells_)
{ {
const scalar magU = mag(U[cellI]); const scalar magU = mag(U[celli]);
if (magU > UMax_) if (magU > UMax_)
{ {
const scalar scale = sqr(Foam::cbrt(vol[cellI])); const scalar scale = sqr(Foam::cbrt(vol[celli]));
diag[cellI] += scale*(magU-UMax_); diag[celli] += scale*(magU-UMax_);
++nDamped; ++nDamped;
} }