Go to the documentation of this file.
50 Foam::fa::limitVelocity::limitVelocity
53 const word& modelType,
59 UName_(coeffs_.getOrDefault<
word>(
"U",
"U")),
60 max_(coeffs_.get<scalar>(
"max"))
62 fieldNames_.setSize(1, UName_);
63 applied_.setSize(1,
false);
84 const scalar maxSqrU =
sqr(max_);
88 for (
const label facei : faces_)
90 const scalar magSqrUi =
magSqr(Uif[facei]);
92 if (magSqrUi > maxSqrU)
94 Uif[facei] *=
sqrt(maxSqrU/
max(magSqrUi, SMALL));
103 if (!Up.fixesValue())
107 const scalar magSqrUi =
magSqr(Up[facei]);
109 if (magSqrUi > maxSqrU)
111 Up[facei] *=
sqrt(maxSqrU/
max(magSqrUi, SMALL));
120 U.correctBoundaryConditions();
Limits the maximum velocity magnitude to the specified max value.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
A class for handling words, derived from Foam::string.
Intermediate abstract class for handling face-set options for the derived faOptions.
virtual bool read(const dictionary &dict)
Read dictionary.
defineTypeNameAndDebug(limitVelocity, 0)
#define forAll(list, i)
Loop across all elements in list.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
bool useSubMesh() const noexcept
True if sub-selection should be used.
scalar max_
Maximum velocity magnitude.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
dictionary coeffs_
Dictionary containing source coefficients.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void correct(areaVectorField &U)
Correct the velocity field.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const std::string patch
OpenFOAM patch number as a std::string.
Base abstract class for handling finite area options (i.e. faOption).
dimensionedScalar sqrt(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
addToRunTimeSelectionTable(option, limitVelocity, dictionary)