CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   operator= in inletOutlet boundary condition (https://www.cfd-online.com/Forums/openfoam-programming-development/245313-operator-inletoutlet-boundary-condition.html)

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:
\phi_f = w\phi_{ref} + (1-w)(\phi_C + \Delta\nabla \phi_{ref})

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?


All times are GMT -4. The time now is 19:23.