69 const word& modelType,
96 coeffs_.readEntry(
"min", Tmin_);
97 coeffs_.readEntry(
"max", Tmax_);
98 coeffs_.readIfPresent(
"phase", phase_);
103 <<
"Minimum temperature limit cannot exceed maximum limit" <<
nl 104 <<
"min = " << Tmin_ <<
nl 112 <<
"Minimum temperature limit cannot be negative" <<
nl 120 mesh_.lookupObject<basicThermo>
125 fieldNames_.resize(1,
thermo.he().name());
135 if (canWriteHeader())
137 writeFileHeader(file());
163 scalar Tmin0 =
min(
T);
164 scalar Tmax0 =
max(
T);
174 const label celli = cells_[i];
175 if (hec[celli] < heMin[i])
177 hec[celli] = heMin[i];
180 else if (hec[celli] > heMax[i])
182 hec[celli] = heMax[i];
187 reduce(nBelowMin, sumOp<label>());
188 reduce(nAboveMax, sumOp<label>());
190 reduce(Tmin0, minOp<scalar>());
191 reduce(Tmax0, maxOp<scalar>());
194 const auto percent = [](scalar num, label denom) -> scalar
196 return (denom ? 1
e-2*round(1e4*num/denom) : 0);
199 const scalar nBelowMinPercent = percent(nBelowMin, nTotCells);
200 const scalar nAboveMaxPercent = percent(nAboveMax, nTotCells);
202 Info<<
type() <<
"=" << name_ <<
", Type=Lower" 203 <<
", LimitedCells=" << nBelowMin
204 <<
", CellsPercent=" << nBelowMinPercent
205 <<
", Tmin=" << Tmin_
206 <<
", UnlimitedTmin=" << Tmin0
209 Info<<
type() <<
"=" << name_ <<
", Type=Upper" 210 <<
", LimitedCells=" << nAboveMax
211 <<
", CellsPercent=" << nAboveMaxPercent
212 <<
", Tmax=" << Tmax_
213 <<
", UnlimitedTmax=" << Tmax0
217 if (canWriteToFile())
220 << mesh_.time().timeOutputValue() <<
token::TAB 230 bool changedValues = (nBelowMin || nAboveMax);
239 if (!hep.fixesValue())
251 if (hep[facei] < heMinp[facei])
253 hep[facei] = heMinp[facei];
254 changedValues =
true;
256 else if (hep[facei] > heMaxp[facei])
258 hep[facei] = heMaxp[facei];
259 changedValues =
true;
271 he.correctBoundaryConditions();
word dictName() const
The local dictionary name (final part of scoped name)
limitTemperature(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Abstract base-class for fluid and solid thermodynamic properties.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Corrects temperature field (i.e. T) within a specified region by applying limits between a given mini...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
defineTypeNameAndDebug(atmAmbientTurbSource, 0)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void correct(volScalarField &he)
Correct the energy field.
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.
void writeFileHeader(Ostream &os)
Write file header information.
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.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
psiReactionThermo & thermo
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.
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
scalar Tmin_
Minimum temperature limit [K].
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?
fvPatchField< scalar > fvPatchScalarField
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
scalar Tmax_
Maximum temperature limit [K].
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
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)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
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.
virtual bool read(const dictionary &dict)
Read dictionary.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
bool useSubMesh() const noexcept
True if sub-selection should be used.
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.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Base abstract class for handling finite volume options (i.e. fvOption).
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.