CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Bugs

Mapping Lagrangian particles

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 31, 2009, 11:59
Default Mapping Lagrangian particles
  #1
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Version: 1.5.x

Description: when mapping a case with lagrangian particles to a smaller mesh some of the particles keep the cell number (in the positions-file) from the old mesh which are a) wrong b) may be outside of the range of the new mesh which causes all kinds of trouble (during decomposePar, trackToFace etc)

Fix: the attached patch. For the particles in question it overwrites the celli_ with the index of the found cell (which was calculated anyway). In order to do this a write-access-method for celli_ had to be introduced

mapLagrangian.patch.txt
gschaider is offline   Reply With Quote

Old   April 1, 2009, 06:05
Default
  #2
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
Nice one. I put it in.
mattijs is offline   Reply With Quote

Old   March 26, 2017, 14:55
Default
  #3
New Member
 
Ebrahim
Join Date: Mar 2010
Posts: 28
Rep Power: 16
Ebrahim is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Version: 1.5.x

Description: when mapping a case with lagrangian particles to a smaller mesh some of the particles keep the cell number (in the positions-file) from the old mesh which are a) wrong b) may be outside of the range of the new mesh which causes all kinds of trouble (during decomposePar, trackToFace etc)

Fix: the attached patch. For the particles in question it overwrites the celli_ with the index of the found cell (which was calculated anyway). In order to do this a write-access-method for celli_ had to be introduced

Attachment 113
Dear Bernhard,

I have faced an issue for lagrangian interpolation in parallel simulation and I will be thankful if you can help me with that.
I use 2 meshes during simulation, a coarse mesh and a fine mesh and I need to transfer my particles between the meshes during the simulation. To do this, I used the same functions that are implemented in mapFields / mapFieldsPar. The major difference between the interpolation function of mapFields and the revised one in my solver is in the lagrangian interpolation part. In mapFields the particle clouds (here passiveParticleCloud) are constructed by reading the cloud directories (objects) in the case time directory, but in my solver the particle clouds (both source and target) are constructed in the solver main loop (as I need the particle data during the solution before they are written in the time directories).
Everything works fine for serial case. Even in the parallel case the Eulerian fields (e.g. velocity, pressure, etc) are interpolated correctly. But just for lagrangian interpolation of particles in parallel, I cannot get the right result. It seems that the host cell of the particle in the target mesh cannot be found in the function:


Code:
 autoPtr<passiveParticle> newPtr
                        (
                            new passiveParticle
                            (
                                meshTarget,
                                targetCc[targetCells[i]],
                                targetCells[i]
                            )
                        );
Actually, in the domain decomposition, the two meshes are not decomposed similarly, and processor K for example does not cover the same regions of the meshes. So, when the interpolation function in applied in processor K, it cannot find the target cell of particle i in the same processor because that cell is located in another processor. Would you please let me know how I can solve my issue?

(When I forced the decomposition to be similar in both meshes, the interpolation works fine, but I cannot do such a decomposition in general case of unstructured meshes I think.)

I'm wondering how mapFields can do parallel interpolations for Eulerian field values but not for lagrangian particles.

Thank you in advance
/Ebrahim
Ebrahim is offline   Reply With Quote

Old   March 28, 2017, 06:57
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Ebrahim View Post
Dear Bernhard,

I have faced an issue for lagrangian interpolation in parallel simulation and I will be thankful if you can help me with that.
I use 2 meshes during simulation, a coarse mesh and a fine mesh and I need to transfer my particles between the meshes during the simulation. To do this, I used the same functions that are implemented in mapFields / mapFieldsPar. The major difference between the interpolation function of mapFields and the revised one in my solver is in the lagrangian interpolation part. In mapFields the particle clouds (here passiveParticleCloud) are constructed by reading the cloud directories (objects) in the case time directory, but in my solver the particle clouds (both source and target) are constructed in the solver main loop (as I need the particle data during the solution before they are written in the time directories).
Everything works fine for serial case. Even in the parallel case the Eulerian fields (e.g. velocity, pressure, etc) are interpolated correctly. But just for lagrangian interpolation of particles in parallel, I cannot get the right result. It seems that the host cell of the particle in the target mesh cannot be found in the function:


Code:
 autoPtr<passiveParticle> newPtr
                        (
                            new passiveParticle
                            (
                                meshTarget,
                                targetCc[targetCells[i]],
                                targetCells[i]
                            )
                        );
Actually, in the domain decomposition, the two meshes are not decomposed similarly, and processor K for example does not cover the same regions of the meshes. So, when the interpolation function in applied in processor K, it cannot find the target cell of particle i in the same processor because that cell is located in another processor. Would you please let me know how I can solve my issue?

(When I forced the decomposition to be similar in both meshes, the interpolation works fine, but I cannot do such a decomposition in general case of unstructured meshes I think.)

I'm wondering how mapFields can do parallel interpolations for Eulerian field values but not for lagrangian particles.

Thank you in advance
/Ebrahim
You don't say which OF-version you're using. Which is essential information.

Anyway: I haven't worked on this for a long time (you'll notice that my posts in this threads are more than a couple of weeks ago) so I can't comment on this. Anyway: when looking at the sources for mapFieldsPar in v1612+ and 4.1 there are source files called "mapLagrangian" so something IS there (but I don't have time to go through the source to see WHAT. You'll have to do this yourself)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 28, 2017, 12:08
Default
  #5
New Member
 
Ebrahim
Join Date: Mar 2010
Posts: 28
Rep Power: 16
Ebrahim is on a distinguished road
Quote:
Originally Posted by gschaider View Post
You don't say which OF-version you're using. Which is essential information.

Anyway: I haven't worked on this for a long time (you'll notice that my posts in this threads are more than a couple of weeks ago) so I can't comment on this. Anyway: when looking at the sources for mapFieldsPar in v1612+ and 4.1 there are source files called "mapLagrangian" so something IS there (but I don't have time to go through the source to see WHAT. You'll have to do this yourself)
Thank you for you response. I'm using OpenFOAM 3.0.
Yes, A mapping function called "mapLagrangian" is defined there which can find the host cell of the particle in the target mesh, but the function that I mentioned in the previous post cannot be executed in the parallel case without using the time directories (cloudDirs[cloudI]).

Thanks,
Ebrahim
Ebrahim is offline   Reply With Quote

Old   March 28, 2017, 17:58
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Ebrahim View Post
Thank you for you response. I'm using OpenFOAM 3.0.
Yes, A mapping function called "mapLagrangian" is defined there which can find the host cell of the particle in the target mesh, but the function that I mentioned in the previous post cannot be executed in the parallel case without using the time directories (cloudDirs[cloudI]).

Thanks,
Ebrahim
I THINK (I don't have time to check this) that if you construct a particle it is assumed that you know that it "belongs" on the current processor. So you'll have to take the particle from the original mesh, take the position and find out which processor on the other mesh has that position. Then you construct the new particle there. Easiest would probably be to broadcast all original particles (or only their positions if that is sufficient) to all processors. Each processor goes through that list and constructs "his" particles
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 31, 2017, 11:56
Default
  #7
New Member
 
Ebrahim
Join Date: Mar 2010
Posts: 28
Rep Power: 16
Ebrahim is on a distinguished road
Quote:
Originally Posted by gschaider View Post
I THINK (I don't have time to check this) that if you construct a particle it is assumed that you know that it "belongs" on the current processor. So you'll have to take the particle from the original mesh, take the position and find out which processor on the other mesh has that position. Then you construct the new particle there. Easiest would probably be to broadcast all original particles (or only their positions if that is sufficient) to all processors. Each processor goes through that list and constructs "his" particles
Yes, I agree with you. I think it is not possible to inject a particle on a processor from another processor.
Finally I decided to use the approach that you mentioned and this works for a simple test case. I hope It wouldn't be an expensive approach for complex cases with a lot of particles and fine grids.
The only point that I want to say here is that I guess its more efficient to make separate list for different particle properties (i.e. a list for diameters, another one for positions, etc) and distribute them among all processors rather than distributing a list of particles themselves.

Thank you again,
Ebrahim
Ebrahim is offline   Reply With Quote

Old   December 20, 2023, 09:45
Default
  #8
Member
 
Uttam
Join Date: May 2020
Location: Southampton, United Kingdom
Posts: 35
Rep Power: 6
openfoam_aero is on a distinguished road
Hi Ebrahim

OpenFOAM version v1812

I am trying to use mapFields to interpolate Eulerian fields between two meshes (specifically from a larger mesh to a smaller one) using the functions defined in mapFields. I notice that there are two such mapFields source files - a pre-processing one (that can be called from the command line) and a functionObject. I am using the source code of the functionObject. I have instantiated the class nd I get a message that the cell addressing is done but I am not able to interpolate the field of my choice. Could you please share a rough workflow on the functions that you used to do the interpolation of the Eulerian fields as it would be very helpful to me!
__________________
Best Regards
Uttam

-----------------------------------------------------------------

“When everything seem to be going against you, remember that the airplane takes off against the wind, not with it.” – Henry Ford.
openfoam_aero is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lagrangian particles and ParaFoam lucchini OpenFOAM Running, Solving & CFD 11 April 4, 2011 16:04
Creating Lagrangian particles for postprocessing hjasak OpenFOAM Post-Processing 6 July 2, 2008 11:59
maximum particles' volume fraction for Lagrangian Itchie CFX 0 March 19, 2008 11:06
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 09:19
lagrangian particles allan Siemens 1 August 18, 2004 06:01


All times are GMT -4. The time now is 13:33.