TAGGED: rocky-dem
-
-
June 3, 2026 at 5:26 pm
cma6301
SubscriberHello,
Â
I want to extract raw simulation data such as particles and contact information for post processing. I am having challenges with extracting contact information(contact ID, contact positions, contact vector, normal and tangential forces) at each timestep. I can get particle information(particles ID, particle velocities, particle positions, particle overlap) at each timestep using the script provided by Ansys Rocky, However, there was no script for contact indormation. I modify the particle information script to extract the contact information but getting an error about position argument
in the script I used
contacts = study.GetContactData(time_step)
This is were I get the error. But without "time_step" in the argument I get a single value for each simulation output.
Â
Best regards,
Â
Ayuk
-
June 5, 2026 at 1:07 pm
Lucas Hoenicke
SubscriberHello Ayuk, I hope you are doing well.
To collect Contacts data:
contacts = study.GetContactData()
contacts.SetCollectContactsData(True)Ok, now, run the simulation.
Once you have the results, we can extract simulation results.
I will use the Overlap property as an example.
So, our script snippet will look like this:
timeset = study.GetTimeSet()Â # timeset returns the a list of timesteps in the simulation
overlap = [ ] # Here, we are declaring a list that will receive the overlap value for each simulation timestepfor timestep in timeset:
   overlap.append( contacts.GetGridFunction('Overlap').GetAverage(time_step = timestep) )
# It is necessary to name the property you want to collect, therefore 'Overlap' as a string argument. Then, you must specify what operation you want, so I used the GetAverage() function. As argument to GetAverage(), I passed the timestep variable, that runs inside the loop, this will allow us to collect all aveage values of overlap.
-
June 5, 2026 at 1:31 pm
cma6301
SubscriberHello Lucas,
Thank for this explanation although still not clear.
What I want is contact information such as contact IDs, contact positions, contact vectors, and contact forces at each timestep (I don't want a single average value). The reason I need this is because I want to post-process my data using Gaussian averaging method. This I need the discrete data. Like I said before If i used the particle information scripts I get this discrete informations for Particle information such as particle ID, particle positions, particle velocities. However, I cannot get these informations for contact information using the same script by modifying the contact to  contacts = study.GetContactData(time_step), But if I used contacts = study.GetContactData() I just get average values which is not what I want.Â
-
June 5, 2026 at 6:04 pm
Lucas Hoenicke
SubscriberOk, I'm going to show you another workflow, see if this is what you mean.
We can use the "Particle to Contact" User Process to analyze particle/contact properties.Now, we can use an association of filters to identify the pair of particles for a given contact event. For example,
Let's create a Filter process upon the Particle to Contact process. In this fiter, we can select "Particle ID From" to define the first particle of the contact pair.Now, upon the "Particle ID From" filter, we are going to create another Filter. For this one, we can select the "Particle ID To" property.
It should look like this.Now, all of the properties from the second Filter are those of contact pair between particles A and B, for example.
To know their positions, then you'll have to use filters and ID's to evaluate a certain particle at a given time and extract that information.Please, let me know if this is what you are looking for.
-
- You must be logged in to reply to this topic.
-
6625
-
1906
-
1469
-
1312
-
1022
© 2026 Copyright ANSYS, Inc. All rights reserved.


