|
[Sponsors] |
Access patch points (on different processor) in parallel |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 5, 2011, 13:57 |
Access patch points (on different processor) in parallel
|
#1 |
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 18 |
Hi all,
I have made an implementation to modify the z values of my mesh points within my solver according to some distance function during runtime. This all works well in serial mode. Now I have to make the functionality working in parallel: I'm looping over all mesh points, and inside, I'm looping over the mesh points on a bottom boundary patch, like Code:
forAll (mesh.points(), pointi) { forAll(mesh.boundaryMesh()[patchi].localPoints(), dhPointi) { -> calculating some dependencies between pointi and dhPointi } } Within the calculation, the point to patch points dependencies are stored in a vector (std::vector<std::vector<std:air<label, double> > >) at the beginning of the simulation. During the simulation, all processors then have to have access to this vector (or at least to their 'part' containing their processor points). Unfortunately I'm not familiar with parallel processes, so I need your help in this case! Arne |
|
December 6, 2011, 04:46 |
|
#2 |
Senior Member
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21 |
Did you run it in parallel? I thought OF handles these things automatically.
__________________
~roman |
|
December 6, 2011, 08:35 |
|
#3 |
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 18 |
Yes, I ran it in parallel (using two cores). In my forAll loop, I'm actually not looping over all mesh points, but just a certain area/volume. If all points within that volume are on the mesh of one processor, it's all fine, even in parallel mode. Enlarging the search volume so that some mesh points are on the second processor, I get a Segmentation fault.
I could not fully get the actual position of the solver stopping to work, so it was my guess that it must come from the loop over the boundaryMesh points. I could image two ways solving this: 1. pass the points on the second processor to the first one holding the boundary patch, and do all calculations there 2. pass the points on the boundaryMesh from first processor to the second one as well, so that calculations could be done independently. Any hints? Arne |
|
December 6, 2011, 10:28 |
|
#4 |
Senior Member
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 21 |
Dear Arne,
It is not very clear for me what you are exactly trying to do. But I will try to give you some hints on dealing with multi-processor problems. First of all here are a few things you have to know (if somebody thinks I'm wrong, please feel free to correct me!):
Kind regards, Francois. |
|
December 6, 2011, 11:08 |
|
#5 |
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 18 |
Hi Francois,
Wow. Thanks a lot for taking the time to write such a detailed answer! This really helped me! I have already started reading a few things about PStream and reduce operations, but haven't yet got really familiar with it. Just for explanation what I am trying to achieve: For every mesh point (in search volume) I'm storing the dependency/label of the nearest points on the bottom boundary patch in xy plane incl. inverse dist. functions. This information is later used to move the inner mesh points (in z direction) depending on a distance function, which based on a bottom boundary patch (z) movement. Therefore, for every mesh point (and therefore every processor), the bottom patch point information are needed at the start of the simulation, to store the dependencies (point labels and inv. dist. weights). This vector is later, during the whole simulation, needed to calculate the new point positions in z direction. But I have to rethink if this can work at all in parallel without too much effort. Another problem of going the "difficult" way could be that I have duplicate points, as some are of course lying on the processor patches. Anyway, I also thought about decomposing the mesh in a way that all points and the boundary are used at the master processor only. Doing a rough estimate, this might still be well balanced up to a 16-cores node, which is OK. So I guess I will go this way first. Nevertheless, here comes another question, maybe you have an idea: For decomposition, I have to use manual decomp., as otherwise above mentioned restriction can not be fulfilled (or is at least not efficient, e.g. when using simple decomp.). Do you know how to make a manual decomposition file, e.g. using setFields? I was also thinking of modifying the scotch decomposition method to ensure what I need... Thanks again, Arne |
|
December 6, 2011, 13:54 |
|
#6 |
Senior Member
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 21 |
Good evening Arne,
No problem for the help. I remember when I was trying to figure out why some code was not working in parallel, and I lost a lot of time with it, so I'm just hoping I might be able to help some people avoid the same problem! Anyways. For what you are trying to do, it is maybe not easier to work one mesh-level higher than with points? I mean with cells and faces? Because then, not only can you easily find to which cell a boundary face belongs to (you can use the faceOwner() function, with the local patch face ID added to the patch.start()), but I think that from there, knowing the cells on the boundary, you should also quite easily be able to find the points forming the cell (from the primitiveMesh object I think?). Just an idea. Indeed, it might be more difficult to deal with the cells on the processor boundaries, because you will have to synchronize the values of the points on both side of the processor patch. Unfortunately I don't have any experience with dynamic meshes.. :-( I also haven't use the manual decomposition option before, so no luck there either.. But could the simple decomposition option in the decomposeParDict file maybe do the trick for you? You can specify the number of processors you want to use in (x, y, z) direction. Kind regards, Francois. |
|
December 6, 2011, 14:03 |
|
#7 |
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 18 |
Hi Francois,
I thought of dealing with cells instead of faces, but for the mesh motion I'm performing, computing point locations is more robust. Using cells, there has to be some averaging when interpolating new positions to the points, which might cause some trouble. Simple decomposition already works when using only few processors. But for some cases, I can then only decompose in z direction, which leads to a lot of processor communication/shared faces. So this not not really efficient. I'm having a look at how meshes are decomposed right now, and will hopefully fix this tomorrow. Greetings, Arne |
|
September 11, 2012, 06:55 |
Similar problem
|
#8 | ||
New Member
Fabien Farella
Join Date: Jan 2012
Posts: 7
Rep Power: 14 |
Hi,
I want to perform a simple post-processing task (in parallel, using meshsearch). Basically: Quote:
Quote:
(By the way, it is a simplified version of my problem. I am not trying to find offset points outside my mesh, as this sample code would suggest) Do you have an idea why? I have been struggling for quiet a while!!! Thanks, Fabien |
|||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Commercial meshers] Fluent3DMeshToFoam | simvun | OpenFOAM Meshing & Mesh Conversion | 50 | January 19, 2020 16:33 |
How to probe all points on a patch? | strikeraj | OpenFOAM Running, Solving & CFD | 10 | April 24, 2012 14:45 |
mapFields : internal edges | Gearb0x | OpenFOAM Running, Solving & CFD | 3 | April 19, 2010 10:02 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 08:36 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 07:51 |