CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Map fields from patch to cell centers (https://www.cfd-online.com/Forums/openfoam-solving/197808-map-fields-patch-cell-centers.html)

martinK. January 17, 2018 09:25

Map fields from patch to cell centers
 
Dear Foamers,

I'm facing a problem right now while working with the Finite-Area-method in foam-extend.

First of all quickly my case:
I have a simple finite-volume polyMesh. The bottom-patch is working as faMesh for the finite-area calculations as well.
I modified the polyMesh such that on the outside boundaries (inlet, outlet, right, left) all cells get "connected" in vertical dimension and one ends up with a pillar-like mesh at these boundaries.

The function mapToVolume() of a volSurfaceMapping-object gives me the possibility to map the fields from the finite-area faMesh to the according patch (bottom) of the finite-volume polyMesh.
What I want to do now is map the fields further to the above lying cell centers. For me it is sufficient to do this only on the boundary faces of the bottom-patch (so to say from the frame of the bottom-patch to the pillar-cell centers).
I hope you can get my point ;)

What I have right now and what's not really working is the following:
Code:

forAll( aMesh.boundary(), ipatch )  //loop over boundary-patches of the faMesh
{
    const UList<label> &bfaceCells = mesh.boundaryMesh()[ipatch].faceCells();
    //corresponding cell-IDs of the polyMesh (pillars)


    forAll( bfaceCells, iface )  //loop over cells of the current patch
    {
        label curCell = bfaceCells[iface];
        forAll( aMesh.faceLabels(), jface ) //loop over faces of the faMesh
        {
            if( iface == jface )
            {
                HFv[curCell] = H[jface]; //HFv: volumeScalarfield
                                        // H: corresponding areaScalarField
            }
        }
    }

}

This gets called in every timestep from my solver. It is compiling but the results are wrong.
Does anybody have a hint or an idea on how to do this right and/or more efficient?

As I'm new to OpenFoam and not very used to the syntax and possibilities yet I would really appreciate any remark, even if you just want to say that all these loops are completly rubbish ;)

Thank you all!

Best regards,
Martin


All times are GMT -4. The time now is 03:09.