Closed alecontri closed 1 year ago
@KratosMultiphysics/mpm
Hi @alecontri you can define the number of particles which are created/initialized within one element of the body mesh. The variable particles_per_element can be changed in the ParticleMaterials.json or in the GiD Interface in the definition of the body (it is not a variable of the background mesh.) Best Veronika
Thank you very much @VeronikaSinger for replying. Ok I understand, but that holds only in the initial step, right? What about accessing the effective number of particles inside a background element during a dynamic simulation (I need it at every time step since I am modifying the updated lagrangian element for my purposes) where particles can cross element borders and move wildly?
Yes true - this only holds for the initial step (sorry I probably missunderstood your question). Up to now, there is no possibility to check the number of particles within one element during the calculation process. To resolve this quickly one can probably add a counter variable on the element level and check the background element IDs on the python level. But if you need this feature not only for testing we should discuss possible implementations. @tteschemacher do you have a suggestion?
I need it for experimenting a stabilization on the mixed element. I though about ways to do it, but since I am not really a very experienced programmer in C++, I do not know what was the correct way to handle it. If it can be useful I put the ideas here just in case:
Maybe you can tell me what's the best way to proceed.
I think we should keep it in the ParticleMechanicsApplication as this is very specific and add a counter to the particles. If you just need the number of particles within one background element you possibly could check the GeometryParentId in a python process.
For your first option (which is my preferred option) you don't need to change the base element. You can achieve the same behavior as follows:
TOTAL_MATERIAL_POINTS
. This would be the "counter".BinBasedFastPointLocator
would most probably be the best option for this), to locate each material point. Then you can do p_found_element->GetValue(TOTAL_MATERIAL_POINTS) += 1
. This is something that needs an atomic
clause as you pointed up.Concerning the second option, this is in my opinion no go as makes the MPI parallelization way complex, aside of the fact that you'll need to save and manipulate a dense large vector.
Closing as it seems to be solved. @alecontri feel free to reopen if needed.
Hi all, I was wondering if there was a way to access the number of particles falling inside a certain Background Grid element in the ParticleMechanicsApplication from the "updated_lagrangian.cpp" element. As I understand, every MPM element created has a particle with an associated background geometry in which it falls, but accessing the number of integration points inside the element geometry by construction it always gives 1 if I am not wrong. I am grateful to anyone who can help me.