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/)
-   -   Flux not conserved in cyclicAMI interfaces if areas are different (https://www.cfd-online.com/Forums/openfoam-programming-development/214079-flux-not-conserved-cyclicami-interfaces-if-areas-different.html)

jherb January 18, 2019 09:07

Flux not conserved in cyclicAMI interfaces if areas are different
 
Hello,


currently, a cyclicAMI interface between two patches does not conserve the (mass/volumentric) flux, if the patches have different areas. The velocities are transferred from one side/patch of the interface to the other.


In constant/polyMesh/boundary, the definition of such an interface looks like

Code:

    one_side_of_interface
    {
        type            cyclicAMI;
        inGroups        1(cyclicAMI);
        matchTolerance  0.0001;
        transform      noOrdering;
        neighbourPatch  other_side_of_interface;
        nFaces          4949;
        startFace      12612869;
    }
    other_side_of_interface
    {
        type            cyclicAMI;
        inGroups        1(cyclicAMI);
        matchTolerance  0.0001;
        transform      noOrdering;
        neighbourPatch  one_side_of_interface;
        nFaces          4949;
        startFace      12612869;
    }


and in the velocity boundary conditions, e.g. 0/U
Code:

    one_side_of_interface
    {
        type            cyclicAMI;
        value          uniform (0 0 0);
    }
    other_side_of_interface
    {
        type            cyclicAMI;
        value          uniform (0 0 0);
    }


So let's say, one side of the interface uses tetrahedrons and the other hexahedrons and the areas of the two sides differ by 5 %, the velocity will be the same on both sides, but the mass flux (or for incompressible solvers the volumetric flux) will also differ by 5 %.


Now I would like to understand, how cyclicAMI is working in this case at the moment:


Is it correct, that the values of the two sides of the interfaces are exchanged in methods
Code:

void Foam::cyclicAMIFvPatchField<Type>::updateInterfaceMatrix
in cyclicAMIFvPatchField.C?
https://github.com/OpenFOAM/OpenFOAM...FvPatchField.C


Is this the actual code, where the values are transferred from one side to the other?
Code:

    forAll(faceCells, elemI)
    {
        result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
    }


So in coeffs, the weights between faces of the patch of one side and the faces on the patch of the other side are stored?


If you would like to create a new boundary condition to conserve the fluxes, in a first step, I would modify these weights with the ration of the areas of the two patches?



Where are the weights calculated?
In void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w)?
https://github.com/OpenFOAM/OpenFOAM...IFvPatch.C#L79


So there different weights for the two patches? If this would be the correct place to add a area ratio, there would also one area ratio for one patch and the inverse for the other side?


Thank you for any help?
Joachim

jherb January 23, 2019 10:22

Answering myself: My temporary fix was to rescale the faces at the interface to match the area on both sides. This post is really helpful for reading OpenFOAM mesh files into Python: https://codereview.stackexchange.com/a/101298


All times are GMT -4. The time now is 15:32.