What Are Contacts In ANSYS?

Contacts and joints are usually created using the ANSYS APIs. Some of the options are pretty straightforward and they don't deviate much from what we have already studied till now.

What Are Contacts In ANSYS?

Contacts and joints are usually created using the ANSYS APIs. Some of the options are pretty straightforward and they don't deviate much from what we have already studied till now. Basically, contacts and joints are helpful in transferring the forces from one end to the other in case of an assembly of components involving motion. Let's look into some of the nooks and corners of the contacts and joints APIs.

How To Create A Contact/Joint in ANSYS?

To create a Contact or joint, the very first code is,

Code 1: Contacts=ExtAPI.DataModel.Project.Model.Connections.AddConnectionGroup()

Under this connection tag only, each and every connection group is put together.

Now, using code 1, only the connection group gets created and not a contact region. So, if one has to create a contact region, then he/she should use,

Code 2: Contacts=ExtAPI.DataModel.Project.Model.Connections.AddConnectionGroup().AddContact Region()

Running the above code creates a connection group and also a contact region is shown below,

One can also directly write it as,

Code 4: Contacts=ExtAPI.DataModel.Project.Model.Connections.AddContact Region()

This will also automatically create a connection group and a contact region.

Now, if you try to run the above code once again, then the new contact region is created with a connection group. The new contact region will not get automatically created inside the already existing connection group as shown below,

To avoid this issue, call the contact region by mentioning the children of the connection under which you wish to create a new contact. It can be done by using the following,

Code 5: Contacts=ExtAPI.DataModel.Project.Model.Connections.Children[0].AddContact Region()

A new contact region has been created inside the first connection group under the connections tag. This is based on the fact that each and every entity present in the outline window is considered a ‘List’.

Now, the same goes for creating joints as well,

Code 6: Contacts=ExtAPI.DataModel.Project.Model.Connections.AddJoint()

The catch here is that joints cannot be created inside the connection group where contact is created. Joints require a separate connection group and the contact region requires a separate connection group. So care must be taken when going forward with joint creation.

Now, Let's see how to define some of the constants that are present inside the contact region, here is a new connection group with a contact region is created and to that contact region we are defining the contact type to be ‘Frictional’

Code 7: c=ExtAPI.DataModel.Project.Model.Connections.AddContactRegion()

c1=ExtAPI.DataModel.Project.Model.Connections.Children[0]

d=c1.Children[0]

d.ContactType=ContactType.Frictional

The first line of the code instructs to create a new contact region. The second line is to call and define the children present below the ‘Connections’ tag which is nothing but the connection group. The third line is to call and define the contact region present inside the connection group. The fourth line is to assign the Frictional contact type for the contact region created as shown below in the image.

In the same way, one can define the other constants as mentioned below. Some of the important constants are behaviour, formulation, interface treatment, Friction coefficient (if the contact is frictional).

Code 8: d.ContactType=ContactType.Frictional

Code 9: d.Behavior=ContactBehavior.ProgramControlled

Code 10: d.InterfaceTreatment=ContactInitialEffect.AdjustToTouch

Code 11: d.ContactFormulation=ContactFormulation.AugmentedLagrange

Code 12: d.ContactFormulation= ContactFormulation.PurePenalty

Code 13: d.UpdateStiffness = UpdateContactStiffness.EachIteration

In a similar manner, the constants in the joints can be defined as mentioned below,

c1=ExtAPI.DataModel.Project.Model.Connections.AddJoint()

c2=ExtAPI.DataModel.Project.Model.Connections.Children[1]

d1=c2.Children[1]

Code 14: d1.Type=JointType.Cylindrical

Code 15: d1.ConnectionType=JointScopingType.BodyToGround

Code 16: d1.ConnectionType=JointScopingType.BodyToBody

Now comes the important part of assigning the target and source faces. This can be easily carried out if a named selection has been created for the contact surfaces. The input required for the source and target location is the string, so just by calling the named selection, one can easily assign it to the contact or joints. Let's consider the faces have been already assigned a Named selection, Follow as shown below,

NS=ExtAPI.DataModel.Project.Model.NamedSelections

NS1=NS.Children[0]

NS2=NS.Children[1]

Code 17: d.TargetLocation=NS2

Code 18: d.SourceLocation=NS1

If joints are defined,

Code 19: d1.ReferenceBody=NS2

Code 20: d2.MobileBody=NS1

Want this on your résumé?

Talk to a counsellor.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.