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();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Abstract base-class for fluid and solid thermodynamic properties.
static const word dictName
The dictionary name ("thermophysicalProperties").
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.
void writeHeaderValue(Ostream &os, const string &property, const Type &value) const
Write a (commented) header property and value pair.
virtual bool canWriteToFile() const
Flag to allow writing to the file.
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
bool writtenHeader_
Flag to identify whether the header has been written.
virtual OFstream & file()
Return access to the file (if only 1).
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
virtual void resetFile(const word &name)
Reset internal file pointer to new file with new name.
virtual bool canWriteHeader() const
Flag to allow writing the header.
virtual bool canResetFile() const
Flag to allow resetting the file.
Mesh data needed to do the Finite Volume discretisation.
virtual bool fixesValue() const
True if the patch field fixes a value.
Intermediate abstract class for handling cell-set options for the derived fvOptions.
labelList cells_
Set of cells to apply source to.
virtual bool read(const dictionary &dict)
Read source dictionary.
cellSetOption(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
bool useSubMesh() const noexcept
True if sub-selection should be used.
virtual bool isActive()
Is the source active?
Corrects temperature field (i.e. T) within a specified region by applying limits between a given mini...
word phase_
Optional phase name.
virtual bool read(const dictionary &dict)
Read dictionary.
limitTemperature(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
scalar Tmax_
Maximum temperature limit [K].
virtual void correct(volScalarField &he)
Correct the energy field.
scalar Tmin_
Minimum temperature limit [K].
void writeFileHeader(Ostream &os)
Write file header information.
Base abstract class for handling finite volume options (i.e. fvOption).
const word & name() const noexcept
Return const access to the source name.
const fvMesh & mesh_
Reference to the mesh database.
wordList fieldNames_
Field names to apply source to - populated by derived models.
dictionary coeffs_
Dictionary containing source coefficients.
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
const word name_
Source name.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
Namespace for finite-volume.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
fvPatchField< scalar > fvPatchScalarField
constexpr char nl
The newline '\n' character (0x0a).
psiReactionThermo & thermo
#define forAll(list, i)
Loop across all elements in list.