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_)
113 <<
"Use uniformMixed with Function1 expressions instead." <<
nl 114 <<
" This boundary condition will be removed in the future" <<
endl;
120 if (this->valueExpr_.empty() && this->gradExpr_.empty())
123 <<
"For " << this->internalField().name() <<
" on " 124 << this->
patch().name() << nl
125 <<
"Require either or both: valueExpr and gradientExpr" <<
nl 129 if (this->fracExpr_.empty())
132 if (!this->valueExpr_.empty() && !this->gradExpr_.empty())
135 <<
"For " << this->internalField().name() <<
" on " 136 << this->
patch().name() << nl
137 <<
"Recommend using fractionExpr when specifying both" 138 <<
" valueExpr and gradientExpr. Assuming a value of 1." 142 else if (this->fracExpr_ ==
"0")
145 if (this->gradExpr_.empty())
148 <<
"For " << this->internalField().name() <<
" on " 149 << this->
patch().name() << nl
150 <<
"Gradient only, but did not specify gradientExpr." 154 else if (this->fracExpr_ ==
"1")
157 if (this->valueExpr_.empty())
160 <<
"For " << this->internalField().name() <<
" on " 161 << this->
patch().name() << nl
162 <<
"Value only, but did not specify valueExpr." 167 driver_.readDict(dict_);
174 const auto* hasRefGradient
177 const auto* hasValueFraction
183 this->refValue().assign(*hasRefValue,
p.
size());
186 if (this->readValueEntry(
dict))
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())
253 const exprMixedFvPatchField<Type>& rhs
257 expressions::patchExprFieldBase(rhs),
259 driver_(this->
patch(), rhs.driver_, dict_)
273 parent_bctype(rhs, iF),
274 expressions::patchExprFieldBase(rhs),
276 driver_(this->
patch(), rhs.driver_, dict_)
296 <<
"Value: " << this->valueExpr_ <<
nl 297 <<
"Gradient: " << this->gradExpr_ <<
nl 298 <<
"Fraction: " << this->fracExpr_ <<
nl 300 driver_.writeVariableStrings(
Info) <<
nl;
307 bool evalValue = (!this->valueExpr_.empty() && this->valueExpr_ !=
"0");
308 bool evalGrad = (!this->gradExpr_.empty() && this->gradExpr_ !=
"0");
309 bool evalFrac = (!this->fracExpr_.empty());
314 if (this->valueExpr_.empty())
321 else if (this->gradExpr_.empty())
328 else if (this->fracExpr_.empty())
336 else if (this->fracExpr_ ==
"0")
343 else if (this->fracExpr_ ==
"1")
352 driver_.clearVariables();
356 this->refValue() = driver_.evaluate<Type>(this->valueExpr_);
360 this->refValue() =
Zero;
365 this->refGrad() = driver_.evaluate<Type>(this->gradExpr_);
369 this->refGrad() =
Zero;
374 this->valueFraction() = driver_.evaluate<scalar>(this->fracExpr_);
378 this->valueFraction() = fraction;
382 this->parent_bctype::updateCoeffs();
392 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 readDict(const dictionary &dict)
Read dictionary entries.
virtual void write(Ostream &os) const
Write.
virtual Field< Type > & refValue()
#define DeprecatedInFunction(afterVersion)
Report a warning using Foam::Warning.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
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.
OBJstream os(runTime.globalPath()/outputName)
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
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)