36 if (expressions::patchExprFieldBase::debug_ && !debug)
53 expressions::patchExprFieldBase(),
55 driver_(this->patch())
73 expressions::patchExprFieldBase(rhs),
75 driver_(this->patch(), rhs.driver_, dict_)
91 expressions::patchExprFieldBase
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 "
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 "
158 <<
"Value only, but did not specify valueExpr."
164 driver_.readDict(dict_);
169 bool needsRefValue =
true;
172 needsRefValue =
false;
173 this->refValue() = Field<Type>(
"refValue",
dict,
p.
size());
186 this->refValue() =
static_cast<const Field<Type>&
>(*this);
193 this->refValue() = this->patchInternalField();
200 <<
"No value defined for "
201 << this->internalField().name() <<
" on "
202 << this->
patch().name() <<
" - using patch internal field" <<
endl;
209 this->refGrad() = Field<Type>(
"refGradient",
dict,
p.
size());
213 this->refGrad() =
Zero;
218 this->valueFraction() = Field<scalar>(
"valueFraction",
dict,
p.
size());
222 this->valueFraction() = scalar(1);
226 if (this->evalOnConstruct_)
235 if (!this->updated())
237 this->parent_bctype::updateCoeffs();
242 this->valueFraction()*this->refValue()
244 (1.0 - this->valueFraction())*
246 this->patchInternalField()
247 + this->refGrad()/this->
patch().deltaCoeffs()
263 expressions::patchExprFieldBase(rhs),
265 driver_(this->patch(), rhs.driver_, dict_)
280 expressions::patchExprFieldBase(rhs),
282 driver_(this->patch(), rhs.driver_, dict_)
302 <<
"Value: " << this->valueExpr_ <<
nl
303 <<
"Gradient: " << this->gradExpr_ <<
nl
304 <<
"Fraction: " << this->fracExpr_ <<
nl
306 driver_.writeVariableStrings(
Info) <<
nl;
313 bool evalValue = (!this->valueExpr_.empty() && this->valueExpr_ !=
"0");
314 bool evalGrad = (!this->gradExpr_.empty() && this->gradExpr_ !=
"0");
315 bool evalFrac = (!this->fracExpr_.empty());
320 if (this->valueExpr_.empty())
327 else if (this->gradExpr_.empty())
334 else if (this->fracExpr_.empty())
342 else if (this->fracExpr_ ==
"0")
349 else if (this->fracExpr_ ==
"1")
358 driver_.clearVariables();
362 this->refValue() = driver_.evaluate<Type>(this->valueExpr_);
366 this->refValue() =
Zero;
371 this->refGrad() = driver_.evaluate<Type>(this->gradExpr_);
375 this->refGrad() =
Zero;
380 this->valueFraction() = driver_.evaluate<scalar>(this->fracExpr_);
384 this->valueFraction() = fraction;
388 this->parent_bctype::updateCoeffs();
395 this->parent_bctype::write(
os);
398 driver_.writeCommon(
os, this->debug_ || debug);
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
friend Ostream & operator(Ostream &, const Field< Type > &)
void evaluate()
Evaluate boundary conditions.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void size(const label n)
Older name for setAddressableSize.
A wrapper for dictionary content, without operators that could affect inheritance patterns.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
A mixed boundary condition with expressions.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
void setDebug()
Set debug ON if "debug" is enabled.
expectedTypes
Enumeration of expected expressions.
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
virtual void operator=(const UList< Type > &)
friend Ostream & operator(Ostream &, const fvPatchField< Type > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
This boundary condition provides a base class for 'mixed' type boundary conditions,...
virtual Field< Type > & refGrad()
virtual Field< Type > & refValue()
virtual scalarField & valueFraction()
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
#define WarningInFunction
Report a warning using Foam::Warning.
#define DebugInFunction
Report an information message using Foam::Info.
#define InfoInFunction
Report an information message using Foam::Info.
const std::string patch
OpenFOAM patch number as a std::string.
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.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)