Can EDEM group particles in a region as new type?
Answers
-
Hi Raheem,
Not really as standard but it would be possible using the API where you can delete a particle or set of particles, record their position and replace them with others.
This is what is done in the particle replacement tutorial https://community.altair.com/csm?id=kb_article_view&sysparm_article=KB0037689Regards
Stephen
0 -
Stephen Cole_21117 said:
Hi Raheem,
Not really as standard but it would be possible using the API where you can delete a particle or set of particles, record their position and replace them with others.
This is what is done in the particle replacement tutorial https://community.altair.com/csm?id=kb_article_view&sysparm_article=KB0037689Regards
Stephen
Hi Stephen,
Thanks for your answer, it seems a good way to solve my meet.
I have a question about this forum, I know the reference file "Particle_cluster_Data" is exoprted by the code itself, may this part in CRemoval.cpp:
But I still unclear about the calculation of coordinate of Fraction particles, am I missing any functions or something else?
//write info to newPart strncpy(newPart.Type, ParticleCluster.c_str(), NApi::API_BASIC_STRING_LENGTH); newPart.Scale = m_particleMngr->getScale(particle.ID); newPart.Position = CSimple3DVector(particle.position.getX(), particle.position.getY(), particle.position.getZ()); newPart.Velocity = CSimple3DVector(particle.velocity.getX(), particle.velocity.getY(), particle.velocity.getZ()); newPart.AngVelocity = CSimple3DVector(particle.angVel.getX(), particle.angVel.getY(), particle.angVel.getZ()); newPart.Orientation = CSimple3x3Matrix(particle.orientation.getXX(), particle.orientation.getXY(), particle.orientation.getXZ(), particle.orientation.getYX(), particle.orientation.getYY(), particle.orientation.getYZ(), particle.orientation.getZX(), particle.orientation.getZY(), particle.orientation.getZZ()); //add particle to factory list ParticleList[threadID].push_back(newPart);
Regards
Raheem
0 -
Raheem Sterling_22160 said:
Hi Stephen,
Thanks for your answer, it seems a good way to solve my meet.
I have a question about this forum, I know the reference file "Particle_cluster_Data" is exoprted by the code itself, may this part in CRemoval.cpp:
But I still unclear about the calculation of coordinate of Fraction particles, am I missing any functions or something else?
//write info to newPart strncpy(newPart.Type, ParticleCluster.c_str(), NApi::API_BASIC_STRING_LENGTH); newPart.Scale = m_particleMngr->getScale(particle.ID); newPart.Position = CSimple3DVector(particle.position.getX(), particle.position.getY(), particle.position.getZ()); newPart.Velocity = CSimple3DVector(particle.velocity.getX(), particle.velocity.getY(), particle.velocity.getZ()); newPart.AngVelocity = CSimple3DVector(particle.angVel.getX(), particle.angVel.getY(), particle.angVel.getZ()); newPart.Orientation = CSimple3x3Matrix(particle.orientation.getXX(), particle.orientation.getXY(), particle.orientation.getXZ(), particle.orientation.getYX(), particle.orientation.getYY(), particle.orientation.getYZ(), particle.orientation.getZX(), particle.orientation.getZY(), particle.orientation.getZZ()); //add particle to factory list ParticleList[threadID].push_back(newPart);
Regards
Raheem
Hi Raheem,
The code you have above is taking the coordinates of the existing particles and writing them to an array (newPart which gets written to ParticleList), recording the velocity and orientation then later in the code it takes the ID and runs 'markForRemoval' to delete this.Next time-step it runs CReplacementFactory where it checks ParticleList and writes one line of this list to NextParticle. The factory then creates new particles with the recorded velocity and orientation, adding the position of the deleted particle to the position in the Particle_Cluster_Data.txt
There is a description in the end of the EDEMAPI Tutorial 1 - Particle Replacement.pdf document also.
RegardsStephen
0 -
Stephen Cole_21117 said:
Hi Raheem,
The code you have above is taking the coordinates of the existing particles and writing them to an array (newPart which gets written to ParticleList), recording the velocity and orientation then later in the code it takes the ID and runs 'markForRemoval' to delete this.Next time-step it runs CReplacementFactory where it checks ParticleList and writes one line of this list to NextParticle. The factory then creates new particles with the recorded velocity and orientation, adding the position of the deleted particle to the position in the Particle_Cluster_Data.txt
There is a description in the end of the EDEMAPI Tutorial 1 - Particle Replacement.pdf document also.
RegardsStephen
Hi Stephen,
Thanks for your explanation. I still have two thing to make sure.
1 In my understanding, "Particle_cluster_data.txt" was defined independent of the code, is it defined before the simulation? So if I want to replace the particles in my simulations, I should write my "Particle_data.txt" to defined the coordination of replaced particles.
2 In the "Particle_replacement_prefs.txt":
ParticleReplace: Whole
ParticleCluster: Fraction
ParticleReplace_MinScale: 2
StartBondingTime: 0.4StartBondingTime is a useless value, because it hasn't been readed in the code. Am I right?
prefsFile >> discard >> ParticleReplace >> discard >> ParticleCluster >> discard >> m_requestedBondTime;
0 -
Raheem Sterling_22160 said:
Hi Stephen,
Thanks for your explanation. I still have two thing to make sure.
1 In my understanding, "Particle_cluster_data.txt" was defined independent of the code, is it defined before the simulation? So if I want to replace the particles in my simulations, I should write my "Particle_data.txt" to defined the coordination of replaced particles.
2 In the "Particle_replacement_prefs.txt":
ParticleReplace: Whole
ParticleCluster: Fraction
ParticleReplace_MinScale: 2
StartBondingTime: 0.4StartBondingTime is a useless value, because it hasn't been readed in the code. Am I right?
prefsFile >> discard >> ParticleReplace >> discard >> ParticleCluster >> discard >> m_requestedBondTime;
Hi Raheem, Particle_cluster_data.txt was created externally, there would be different ways of doing this but in this case a CAD geometry of the particle (sphere) was created and filled with particles. The positions of these were exported and formatted to create the .txt file.
As you say it looks like StartBondingTime isn't used, this is possibly left over from a legacy version which also used an API version of the bonded model, now the tutorial uses the in-built bondingV2 model and takes the bond time from that.
0 -
Stephen Cole_21117 said:
Hi Raheem, Particle_cluster_data.txt was created externally, there would be different ways of doing this but in this case a CAD geometry of the particle (sphere) was created and filled with particles. The positions of these were exported and formatted to create the .txt file.
As you say it looks like StartBondingTime isn't used, this is possibly left over from a legacy version which also used an API version of the bonded model, now the tutorial uses the in-built bondingV2 model and takes the bond time from that.
Hi Stephen,
Thanks, I have accomplished what I want, the similar way, remov and replace, it works well, thanks for your help.
Regards
Raheem
0