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/)
-   -   Patch normals patch().nf() in basicSymmetryFvPatchField (https://www.cfd-online.com/Forums/openfoam-programming-development/229876-patch-normals-patch-nf-basicsymmetryfvpatchfield.html)

salehi144 August 28, 2020 09:04

Patch normals patch().nf() in basicSymmetryFvPatchField
 
Dear Foamers!

I am using surfaceSlipDisplacementFvPatchFields BC. It appears that it inherits from the slip BC and the slip BC inherits from the basicSymmetry. So it all comes down to the evaluate function in the basicSymmetry. This evaluate function simply eliminate the normal component to the patch by:

Code:

    tmp<vectorField> nHat = this->patch().nf();

    const Field<Type> iF(this->patchInternalField());

    Field<Type>::operator=
    (
        (iF + transform(I - 2.0*sqr(nHat), iF))/2.0
    );

    transformFvPatchField<Type>::evaluate();


It can be seen that the normal vector to the patch, patch().nf(), is first read (the red line) and then the normal component of the quantity of interest is removed.

Now, I have a case where the mesh is changing through time and OpenFOAM naturally updates the patch().nf() in each time-step. However, I specifically need to fix patch().nf(). In other words, I need to always read the patch normals, of the initial mesh (i.e., the mesh in the constant folder and not the mesh in the time folders).

Any ideas or help would be much appreciated.

Saeed

jherb August 28, 2020 18:36

You could add a vectorField to a modified boundary class and initialize it within the constructor. But for this to be restart-enabled, you have to store this field in the write method of the boundary condition and read it if available in the constructor (the one with dict in the parameter list).

salehi144 August 31, 2020 09:24

Thank Joachim for the answer.

That seems a good idea. I will give it a try and let you know.

Saeed


All times are GMT -4. The time now is 08:26.