37 namespace functionObjects
58 bool Foam::functionObjects::blendingFactor::calc()
60 bool processed =
false;
62 processed = processed || calcScheme<scalar>();
63 processed = processed || calcScheme<vector>();
113 phiName_ =
dict.getOrDefault<
word>(
"phi",
"phi");
116 dict.getCheckOrDefault
120 [](scalar tol){
return (tol > 0 && tol < 1); }
135 lookupObject<volScalarField>(resultName_);
138 label nCellsScheme1 = 0;
139 label nCellsScheme2 = 0;
140 label nCellsBlended = 0;
141 for (
const auto i : indicator)
147 else if (i > (1 - tolerance_))
157 reduce(nCellsScheme1, sumOp<label>());
158 reduce(nCellsScheme2, sumOp<label>());
159 reduce(nCellsBlended, sumOp<label>());
161 Log <<
" scheme 1 cells : " << nCellsScheme1 <<
nl 162 <<
" scheme 2 cells : " << nCellsScheme2 <<
nl 163 <<
" blended cells : " << nCellsBlended <<
nl 166 writeCurrentTime(file());
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
virtual OFstream & file()
Return access to the file (if only 1)
defineTypeNameAndDebug(ObukhovLength, 0)
word resultName_
Name of result field.
Computes blending factor as an indicator about which of the schemes is active across the domain...
virtual void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
virtual bool write()
Write the blendingFactor.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool read(const dictionary &dict)
Read the fieldExpression data.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
Abstract base-class for Time/database function objects.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
void setResultName(const word &typeName, const word &defaultArg)
Set the name of result field.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
virtual bool read(const dictionary &)
Read the blendingFactor data.
A class for handling words, derived from Foam::string.
bool store(word &fieldName, const tmp< ObjectType > &tfield, bool cacheable=false)
Store the field in the (sub) objectRegistry under the given name.
virtual bool write()
Write the result field.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
virtual bool read(const dictionary &dict)
Read.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Intermediate class for handling field expression function objects (e.g. blendingFactor etc...
virtual void writeFileHeader(Ostream &os) const
Write the file header.
Base class for writing single files from the function objects.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
const fvMesh & mesh_
Reference to the fvMesh.
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.
blendingFactor(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
static constexpr const zero Zero
Global zero (0)
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.
const Time & time_
Reference to the time database.