Go to the documentation of this file.
36 if (expressions::patchExprFieldBase::debug_ && !
debug)
55 driver_(this->
patch())
57 this->refValue() =
Zero;
58 this->refGrad() =
Zero;
59 this->valueFraction() = scalar(1);
94 expressions::patchExprFieldBase::expectedTypes::MIXED_TYPE
99 dictionaryContent::copyDict
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."
164 driver_.readDict(dict_);
167 dict.readIfPresent(
"patchType", this->patchType());
169 bool needsRefValue =
true;
170 if (
dict.found(
"refValue"))
172 needsRefValue =
false;
173 this->refValue() = Field<Type>(
"refValue",
dict,
p.size());
176 if (
dict.found(
"value"))
178 fvPatchField<Type>::operator=
180 Field<Type>(
"value",
dict,
p.size())
186 this->refValue() =
static_cast<const Field<Type>&
>(*this);
193 this->refValue() = this->patchInternalField();
196 fvPatchField<Type>::operator=(this->refValue());
200 <<
"No value defined for "
201 << this->internalField().name() <<
" on "
202 << this->
patch().name() <<
" - using patch internal field" <<
endl;
207 if (dict.
found(
"refGradient"))
209 this->refGrad() = Field<Type>(
"refGradient",
dict,
p.size());
213 this->refGrad() =
Zero;
216 if (
dict.found(
"valueFraction"))
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();
240 Field<Type>::operator=
242 this->valueFraction()*this->refValue()
244 (1.0 - this->valueFraction())*
246 this->patchInternalField()
247 + this->refGrad()/this->
patch().deltaCoeffs()
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();
398 driver_.writeCommon(
os, this->debug_ ||
debug);
int debug
Static debugging option.
#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.
List< word > wordList
A List of words.
expressions::patchExpr::parseDriver driver_
The expression driver.
Base class for managing patches with expressions. The expected input supports value,...
messageStream Info
Information stream (stdout output on master, null elsewhere)
#define DebugInFunction
Report an information message using Foam::Info.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
dictionary dict_
Dictionary contents for the boundary condition.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
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.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
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.