CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Create-destroy Lagrangian parcels (

dav.dap83 June 3, 2013 07:16

Create-destroy Lagrangian parcels
Hello everyone,

I am working on a combined VOF and Eulerian-Lagrangian solver. It works fine, but I need to destroy Lagrangian parcels once they enter in a given fluid phase.
Is there anyone who can indicate me how I can implement this system?

Thank you

dav.dap83 June 5, 2013 08:07

No ideas about how to make it?

GPesch June 10, 2013 03:05


not quite sure where you are stuck but I do my best to help you.
Also: I'm not familiar with the solver you are using, I use DSMC, also a Lagrangian solver, so things might be the similar.

You should check the move() method of the cloud class found in the lagrangian basic library (Cloud.C).
You will see that it is calling a move routine of the particle class and this routine is either returning true or false. If true, the particle is kept after the movement, if false, the particle is going to be deleted after movement (which would be exactly what you want right?).

What you need to do is to identify the move routine of the parcel class that your solver is using. As the Lagrangian Basic particle class has no move routine it must be found somewhere in the particle class of your specific solver.

In the DsmcCase it is found in the DsmcParcel Class (DsmcParcel::move()). What it does: It calls the trackToFace routine (which is again from the lagrangian basic particle class) over and over until the movement of the particle is completed. trackToFace tracks the particles movement until it hits a face or until the movement is completed. When it hits a face, it calls a specific routine and returns the value of how much of its trajectory is already done....
So with this routine it would be easy to implement that the particle is deleted after movement. Just check in the trackToFace routine whether its crossing a boundary and is in a specific fluid type, if yes: set the keepParticle value to false and it is going to be deleted after the movement automatically...

Hope that helped...

dav.dap83 June 17, 2013 07:21


Thank you for the answer. In Cloud.C there is a void move(...) method.
At a certain point it calls a bool ParticleType method that moves a single particle and returns true if it has to be kept, fals otherwise:

bool keepParticle = p.move(td, trackTime);
Then either evolves the particle or deletes it depending of the value of keepParticle:

if (keepParticle)
  { deleteParticle(p); }

So, the idea is developing a new bool method in Cloud.C that returns true if an input particle is inside a given phase (say A), false otherwise.

Now I am wondering how to do this without touching the original class files. Since I use the basicKinematicCollidingCloud template class, it seems that I have to define subclasses for every single class, that is CollidingCloud, KinematicCloud, Cloud, CollidingParcel, KinematicParcel.:eek:

All times are GMT -4. The time now is 00:56.