49 const DimensionedField<Type, volMesh>& iF
53 expressions::patchExprFieldBase(),
55 driver_(this->patch())
72 parent_bctype(
rhs,
p, iF, mapper),
75 driver_(this->patch(),
rhs.driver_, dict_)
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 "
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 "
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 "
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),
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();
389 this->parent_bctype::write(
os);
392 driver_.writeCommon(
os, this->debug_ || debug);
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
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,...
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
A mixed boundary condition with expressions.
dictionary dict_
Dictionary contents for the boundary condition.
expressions::patchExpr::parseDriver driver_
The expression driver.
virtual void write(Ostream &os) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
void setDebug()
Set debug ON if "debug" is enabled.
exprMixedFvPatchField(const fvPatch &p, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
expressions::exprString fracExpr_
expressions::exprString gradExpr_
void write(Ostream &os) const
Write.
expectedTypes
Enumeration of expected expressions.
patchExprFieldBase()
Default construct.
expressions::exprString valueExpr_
bool debug_
Add debugging.
virtual void readDict(const dictionary &dict)
Read dictionary entries.
const fvPatch & patch() const noexcept
Return the patch.
bool updated() const noexcept
True if the boundary condition has already been updated.
A FieldMapper for finite-volume patch fields.
virtual void operator=(const UList< Type > &)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual void write(Ostream &) const
Write.
virtual Field< Type > & refGrad()
virtual Field< Type > & refValue()
virtual scalarField & valueFraction()
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field.
#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 DeprecatedInFunction(afterVersion)
Report a warning using Foam::Warning.
#define DebugInFunction
Report an information message using Foam::Info.
#define InfoInFunction
Report an information message using Foam::Info.
Namespace for handling debugging switches.
A namespace for expression-related classes/traits etc.
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.
List< word > wordList
List of word.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
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).