# Simulating complex physics with Simcenter Amesim

Our recent simulation in Simcenter Amesim of a free kick illustrates how the software can model complex physics beyond standard applications, emphasizing custom modeling approaches.

## Modelling approaches

First it is good to know what approaches could be used in Simcenter Amesim. Below image shows how an example of an hydraulic check valve can be modelled with different approaches

1.       Functional component
A built in component that simulates the function of the check valve, without looking at detailed physics.

2.       Physical components
Built in components that simulate the involved physics to cause the function.

3.       Mathematical approach
If we know how the express the physics using analytical formulas, we can use the control&signal library to apply these formulas.

4.       Programming
If we have the knowledge required for the mathematical approach and have some programming experience, we can also use C-code to create a custom submodel.

5.       Miscellaneous
There are of course several other approaches available, from using a neural network, transfer functions, response surfaces, or co-simulations with external software(e.g. FMU, Simulink, CFD, FEM, python)

Each option has its use cases, in this example we will use a combination of 2 & 3. We will use physical components where available, to limit the amount of mathematics we have to do ourselves.

## Modelling – 3D mechanics

Since football can be simplified to a multibody simulation, we can make use of the 3D mechanical library. We use an assembly manager component to view our setup in 3D space, then add our ball simply as a 3D body.

By making use of the various sphere contacts, we can model the wall (sphere to box contact), the field (sphere to plane contact) and goal (sphere to cylinder for posts/crossbar, sphere to plane for the netting). We know we want to add wind and magnus force, so we already add a signal to force component with some constant inputs of 0N & 0Nm and deal with the formulas later.

Check the Assembly manager to check the parameters for our 3D mechanical components in 3D space.

## Modelling – Custom Physics

With the main part of the model done, the next step is to add our custom physics of the magnus forces. We use the following formula:

Our formula has some constants that we will let the user specify , which we can add to the global parameters to make them easily accessible and reusable throughout the model. The variables  will need to be extracted from the model. We can place some sensors between the force and the ball to measure its rotational and translational velocity.

We can extract the X,Y and Z components from these velocities and use them as inputs for an expression component. We define the formulas for the three outputs (Fx, Fy, Fz) as functions of the 6 inputs

We can subtract the wind velocity from the ball velocity, and repeat the magnus force approach for calculating the drag forces and moments and connect everything together and apply the resulting force and moment components to the center of our football.

## Modelling – Extended Physics

But what if the physics components you need are inside Amesim, but you want to add your own functionality. An example could be adding a more suitable friction model to our contact with the field.

Rather than using the friction models inside the sphere to plane contact, we can set that friction to zero and add a friction force/moment that we calculate ourselves.

The calculation of these are functions of the translational and rotation velocity components, and a height function to make sure the force is 0 when there is no contact.

## Reusing custom components

Now that we have defined all the physics, we can clean up our model. We can combine components into supercomponents. This allows us to group all our components used for the calculations behind a single component and chose parameters and variables to make easily accessible. We can still access the sketch behind the supercomponent, but will not need to dig through all of those to find the parameter we want to change.

Optionally, we can create some display icons for our supercomponents, save them to a custom library so that we can reuse them in other models, and encrypt them so that we can share them with external parties without revealing our proprietary methods (hiding the sketch behind the supercomponent).

## Postprocessing

Now we have a model that we can run. Results can be postprocessed using graphs, but since we used the assembly manager, we also have an easy way of animating the results.

This will give a much better visualization of what is going on, without having to do much work.
One last optional step is to add some 3D models to the animation, these will purely be used for the visualization. The results of which can be seen in the LinkedIn post

## Conclusion

Hopefully this article has shown how even something as novel as a football free kick, still lends itself well to simulations. While there is no ready made library to use, we can create our own library of our own physics. What makes this possible is clever use of already available components and a good understanding of the physics that still need to be added.

The approach taken in this article is of course not limited to a freekick simulation. A similar approach can be taken to simulate almost anything. From plasma systems, vacuum systems, production plants, or even a different sport.

If you have a problem that needs simulating, or want some help with creating your own library, do not hesitate to get in touch with us below.

July 9, 2024
get in touch