CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   symmetryPlane coefficients in OpenFOAM/FOAM (https://www.cfd-online.com/Forums/openfoam/234174-symmetryplane-coefficients-openfoam-foam.html)

bigphil February 25, 2021 06:22

symmetryPlane coefficients in OpenFOAM/FOAM
 
Hello FOAMers!

I have been looking at the symmetry plane implementation in OpenFOAM/FOAM and am struggling to understand how the gradientInternalCoeffs were derived i.e. the matrix coefficients related to the diffusion term. In particular for vectors.

In all main forks of OpenFOAM, the symmetryPlane internal coefficients (gradientInternalCoeffs) are calculated as (in transformFvPatchField.C):
Code:

template<class Type>
tmp<Field<Type> > transformFvPatchField<Type>::gradientInternalCoeffs() const
{
    return -this->patch().deltaCoeffs()*this->snGradTransformDiag();
}

where snGradTransformDiag (in basicSymmetryPlaneFvField.C) is:
Code:

tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGradTransformDiag() const
{
    vectorField nHat = this->patch().nf();
    vectorField diag(nHat.size());

    diag.replace(vector::X, mag(nHat.component(vector::X)));
    diag.replace(vector::Y, mag(nHat.component(vector::Y)));
    diag.replace(vector::Z, mag(nHat.component(vector::Z)));

    return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
}

Side note: the Foundation version of OpenFOAM introduce symmetry and symmetryPlane to allow for "perfectly flat" symmetry planes but the coefficients will still be the same assuming all faces on the patch have the same normal.

From this I can see that the internal coefficients for a vector field will be (when I also include gammaMagS assuming a scalar gamma):
D_{i}^{\text{FOAM}} = \frac{\gamma |\boldsymbol{S}| |\boldsymbol{n}_i|}{\boldsymbol{n} \cdot \boldsymbol{d}}  \quad\quad \text{for}\quad i=1,2,3
Which can equivalently be written as (allows easier comparison with what comes below):
D_{i}^{\text{FOAM}} = \frac{\gamma |\boldsymbol{S}| |\boldsymbol{S}_i|}{\boldsymbol{S} \cdot \boldsymbol{d}}  \quad\quad \text{for}\quad i=1,2,3

It is not clear where the mag(n_i) comes from here. Moukalled, Mangani and Darwish (http://dx.doi.org/10.1080/10407790.2016.1138748) say it should be:
D_{i}^{\text{Mouk}} = \frac{\gamma |\boldsymbol{S}_i| |\boldsymbol{S}_i|}{\boldsymbol{S} \cdot \boldsymbol{d}}  \quad\quad \text{for}\quad i=1,2,3

Notice that Foam replaced one of the mag(S_i) with mag(S) which boosts the coefficient. This does not make a difference when the symmetry plane is aligned with a Cartesian plane but they will give different convergence otherwise.

Of course if outer corrections are performed, the value of this coefficient does not directly affect the answer but just the convergence. From some quick checks, the Foam version seems to give faster convergence for vector problems but it is not clear where it came from.

Maybe somebody can comment or share related references.

Thanks!
Philip


All times are GMT -4. The time now is 05:13.