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");
96 mesh_.time().timeName(),
106 <<
"No valid model for laminar viscosity" 118 const word& modelType,
144 coeffs_.readIfPresent(
"nut", nutName_);
145 coeffs_.readIfPresent(
"c", c_);
147 fieldNames_.resize(1, nutName_);
156 if (canWriteHeader())
158 writeFileHeader(file());
168 const auto& tnu = this->
nu();
169 const auto&
nu = tnu();
174 for (
const label celli : cells_)
176 const scalar nutLim = c_*
nu[celli];
178 if (
nut[celli] > nutLim)
185 reduce(nAboveMax, sumOp<label>());
188 const auto percent = [](scalar num, label denom) -> scalar
190 return (denom ? 1
e-2*round(1e4*num/denom) : 0);
193 const scalar nAboveMaxPercent = percent(nAboveMax, nTotCells);
195 Info<<
type() <<
' ' << name_ <<
" limited " << nAboveMax <<
" (" 196 << nAboveMaxPercent <<
"%) of cells" <<
endl;
198 if (canWriteToFile())
201 << mesh_.time().timeOutputValue() <<
token::TAB 214 for (
auto& nutp : nutbf)
218 const scalarField& nup = nubf[nutp.patch().index()];
222 scalar nutLim = c_*nup[facei];
223 if (nutp[facei] > nutLim)
225 nutp[facei] = nutLim;
243 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< T > New(Args &&... args)
Construct tmp with forwarding arguments.
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].
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
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.
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.