73 const auto* thermoPtr =
77 return thermoPtr->
nu();
80 const auto* laminarPtr =
81 mesh_.cfindObject<transportModel>(
"transportProperties");
84 return laminarPtr->nu();
87 const auto* dictPtr = mesh_.cfindObject<
dictionary>(
"transportProperties");
100 <<
"No valid model for laminar viscosity" 112 const word& modelType,
138 coeffs_.readIfPresent(
"nut", nutName_);
139 coeffs_.readIfPresent(
"c", c_);
141 fieldNames_.resize(1, nutName_);
150 if (canWriteHeader())
152 writeFileHeader(file());
162 const auto& tnu = this->
nu();
163 const auto&
nu = tnu();
168 for (
const label celli : cells_)
170 const scalar nutLim = c_*
nu[celli];
172 if (
nut[celli] > nutLim)
179 reduce(nAboveMax, sumOp<label>());
182 const auto percent = [](scalar num, label denom) -> scalar
184 return (denom ? 1
e-2*round(1e4*num/denom) : 0);
187 const scalar nAboveMaxPercent = percent(nAboveMax, nTotCells);
189 Info<<
type() <<
' ' << name_ <<
" limited " << nAboveMax <<
" (" 190 << nAboveMaxPercent <<
"%) of cells" <<
endl;
192 if (canWriteToFile())
195 << mesh_.time().timeOutputValue() <<
token::TAB 208 for (
auto& nutp : nutbf)
212 const scalarField& nup = nubf[nutp.patch().index()];
216 scalar nutLim = c_*nup[facei];
217 if (nutp[facei] > nutLim)
219 nutp[facei] = nutLim;
237 nut.boundaryFieldRef().evaluateCoupled<processorFvPatch>();
word dictName() const
The local dictionary name (final part of scoped name)
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
defineTypeNameAndDebug(atmAmbientTurbSource, 0)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual tmp< volScalarField > nu() const =0
Return the laminar viscosity.
const dimensionSet dimViscosity
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
virtual bool read(const dictionary &dict)
Read source dictionary.
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
Type of boundary fields.
bool writtenHeader_
Flag to identify whether the header has been written.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Abstract base class for turbulence models (RAS, LES and laminar).
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
virtual bool isActive()
Is the source active?
static const word propertiesName
Default name of the turbulence properties dictionary.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Fundamental fluid thermodynamic properties.
void writeFileHeader(Ostream &os)
Write file header information.
limitTurbulenceViscosity(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
addToRunTimeSelectionTable(option, atmAmbientTurbSource, dictionary)
void writeHeaderValue(Ostream &os, const string &property, const Type &value) const
Write a (commented) header property and value pair.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
scalar c_
Limiting coefficient [].
tmp< volScalarField > nu() const
Return laminar viscosity.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].
messageStream Info
Information stream (stdout output on master, null elsewhere)
Corrects turbulence viscosity field (e.g. nut) within a specified region by applying a maximum limit...
Intermediate abstract class for handling cell-set options for the derived fvOptions.
word nutName_
Name of turbulence viscosity field.
A class for managing temporary objects.
virtual bool read(const dictionary &dict)
Read dictionary.
bool useSubMesh() const noexcept
True if sub-selection should be used.
virtual void correct(volScalarField &nut)
Correct the energy field.
Do not request registration (bool: false)
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
Base abstract class for handling finite volume options (i.e. fvOption).
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.