Go to the documentation of this file.
35 if (expressions::patchExprFieldBase::debug_ && !
debug)
53 driver_(this->
patch())
55 this->refValue() =
Zero;
56 this->refGrad() =
Zero;
57 this->valueFraction() = scalar(1);
91 expressions::patchExprFieldBase::expectedTypes::MIXED_TYPE
93 driver_(this->
patch(), dict)
99 if (this->valueExpr_.empty() && this->gradExpr_.empty())
102 <<
"For " << this->internalField().name() <<
" on "
103 << this->
patch().name() << nl
104 <<
"Require either or both: valueExpr and gradientExpr" <<
nl
108 if (this->fracExpr_.empty())
111 if (!this->valueExpr_.empty() && !this->gradExpr_.empty())
114 <<
"For " << this->internalField().name() <<
" on "
115 << this->
patch().name() << nl
116 <<
"Recommend using fractionExpr when specifying both"
117 <<
" valueExpr and gradientExpr. Assuming a value of 1."
121 else if (this->fracExpr_ ==
"0")
124 if (this->gradExpr_.empty())
127 <<
"For " << this->internalField().name() <<
" on "
128 << this->
patch().name() << nl
129 <<
"Gradient only, but did not specify gradientExpr."
133 else if (this->fracExpr_ ==
"1")
136 if (this->valueExpr_.empty())
139 <<
"For " << this->internalField().name() <<
" on "
140 << this->
patch().name() << nl
141 <<
"Value only, but did not specify valueExpr."
147 driver_.readDict(
dict);
150 dict.readIfPresent(
"patchType", this->patchType());
152 bool needsRefValue =
true;
153 if (
dict.found(
"refValue"))
155 needsRefValue =
false;
159 if (
dict.found(
"value"))
169 this->refValue() =
static_cast<const Field<Type>&
>(*this);
176 this->refValue() = this->patchInternalField();
183 <<
"No value defined for "
184 << this->internalField().name() <<
" on "
185 << this->
patch().name() <<
" - using patch internal field" <<
endl;
190 if (dict.
found(
"refGradient"))
196 this->refGrad() =
Zero;
199 if (
dict.found(
"valueFraction"))
205 this->valueFraction() = scalar(1);
209 if (this->evalOnConstruct_)
218 if (!this->updated())
225 this->valueFraction()*this->refValue()
227 (1.0 - this->valueFraction())*
229 this->patchInternalField()
230 + this->refGrad()/this->
patch().deltaCoeffs()
283 <<
"Value: " << this->valueExpr_ <<
nl
284 <<
"Gradient: " << this->gradExpr_ <<
nl
285 <<
"Fraction: " << this->fracExpr_ <<
nl
287 driver_.writeVariableStrings(
Info) <<
nl;
294 bool evalValue = (!this->valueExpr_.empty() && this->valueExpr_ !=
"0");
295 bool evalGrad = (!this->gradExpr_.empty() && this->gradExpr_ !=
"0");
296 bool evalFrac = (!this->fracExpr_.empty());
301 if (this->valueExpr_.empty())
308 else if (this->gradExpr_.empty())
315 else if (this->fracExpr_.empty())
323 else if (this->fracExpr_ ==
"0")
330 else if (this->fracExpr_ ==
"1")
339 driver_.clearVariables();
343 this->refValue() = driver_.evaluate<Type>(this->valueExpr_);
347 this->refValue() =
Zero;
352 this->refGrad() = driver_.evaluate<Type>(this->gradExpr_);
356 this->refGrad() =
Zero;
361 this->valueFraction() = driver_.evaluate<scalar>(this->fracExpr_);
365 this->valueFraction() = fraction;
379 driver_.writeCommon(os, this->debug_ ||
debug);
int debug
Static debugging option.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
#define InfoInFunction
Report an information message using Foam::Info.
virtual void write(Ostream &os) const
Write.
static constexpr const zero Zero
Global zero (0)
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
exprMixedFvPatchField(const fvPatch &p, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
expressions::patchExpr::parseDriver driver_
The expression driver.
Base class for managing patches with expressions. The expected input supports value,...
Generic templated field type.
messageStream Info
Information stream (uses stdout - output is on the master only)
#define DebugInFunction
Report an information message using Foam::Info.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
This boundary condition provides a base class for 'mixed' type boundary conditions,...
errorManipArg< error, int > exit(error &err, const int errNo=1)
const std::string patch
OpenFOAM patch number as a std::string.
void setDebug()
Set debug ON if "debug" is enabled.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
A mixed boundary condition with expressions.
#define WarningInFunction
Report a warning using Foam::Warning.
string evaluate(const std::string &s, size_t pos=0, size_t len=std::string::npos)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...