Adding Contact Forces to CSV Output in DEME Simulations

89 views
Skip to first unread message

Marouane El Bissouri

unread,
Jul 19, 2024, 12:51:03 PM7/19/24
to ProjectChrono
Hello,

I'm currently working with the DEM-Engine for simulating granular flow, similar to the scenario in DEMO_Hopper_Cylinder_sphere. In this demo, the generated CSV files include data on position, radius, velocity, and family for each particle. What i want to do is to add contact forces :  Specifically, for any given particle (let's call it Particle A), I want to identify all particles in contact with it, record the force exerted by each contacting particle, and include this information on the same dedicated line of the CSV file for Particle A. Is there an existing method or approach  that would allow me to achieve this?

Thank you!

Marouane ELBISSOURI

Ruochun Zhang

unread,
Jul 20, 2024, 5:15:08 AM7/20/24
to ProjectChrono
Hi Marouane,

Stock output methods WriteSphereFile and WriteClumpFile cannot add contact information to the file. You can instead consider using the dedicated method WriteContactFile. It will write the information of all current contacts (geometries involved, contact point, force magnitude/direction, etc., and you control what goes to the output by SetContactOutputContent) to a file. Then you post-process the file to get the "contact map" you want. DEMdemo_ContactChain is an example that uses this method. If you have trouble interpreting the output contact file, please post on the forum.

I'd like to add that if you just need the contact pairs (IDs) and the total force each clump experiences as a result of all the contacts surrounding it, there's another approach. DEMdemo_Indentation uses GetClumpContacts to query the IDs of the owners that are in contact with each clump, then use this information to build a "contact map." Then the total force of each clump experience can be extracted via trackers. The caveat, as I mentioned, is you cannot easily get each force pair concerning a clump because it's stored in a different way in memory to improve efficiency.

Thank you,
Ruochun

Marouane El Bissouri

unread,
Aug 5, 2024, 6:54:39 AM8/5/24
to ProjectChrono

Hello,

Thank you, Ruochun Zhang, for your response; it was very helpful. I have a follow-up question: In the DEMdemo_ContactChain example, we use the line DEMSim.SetContactOutputContent(DEME_POINT | OWNER | FORCE | CNT_WILDCARD); to generate a CSV file similar to the attached one. My question is, does the force displayed in the file represent the force applied by B on A or by A on B? Additionally, are the force coordinates expressed in the reference frame related to the contact plane or in the absolute reference frame? If they are in the contact plane's reference frame, is there a way to convert them to the absolute reference frame?

Thank you,
Marouane

Capture d’écran du 2024-08-05 12-44-36.png

Ruochun Zhang

unread,
Aug 6, 2024, 3:35:39 AM8/6/24
to ProjectChrono
Hi Marouane,

So in Define.h starting from line 160, I did give some explanations on what those components are. I know this is not the best way in the world to make documentations, but before a better one is in place you at least have some access to the information.

To answer your questions, the forces are applied by B on A; the force magnitude and point of action are in the global frame.

Thank you,
Ruochun

Marouane El Bissouri

unread,
Aug 6, 2024, 5:16:27 AM8/6/24
to Ruochun Zhang, ProjectChrono
Thank you so much,
Marouane

--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/2a2e2d51-6f73-4cc4-b52b-37a8af1725c8n%40googlegroups.com.

Marouane El Bissouri

unread,
Nov 28, 2024, 7:58:02 AM11/28/24
to ProjectChrono
Hello,

 I have a follow-up question regarding the particle IDs in the output files.

In the position/velocity file, I don’t see any explicit IDs for the particles, whereas in the contact file, the IDs (A and B) are clearly specified. Should I assume that the IDs in the contact file correspond directly to the row numbers in the position/velocity file? Or is there another mapping logic I should follow?

Thank you,

Marouane


Capture d'écran 2024-11-28 135418.png
Capture d'écran 2024-11-28 135617.png

Ruochun Zhang

unread,
Nov 28, 2024, 10:45:20 AM11/28/24
to ProjectChrono
Hi Marouane,

Suppose that you did not disable the output for any family, then yes, the row number (starting from 0) will be the the IDs used in the contact file. Note that "A" and "B" marks owner numbers. If you are using spherical elements, then that's not an issue; if you are using multi-sphere clumps, the it's the IDs of the clumps, not individual spheres.

Suppose you did disable the output for some families, then in that case, a current weakness is that some clumps may not be present in the XYZ output file, thus effectively "skipping" some numbers and making the row numbers and the contact A and B not correspondent. If that is the case, I can implement a utility to include the owner number in the XYZ output file for you to use.

Thank you,
Ruochun

Reply all
Reply to author
Forward
0 new messages