36 if (expressions::patchExprFieldBase::debug_ && !
debug)
53 expressions::patchExprFieldBase(),
55 driver_(this->
patch())
72 parent_bctype(rhs,
p, iF, mapper),
73 expressions::patchExprFieldBase(rhs),
75 driver_(this->
patch(), rhs.driver_, dict_)
91 expressions::patchExprFieldBase
94 expressions::patchExprFieldBase::expectedTypes::MIXED_TYPE
106 "value",
"refValue",
"refGradient",
"valueFraction" 110 driver_(this->
patch(), dict_)
116 if (this->valueExpr_.empty() && this->gradExpr_.empty())
119 <<
"For " << this->internalField().name() <<
" on " 120 << this->
patch().name() << nl
121 <<
"Require either or both: valueExpr and gradientExpr" <<
nl 125 if (this->fracExpr_.empty())
128 if (!this->valueExpr_.empty() && !this->gradExpr_.empty())
131 <<
"For " << this->internalField().name() <<
" on " 132 << this->
patch().name() << nl
133 <<
"Recommend using fractionExpr when specifying both" 134 <<
" valueExpr and gradientExpr. Assuming a value of 1." 138 else if (this->fracExpr_ ==
"0")
141 if (this->gradExpr_.empty())
144 <<
"For " << this->internalField().name() <<
" on " 145 << this->
patch().name() << nl
146 <<
"Gradient only, but did not specify gradientExpr." 150 else if (this->fracExpr_ ==
"1")
153 if (this->valueExpr_.empty())
156 <<
"For " << this->internalField().name() <<
" on " 157 << this->
patch().name() << nl
158 <<
"Value only, but did not specify valueExpr." 163 driver_.readDict(dict_);
172 const auto* hasRefGradient
175 const auto* hasValueFraction
181 this->refValue().assign(*hasRefValue,
p.
size());
191 this->refValue() =
static_cast<const Field<Type>&
>(*this);
198 this->refValue() = this->patchInternalField();
205 <<
"No value defined for " 206 << this->internalField().name() <<
" on " 207 << this->
patch().name() <<
" - using patch internal field" <<
endl;
214 this->refGrad().assign(*hasRefGradient,
p.
size());
218 this->refGrad() =
Zero;
221 if (hasValueFraction)
223 this->valueFraction().assign(*hasValueFraction,
p.
size());
227 this->valueFraction() = scalar(1);
231 if (this->evalOnConstruct_)
240 if (!this->updated())
242 this->parent_bctype::updateCoeffs();
247 this->valueFraction()*this->refValue()
249 (1.0 - this->valueFraction())*
251 this->patchInternalField()
252 + this->refGrad()/this->
patch().deltaCoeffs()
264 const exprMixedFvPatchField<Type>& rhs
268 expressions::patchExprFieldBase(rhs),
270 driver_(this->
patch(), rhs.driver_, dict_)
284 parent_bctype(rhs, iF),
285 expressions::patchExprFieldBase(rhs),
287 driver_(this->
patch(), rhs.driver_, dict_)
307 <<
"Value: " << this->valueExpr_ <<
nl 308 <<
"Gradient: " << this->gradExpr_ <<
nl 309 <<
"Fraction: " << this->fracExpr_ <<
nl 311 driver_.writeVariableStrings(
Info) <<
nl;
318 bool evalValue = (!this->valueExpr_.empty() && this->valueExpr_ !=
"0");
319 bool evalGrad = (!this->gradExpr_.empty() && this->gradExpr_ !=
"0");
320 bool evalFrac = (!this->fracExpr_.empty());
325 if (this->valueExpr_.empty())
332 else if (this->gradExpr_.empty())
339 else if (this->fracExpr_.empty())
347 else if (this->fracExpr_ ==
"0")
354 else if (this->fracExpr_ ==
"1")
363 driver_.clearVariables();
367 this->refValue() = driver_.evaluate<Type>(this->valueExpr_);
371 this->refValue() =
Zero;
376 this->refGrad() = driver_.evaluate<Type>(this->gradExpr_);
380 this->refGrad() =
Zero;
385 this->valueFraction() = driver_.evaluate<scalar>(this->fracExpr_);
389 this->valueFraction() = fraction;
393 this->parent_bctype::updateCoeffs();
403 driver_.writeCommon(
os, this->debug_ ||
debug);
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
constexpr char nl
The newline '\n' character (0x0a)
A mixed boundary condition with expressions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual void write(Ostream &os) const
Write.
virtual Field< Type > & refValue()
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
friend Ostream & operator(Ostream &, const Field< Type > &)
exprMixedFvPatchField(const fvPatch &p, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual scalarField & valueFraction()
#define DebugInFunction
Report an information message using Foam::Info.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A FieldMapper for finite-volume patch fields.
string evaluate(label fieldWidth, const std::string &s, size_t pos=0, size_t len=std::string::npos)
String evaluation with specified (positive, non-zero) field width.
A wrapper for dictionary content, without operators that could affect inheritance patterns...
int debug
Static debugging option.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
OBJstream os(runTime.globalPath()/outputName)
void assign(const entry &e, const label len)
Assign from a dictionary (primitive) entry.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets Updated to false.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
virtual void operator=(const UList< Type > &)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const std::string patch
OpenFOAM patch number as a std::string.
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
messageStream Info
Information stream (stdout output on master, null elsewhere)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
void setDebug()
Set debug ON if "debug" is enabled.
virtual Field< Type > & refGrad()
void write(Ostream &os) const
Write.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
#define InfoInFunction
Report an information message using Foam::Info.
static constexpr const zero Zero
Global zero (0)