CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Read parallel meshes (http://www.cfd-online.com/Forums/openfoam-programming-development/130762-read-parallel-meshes.html)

dl6tud March 4, 2014 05:44

Read parallel meshes
 
I would like to read the meshes of all processors when computing in parallel. The idea is to have all meshes on each processor.

I create a "Time-Object" for each processor as

Quote:

PtrList<Time> time(Pstream::nProcs());

forAll(time, procI)
{
time.set
(
procI,
new Time
(
Time::controlDictName,
args.rootPath(),
args.globalCaseName()/fileName(word("processor") + name(procI))
)
);
}
Then, I create the meshes with
Quote:

PtrList<fvMesh> pMesh(Pstream::nProcs());
forAll(pMesh, procI)
{
pMesh.set
(
procI,
new fvMesh
(
IOobject
(
Foam::fvMesh::defaultRegion,
time[procI].timeName(),
time[procI],
IOobject::MUST_READ
)
)
);
}
The second step fails with

Quote:

Message from processor 0 not fully consumed. messageSize:20620 bytes of which only 0 consumed.
At the moment I have no idea, why OF tries to communicate with the other processors when reading the meshes. Maybe for the boundaries?

ngj March 5, 2014 14:04

Hi,

Yes, the processor boundaries exchange information, so what you are trying to do will most probably not work.

May I ask, why you need all the meshes on every processor?

Kind regards,

Niels

A_Pete March 7, 2014 04:45

Hi,

what about using gather and scatter? Not sure what you exactly want to do with the mesh, but you could use gatherList.

Code:

//- Get local mesh on processor
fvMesh mesh(refCast<const fvMesh>(obr_));

//- Gather the meshes into PtrList on master processor
PtrList<fvMesh> pMesh(Pstream::nProcs());
pMesh[Pstream::myProcNo()] = mesh;
Pstream::gatherList(pMesh);

Depending on what you want to do afterwards, you could either use scatterList or put the mesh together again from the pMesh and then scatter just this fvMesh.


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