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."
164 driver_.readDict(dict_);
169 bool needsRefValue =
true;
172 needsRefValue =
false;
173 this->refValue() = Field<Type>(
"refValue",
dict,
p.size());
180 Field<Type>(
"value",
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;
207 if (dict.
found(
"refGradient"))
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()
259 const exprMixedFvPatchField<Type>& rhs
263 expressions::patchExprFieldBase(rhs),
265 driver_(this->
patch(), rhs.driver_, dict_)
279 parent_bctype(rhs, iF),
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();
398 driver_.writeCommon(
os, this->debug_ ||
debug);