CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

loop over cells in parallel processing

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 15, 2015, 06:18
Default loop over cells in parallel processing
  #1
Member
 
Mat
Join Date: Jan 2012
Posts: 39
Rep Power: 5
Mat_fr is on a distinguished road
Dear Foamers,


For my computations, I'm using a VolScalarField representing a mask, which is either 0 or 1. This mask was obtained previously with triSurface functions, and gives a representation of a volume geometry. This was done perfectly in parallel.


Now, I want to define a new mask, named mask2, which defines the layer of cells surrounding the previous volume. Practically, for all the cells where mask = 0, and which have at least one neighbor where mask=1, then mask2=1.
I've implemented it like that :

Code:
const unallocLabelList & nei = mesh.neighbour();
    const unallocLabelList & own = mesh.owner();

    forAll(mesh.C(), cellI)
    {
        Mask2[cellI]=0;
        if (Mask[cellI]==0){
            const cell& faces = mesh.cells()[cellI];
            forAll(faces, faceI){
                if (mesh.isInternalFace(faces[faceI]))
                {
                    label owner = own[faces[faceI]];
                    label neigh = nei[faces[faceI]];
                    if (owner==cellI){
                        if (Mask[neigh]==1) Mask2[cellI]=1;
                    }
                    else{
                        if (Mask[owner]==1) Mask2[cellI]=1;
                    }
                }
            }
        }
    }

Unfortunately, its not working in parallel, when the separation between two processors matches the volume interface. Some cells which must be in the surrounding layer are missing. I suppose it is because the owner proc is not finding the true value of the mask for the neighbors which are in another proc.

How can I handle that ? Do I have to write the parallel communication by myself ?

Thanks for your help.
Mat
Mat_fr is offline   Reply With Quote

Old   February 11, 2015, 12:16
Default
  #2
Member
 
Mat
Join Date: Jan 2012
Posts: 39
Rep Power: 5
Mat_fr is on a distinguished road
Hi Foamers,

My error was that the condition "if (mesh.isInternalFace(faces[faceI]))" excludes all the faces between two processors in parallel. They are not internal faces in this case.

By the way, I think it is not possible to define such a scalar field by looping over the cells in parallel, without implementing ourself the communications between processors.

Another way to do so, its by using the gradient of the masks. However, I've realized that I do not obtain the same results for fvc:grad() in sequential and in parallel !! Why ?

Best,
Mat
Mat_fr is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 51 June 28, 2015 16:36
Parallel processing of OpenFOAM cases on multicore processor??? g.akbari OpenFOAM Running, Solving & CFD 24 May 31, 2015 17:58
simpleFoam parallel AndrewMortimer OpenFOAM Running, Solving & CFD 10 November 12, 2013 18:03
external flow with snappyHexMesh chelvistero OpenFOAM 11 January 15, 2010 20:43
couple cells from different meshes in parallel sylvester OpenFOAM Programming & Development 8 September 29, 2009 04:04


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