EDEM API: Particle Body Force - Particle Growth Cycle


Overview
This API allows you to simulate any kind of particle expansion/growth/swelling and shrinkage in EDEM. There is also an example attached that shows the usage of the API.
Usage/Installation Instructions
- Extract the zip file attached. Copy the 'ParticleGrowthCycle.dll' and 'ParticleGrowthCycleInput.txt' from the 'example' folder to the directory of your EDEM simulation.
- Add the plugin model in 'Particle Body Force' of the Physics section.
- You must enter three different values - expansion/shrinkage rate, final scale and start time of the expansion/shrinkage, in the preference file (ParticleGrowthCycleInput.txt).
Use negative values for shrinkage. Higher the rate, faster the process. - You can have multiple lines of the values to indicate different cycles of swelling and shrinkage in your simulation. Note that you can have a maximum of 40 rows only.
All the particles in your simulation will grow/shrink at the rate you specify in the preference file.
Post-Requisite
If you are interested in just the expansion/shrinkage once, and not necessarily the cycle of expansion/shrinkage, you can refer to this API: https://community.altair.com/community/en/edem-api-particle-body-force-particle-growth?id=kb_article&sysparm_article=KB0122138
You will also be able to add different rates for different particles using the linked API.
Comments
-
Hi
When I opened the example this error showed up:
WARNING : Plugin : Could not load plugin file:
D:/ParticleGrowthCycle/example\ParticleGrowthCycle.dll
May I know what I should do to solve this problem?0 -
Please use EDEM version 2024.1 or later. Hope that helps.
0 -
Hi Jerrinjobs
I have tried using Altair 2024.1 but the error still occurred.
I download the file and open it, without any modification or changing the file location. But the error still occur.
May I know what I should do? I googled my problem, and one post mentioned that I need to recompile the plugin.0 -
Hi,
Recompiling often would work, as it may not be loading if you don't have the required pre-requisites on your computer and installing visual studio and compiling resolves this. You can also just install the pre-requsities e.g.
It could also be file permissions, you will need to have read/write/execute permissions for the folder containing the .dll.
RegardsStephen
0 -
Hi, this is a great API code that it worked well for examples and my dem simulation. I would like to know how to add different rates for different particles. This was not explicitly stated in the link provided which is about "particle growth". I looked at both codes and tried to modify "ECalculateResult CParticleGrowthCycle::externalForce". However, the particles remain unchanged.
0 -
Hi @TonyC I'd recommend watching the intro to EDEM API YouTube series:
It would be under the externalForce function in CParticleGrowthCycle.cpp (for CPU) and PartilceGrowthCycle.cu (for GPU).
You need to search out a particle type by name (particle.type) and apply the apply the code to this type only.
We have an example for Geometries where we only remove particles contacting a specifically named geometry:
Regards
Stephen
0 -
Dear @Stephen Cole , Thank you very much for your detailed reply.
I watched all the YouTube videos and read the removing particles example. However, I am still unsuccessful in editing API codes. The wheel button found in the removing particles example is not accessble in the particle growth cycle dll. It is still unclear what you mean by "You need to search out a particle type by name (particle.type) and apply the apply the code to this type only." Would you please elaborate how this can be done in the API code? Is particle.type command only available in the gpu file (cu) or also available in cpu? I really appreciate your help.
Best,
Tony Cho
0 -
Hi Tony,
There are also the EDEM API tutorials which would be helpful go to through:
You can input data to an API model via a Text File or user input via the user interface. You have to code this in if you want to use something like the wheel to add an input. There is a guide here:
However that's not where I would start out, I would recommend just coding the name in directly. In the particle removal example there is the code:
// Get the geometry name as a string
const std::string geometry_name = GEOM_NAME.getString();
// Check if the particle is in contact with the geometry
if (strcmp(element2.type, geometry_name.c_str()) == 0)
{
//update mass passed custom prop with the mass of the particle removed
double* massPassedDelta = elem2CustomProperties->getDelta(iMASSPASSED);
massPassedDelta[0] += element1.mass;
//remove particle
m_particleMngr->markForRemoval(element1.ID);
}This checks if element2.type (the geometry) has the same name as user defined geometry_name string, and if so then removes the particle.
If you wanted to apply different growth rates to different particles, or similar you would want code more like:
const std::string name1 = "particle1";
const std::string name2 = "particle2"; if (strcmp(element1.type, name1.c_str()) == 0)
{ //apply growth rate for particles called "particle1" here } else if(strcmp(element1.type, name2.c_str()) == 0)
{ //apply growth rate for particles called "particle2" here }note that element1 is always a particle, element2 can be particle or geometry so should also check for name of element2 if it's a Contact Model. If using a Body Force its "particle.type" not "elementn.type"
The above code example if for CPU which is always a good place to start coding as it's easier to debug, if you are using shapes that run on CPU like Spheres, polyhedral particles run on GPU only but you could still run a CPU sphere test case.
RegardsStephen
0