45 velocityDampingConstraint,
71 for (
const label celli :
cells_)
73 const scalar magU =
mag(
U[celli]);
84 reduce(nDamped, sumOp<label>());
87 const auto percent = [](scalar num, label denom) -> scalar
89 return (denom ? 1
e-2*round(1e4*num/denom) : 0);
92 const scalar nDampedPercent = percent(nDamped, nTotCells);
97 <<
"%) of cells, with max limit " <<
UMax_ <<
endl;
114 writeCommented(
os,
"Time");
115 writeTabbed(
os,
"nDamped_[count]");
116 writeTabbed(
os,
"nDamped_[%]");
120 writtenHeader_ =
true;
129 const word& modelType,
157 dict_.writeEntry(name_,
os);
168 coeffs_.readEntry(
"UMax", UMax_);
169 coeffs_.readIfPresent(
"C", C_);
171 if (!coeffs_.readIfPresent(
"UNames", fieldNames_))
173 fieldNames_.resize(1);
174 fieldNames_.first() = coeffs_.getOrDefault<
word>(
"U",
"U");
185 if (canWriteHeader())
187 writeFileHeader(file());
void writeFileHeader(Ostream &os)
Write file header information.
const scalarField & diag() const
virtual bool read(const dictionary &dict)
Read dictionary.
virtual OFstream & file()
Return access to the file (if only 1)
void size(const label n)
Older name for setAddressableSize.
virtual bool canWriteToFile() const
Flag to allow writing to the file.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
defineTypeNameAndDebug(atmAmbientTurbSource, 0)
const fvMesh & mesh_
Reference to the mesh database.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool read(const dictionary &dict)
Read source dictionary.
const Time & time() const
Return the top-level database.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
Macros for easy insertion into run-time selection tables.
velocityDampingConstraint(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
void reduce(T &value, [[maybe_unused]] BinaryOp bop, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
const dimensionedScalar e
Elementary charge.
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
const word name_
Source name.
A class for handling words, derived from Foam::string.
dimensionedScalar cbrt(const dimensionedScalar &ds)
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
addToRunTimeSelectionTable(option, atmAmbientTurbSource, dictionary)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
virtual void constrain(fvMatrix< vector > &eqn, const label fieldi)
Constrain vector matrix.
labelList cells_
Set of cells to apply source to.
scalar timeOutputValue() const
Return the current user-time value. (ie, after applying any timeToUserTime() conversion) ...
void addDamping(fvMatrix< vector > &eqn)
Constrain the given velocity fields by a given maximum value.
Mesh data needed to do the Finite Volume discretisation.
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Intermediate abstract class for handling cell-set options for the derived fvOptions.
scalar UMax_
Maximum velocity magnitude.
virtual void writeData(Ostream &os) const
Write data.