newGuyAtCFD |
September 27, 2022 13:14 |
operator= in inletOutlet boundary condition
Hello to all,
I am studying the inletOutlet boundary condition.
In the update coeffs there is:
Code:
template<class Type>
void Foam::inletOutletFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const Field<scalar>& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
phiName_
);
this->valueFraction() = 1.0 - pos0(phip);
mixedFvPatchField<Type>::updateCoeffs();
}
The assignment of the value fraction is given by the pos0 function which will return 1 if phi>=0 else it will be 0.
The mixed boundary condition is given by:
This means that, when I have positive flux I will get fixedGradient and when I get negative flux I will get fixed value.
However, there is the existance of a operator= in the function which will be called e.g, in the PEqn.H when the velocity is reconstructed.
And it is defined as:
Code:
template<class Type>
void Foam::inletOutletFvPatchField<Type>::operator=
(
const fvPatchField<Type>& ptf
)
{
fvPatchField<Type>::operator=
(
this->valueFraction()*this->refValue()
+ (1 - this->valueFraction())*ptf
);
}
Why is this needed?
|