CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Access trackingData in PairCollision (https://www.cfd-online.com/Forums/openfoam-programming-development/231018-access-trackingdata-paircollision.html)

Kaazem_RA October 17, 2020 12:41

Access trackingData in PairCollision
 
Hi everyone
I am working on Lagrangian particle tracking in openfoam. I want to add some pieces of code in PairCollision class. In this class there are some functions in which particle-particle and particle-wall interactions are evaluated. wallInteraction() is the function in which i want to add some pieces of code. In this function there is a loop over all parcels in cell which some part of it is as follows:
Code:

forAll(cellOccupancy[realCelli], cellParticleI)
        {
            flatSitePoints.clear();
            flatSiteExclusionDistancesSqr.clear();
            flatSiteData.clear();
            otherSitePoints.clear();
            otherSiteDistances.clear();
            otherSiteData.clear();
            sharpSitePoints.clear();
            sharpSiteExclusionDistancesSqr.clear();
            sharpSiteData.clear();

            typename CloudType :: parcelType& p = *cellOccupancy[realCelli][cellParticleI];

a parceltype p is defined. Is it possible to access trackingData of this parcelType. I would like to assigin keepParticle to false to delete the parcel. I have tried some code like
p::trackingData& td or parcelType::trackingData& td but i encounter error after compilation. It would be highly appreciated if anyone could help.

oswald October 22, 2020 03:23

Hi,


I assume that you would have to hand it over to the function in which you want to use it (see for example the "update"-funciton in StochasticCollisionModel.C) or you would have to put it in the class-constructor to have it available in the whole PairCollision-class.

Kaazem_RA October 22, 2020 10:18

Quote:

Originally Posted by oswald (Post 785762)
Hi,


I assume that you would have to hand it over to the function in which you want to use it (see for example the "update"-funciton in StochasticCollisionModel.C) or you would have to put it in the class-constructor to have it available in the whole PairCollision-class.

Thank you very much for your reply. I have realized that a function exists in openfoam that remove particle: deleteParticle(p). I use this function in PairCollision class as below:
Code:

this->owner().deleteParticle(p)
after adding this line my new intermediate library compiled successfully. Now i encounter a new problem. None of member functions of PairCollision class is called. I expected them to be called in collidingCloud class using line below
Code:

collsionModel().collide()
I use Info to check collide() function call but nothing appears on terminal when running hopper tutorial case. It woud be greatly appreciated if you could help.
Best regarad,
Kazem

oswald October 23, 2020 06:19

Hi Kazem,


where and why are you calling this function? It would be easier to give some advise if there would be a bit more information, especially a bit more of the code you were writing.

Kaazem_RA October 23, 2020 12:01

Thank you very much for your reply oswald. Actually i have discovered that in of6 and later versions all particles are considered as points and there is no function to control particle-wall distance unless pair collision model is turned on. I am trying to solve flow and particle in a geometry in which when a particle hits a wall it sticks to it. Hopefully In pair collision class there exist a function wallInteraction() in which a loop over all parcels exists and it controls the distance between particle and wall. If the distance between particle and wall is lower than half of the particle diameter particle-wall interaction is evaluated. In this function i add deleteParticle(p) to remove the particle. I think this is the easiest way to do that. Today i use Info in collide() function in which wallInteraction() is also called to check function call. This time i use of7 instead of of6. Unlike of6 i did not encounter any problem and my message appeared on the terminal. I really don't have any idea why nothing appears on the terminal when i use of6.

oswald October 23, 2020 15:04

Also before version 6 particles were treated as points, as this is the standard way in Euler-Lagrange-methods. Otherwise there would for example be no need for force models.



Do I get you right that the only reason you are using the deterministic collision model is that you want particles that hit walls will stick to them? If so: Consider using "standardWallInteraction" with the option "stick" as patchInteractionModel. This drastically reduces the computational effort. If you want the particles to vanish and to to be kept inside the domain, use the option "escape" instead of "stick".


If you have any other reasons to use pairCollision: I still did not get what you are trying to achieve at the moment, sorry.

Kaazem_RA October 23, 2020 18:56

Thank you very much for your answer.

You are completely right. For spherical particles using standardWallInteraction is a very good choice and reduces computational efforts.
The big problem i have is that i deal with non-spherical particles and as you probably know there is a completely different mechanism for non-spherical particles to stick to the wall they hit. I checked standardWallInteraction class and tried to add some pieces of code to account for non-spherical particle depositions but i could not. There is only one function correct() in this class which is called whenever a particle center touches the wall. This is not what i want. I need a function that controls the distance between the particle and the wall. To the best of my knowledge just wallInteraction() function has this capacity (It would be appreciated if you introduce any function if available).

In this function the distance between a particle and nearest wall is calculated. If this distance is lower than half diameter of the particle, wall-interaction is evaluated. For non-spherical particle the minimum distance is not half diameter and my goal is to add this distance to pairCollision class and then remove particle if the aforementioned distance is lower than nearest wall distance.

oswald November 4, 2020 03:33

I see, with non-spherical particles it is a bit more complicated. Maybe the wall distance stuff is of interest for you? https://www.openfoam.com/documentati...-distance.html


You can find an example in applications/test/wallDist

Kaazem_RA November 5, 2020 14:49

thank you very much for your answer. I will check the link.


All times are GMT -4. The time now is 21:23.