Rigid Body Dynamics Simulation Contact Force

  • 633 Views
  • Last Post 23 October 2018
  • Topic Is Solved
adamkovacs1126 posted this 30 September 2018

Hi everyone,

I need to extract normal forces on a given contact in order to measure friction between the two parts. The simulation works just fine but I could not find any probes for this type in Rigid Dynamics (only in Transient Structural but I cannot get my simulation work somehow in that one). 

Do you have any idea where I could set this probe up?

Thanks very much in advance, 

Kind regards,

Adam

Order By: Standard | Newest | Votes
SandeepMedikonda posted this 01 October 2018

Adam, 

Currently, you can retrieve just the normal contact force in Rigid Dynamics.

Most useful measures are pre-existing in the rigid dynamics model, and can be accessed using other object “get” functions.(See help document here for further details: Mechanical users guide >> Rigid Dynamic Analysis >> Command Reference for Rigid Dynamics Systems >> The Rigid Dynamics Object Model). In the above commands "OutputContactForce" measure is used. This measure only contains the normal force.

One can use Python scripting language in a commands object to retrieve contact forces in Rigid Dynamics. But I don't know if you are aware of how to do this?

Regards,

Sandeep

  • Liked by
  • adamkovacs1126
adamkovacs1126 posted this 01 October 2018

Hi Sandeep, First, thanks very much for your answer. The normal forces are exactly what I need on the given surfaces to calculate friction!

I did some python programming in the past but I have not used it for ANSYS yet, could you guide me with where to look if I want to learn to retrieve these contact forces? I will also look at the document you mentioned.

Thanks in advance and kind regards, Adam

SandeepMedikonda posted this 01 October 2018

Hi Adam,

  You can insert a python command snippet as shown:

and under the analysis system:

use the following commands to get the forces:

 

Regards,
Sandeep
Best Practices to post on the Student Community

  • Liked by
  • adamkovacs1126
SandeepMedikonda posted this 01 October 2018

I get an error editing the above post to paste the code snippet, but here is the snapshot of unavailable line in the for loop:

Regards,
Sandeep
Best Practices to post on the Student Community

  • Liked by
  • adamkovacs1126
adamkovacs1126 posted this 01 October 2018

Hi Sandeep,

many thanks for the whole script!! I am going to try it and let you know of the results!

When you have some time, please could you explain these lines so I can understand the basic method behind this script?

Thanks again, 

Kind regards,

Adam

SandeepMedikonda posted this 01 October 2018

Adam,

  It is fairly straightforward, you are basically extracting the forces and moment from the Contact Object. Then opening a file and writing all the extracted forces at each time into that file.

  There is an enhancement request to do this via the GUI but until then, this is the way around.

P.S: If a post answers your original question, please mark it as a solution (‘Is Solution') so that it might help someone in the future. This will help reduce repetitive questions and help provide better support on this Forum.

Regards,
Sandeep

adamkovacs1126 posted this 02 October 2018

Hi Sandeep,

I tried to do everything as you said and I get the following errors:

I tried to clear the solution and solve it again but I got the same error messages. Is there anything I did wrong?

These are the scripts that I wrote following yours:

Script 1

contact = CS_Contact.Find(_cid)

Script 2

contactForce = contact.GetOutputContactForce();
contactValues = contactForce.FillValuesThroughTime()
nbValues = contactValues.Length/7
fich=open(r"contactForce.csv",'w')
fich.write('Time,FX,FY,FZ,MX,MY,MZ\n')
for i in range(0, nbValues):
 fich.write('{0:4.3f},{1:11.4e},{2:11.4e},{3:11.4e},{4:11.4e},{5:11.4e},
 {6:11.4e}\n'.format(contactValues[i,0],contactValues[i,1],contactValues[i,2],contactValues[i,3],contactValues[i,4],contactValues[i,5],contactValues[i,6]))
fich.close()

Of course I will mark your answer as solution, I am just waiting for mine to work so the discussion can be closed  

Thanks again and kind regards,

Adam

 

SandeepMedikonda posted this 02 October 2018

Write everything in 1 line inside the 'for' loop for the command starting with "fich.write"

  • Liked by
  • adamkovacs1126
adamkovacs1126 posted this 02 October 2018

Thanks Sandeep,

I did what you said and now there are indeed no warnings and everything is ticked. I also found the excel file containing all the contact forces divided into X, Y and Z component. Does that mean that the magnitude of the NORMAL contact force for a given time is: F = sqrt(FX^2 + FY^2 + FZ^2)?

Thank you again and kind regards,

Adam

 

SandeepMedikonda posted this 02 October 2018

Hi Adam, yes.

  • Liked by
  • adamkovacs1126
adamkovacs1126 posted this 22 October 2018

Hi Sandeep,

sorry to bother you again, can you confirm that these output forces are NORMAL and that they are shown in [N] in the Excel file? My unit set shows N in Mechanical but the Excel file doesn't indicate it. 

Thanks and kind regards,

Adam

SandeepMedikonda posted this 22 October 2018

Adam,

  As far as I can tell, you are dealing with a force vector here. The magnitude doesn't always mean it is normal, it just gives you the magnitude of that vector. If you want to calculate the normal, first you need to calculate the normal unit vector, then the dot product of these 2 vectors i.e., n.F will give you the normal vector. Please revisit vector calculus once if you get a chance?

  We are not writing the units into Excel, but they should be consistent with the units in Mechanical as the base parameters the force is being calculated off is from mechanical.

Regards,
Sandeep

  • Liked by
  • adamkovacs1126
adamkovacs1126 posted this 23 October 2018

Hi Sandeep,

thanks very much for your answer, I guess I just misunderstood your previous comments when I thought that ANSYS only measures the normal component of the contact forces. Is there any easy way I can find the normal unit vector for the given contact force or should I just take two point vector probes on one of the rigid bodies for all time steps to calculate the angle of contact and from that the normal vector? As we are talking about rotation about one axis, we can handle the problem as 2D:

Thanks again and kind regards,

Adam

Close