|
[Sponsors] |
January 15, 2015, 05:18 |
loop over cells in parallel processing
|
#1 |
Member
Mat
Join Date: Jan 2012
Posts: 60
Rep Power: 14 |
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 |
|
February 11, 2015, 11:16 |
|
#2 |
Member
Mat
Join Date: Jan 2012
Posts: 60
Rep Power: 14 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Foam::error::PrintStack | almir | OpenFOAM Running, Solving & CFD | 91 | December 21, 2022 04:50 |
Parallel processing of OpenFOAM cases on multicore processor??? | g.akbari | OpenFOAM Running, Solving & CFD | 31 | November 1, 2017 09:25 |
simpleFoam parallel | AndrewMortimer | OpenFOAM Running, Solving & CFD | 12 | August 7, 2015 18:45 |
[snappyHexMesh] external flow with snappyHexMesh | chelvistero | OpenFOAM Meshing & Mesh Conversion | 11 | January 15, 2010 19:43 |
couple cells from different meshes in parallel | sylvester | OpenFOAM Programming & Development | 8 | September 29, 2009 04:04 |