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

Iteration over particles

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 20, 2020, 07:55
Default Iteration over particles
  #1
New Member
 
Arsalan
Join Date: Aug 2019
Location: Belfast, UK
Posts: 5
Rep Power: 5
Arsal is on a distinguished road
Hi all,

I need to access the current cell of particles and if they are located in the region defined in topoSet, remove them and add their mass to their corresponding cells (for post-processing). Additionally, if possible, update the porous term locally.

I have searched the forum, and I could find code snippets, but I cannot figure out where these codes need to be added.

Should I write a functionObject? Or there might be a ready solution out there that I'm not aware of (since this is needed for filtration simulation)?

The two related threads I found were these:

1- Access particle data in main function

2- remove particle
Arsal is offline   Reply With Quote

Old   February 20, 2020, 08:57
Default
  #2
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 5
raumpolizei is on a distinguished road
Hey!
What you would like to do can be probably done using CloudFunctionObjects (however, no idea what you mean with the porosity issue). Take a look at the interface defined for this class and you will find that there are some functions (like postMove, postEvolve) that are being called anyway when the general "evolve" function is called in your main application (one at the end of a parcel move and the other after the whole cloud has evolved). It basically works like a functionObject, but for clouds.
For your task, you will probably have stored your cells in a cellSet, which can be used to create a labelHashSet. This can then be used to check if the current cell of the particle is inside this set.

Code:
labelHashSet cellsOfInterest(cellSet(mesh,"myRegion"));// myRegion created with toposet or so, in a preprocessing step.
Here is a bit of pseudocode:
Code:
 // loop over cloud (this would be for instance inside your postEvolve method)
for p in cloud
     k = p.cell // cell in which p is in
    if k is in cellsOfInterest // something like if(cellsOfInterest.found(k))
         do whatever you would like to do
// finito
Hope this makes sense. You can find CloudFunctionObject examples in src/lagrangian/intermediate/submodels. Good luck!
raumpolizei is offline   Reply With Quote

Old   February 20, 2020, 09:36
Default
  #3
New Member
 
Arsalan
Join Date: Aug 2019
Location: Belfast, UK
Posts: 5
Rep Power: 5
Arsal is on a distinguished road
Quote:
Originally Posted by raumpolizei View Post
Hey!
What you would like to do can be probably done using CloudFunctionObjects (however, no idea what you mean with the porosity issue). Take a look at the interface defined for this class and you will find that there are some functions (like postMove, postEvolve) that are being called anyway when the general "evolve" function is called in your main application (one at the end of a parcel move and the other after the whole cloud has evolved). It basically works like a functionObject, but for clouds.
For your task, you will probably have stored your cells in a cellSet, which can be used to create a labelHashSet. This can then be used to check if the current cell of the particle is inside this set.

Code:
labelHashSet cellsOfInterest(cellSet(mesh,"myRegion"));// myRegion created with toposet or so, in a preprocessing step.
Here is a bit of pseudocode:
Code:
 // loop over cloud (this would be for instance inside your postEvolve method)
for p in cloud
     k = p.cell // cell in which p is in
    if k is in cellsOfInterest // something like if(cellsOfInterest.found(k))
         do whatever you would like to do
// finito
Hope this makes sense. You can find CloudFunctionObject examples in src/lagrangian/intermediate/submodels. Good luck!
Thanks a lot.

Now I remember I tried to use them some time ago, but I couldn't figure out how to use them. I first tried with ParticleCollector that includes postMove, and the region should be defined by a polygon or a concentricCircle:

Code:
particleCollector1
{
    type            particleCollector;

    mode            concentricCircle;
    origin          (0.05 0.025 0.005);
    radius          (0.01 0.025 0.05);
    nSector         10;
    refDir          (1 0 0);
    normal          (0 0 1);

    negateParcelsOppositeNormal no;
    removeCollected no;
    surfaceFormat   vtk;
    resetOnWrite    no;
    log             yes;
}
However, I couldn't figure out how an annular cylinder can be defined, and how it works (I even had a look at the source code). I couldn't find any resources on the internet. The other one was ParticleTrap that apparently operates based on the volume fraction of the solid (which is irrelevant to what I want to do).

So, this pseudo-code that you have written (and labelHashSet) will be added to one of the Lagrangian submodels (and recompilled), or a separate functionObject needs to be written and to be included in the controlDict?

What I meant by updating porosity is to modify the local permeability (resistance) based on a empirical relationship between the deposited mass (local) and the resistance. In fvOptions, a constant global permeability is defined for the whole region, but I would like to assign a dynamic value to each cell (updated at every time step).
Arsal is offline   Reply With Quote

Reply

Tags
functionobject, kinematic cloud, lagrangian, lpt

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
dsmcFoam - micro-hole limiting the number of dsmc particles Araist OpenFOAM Running, Solving & CFD 0 June 25, 2015 07:50
trying to simulate two-phase jet flow with particles in surface injection ajkratos FLUENT 5 March 3, 2015 22:33
Hardware-Configuration for Fluent HPC-Pack (8x) JohHaas Hardware 9 March 3, 2015 14:25
Fluent DPM deleting particles during iteration civilcfd FLUENT 0 August 7, 2013 12:53
Parallel runs slower with MTU=9000 than MTU=1500 Javier Larrondo FLUENT 0 October 28, 2007 23:30


All times are GMT -4. The time now is 11:47.