Simulation in Physics

We meet today for an article of a new genre that could interest you all the more if you are a physics student or just passionate about computers. When we talk to you about physics, you most certainly have in mind some good books on theoretical physics or treatises known as ” Principia ” by Newton or even ” On the electrodynamics of bodies in motion ” by Einstein or even physicists known theorists like Stephen Hawking or even Richard Feynmanwhose theoretical works are recognized worldwide …. And you tell yourself that you probably need a huge amount of knowledge in mathematics to be able to accurately model the many physical phenomena around us and that seemingly simple movements are actually very hard to represent analytically.

What if I told you not? Or rather that there are very many ways to get around (more or less) mathematics in physics by giving all the hard work to your computer? Well know that this is an extremely common practice in physics, when it is not possible to solve an equation or a complicated system which models a complex physical phenomenon, we enter all that into a program and the computer does everything the rest

I’m going to show you how we do this with a simple example: an object launched into the air . For those who have already done physics in high school (at least in Terminale S) you know that it is easy to find the equations of movement of an object launched in the air then to show you all the power of computer use we will have fun adding a lot of parameters that would make the calculation rather complicated

How does the computer work?

Before moving on to the simulations, I need to explain a few things about your computer to you.

First of all, you have to know that the computer cannot do mathematics as we know how to do it. All he can do is add, subtract, divide and multiply numbers. You then have to create algorithms that use basic computer operations to perform more complex ones. Then, you should know that your computer only works by making increments of a certain value, basically, it does not know the real set but it knows the natural numbers. It’s by using all of these features that you can do all kinds of cool things

A simple example: Throwing it

The objective of this article is actually to introduce this new category dedicated to modeling and simulation in physics. In the following will follow examples of much more complicated phenomena but to start we will start with a simple phenomenon: The trajectory of a point object launched with a certain initial speed.

The theory :

Consider an object of mass $ m $ which would be launched from the ground ( x = 0 , y= 0 )(x=0,y=0) with a certain initial speed given by v⃗ = (v0 x,v0 y)v→=(v0x,v0y) or v0 x=v0c o s ( α )v0x=v0cos(α) and  v0 y=v0s i n ( α )v0y=v0sin(α)v0v0 is the initial speed of the object (m .s-1m.s−1) and αα is the launch angle expressed in radians.

As in any problem of Newtonian dynamics, we write the equations of motion:

mat⃗ = mg⃗ ma→=mg→

⎛⎝⎜d2xdt2d2ydt2⎞⎠⎟= (0- g)(d2xdt2d2ydt2)=(0−g)

Finally, solving this system gives us:

  • ( t ) =v0 xt +x0x(t)=v0xt+x0
  • y( t ) = -12gt2+v0 yt +y0y(t)=−12gt2+v0yt+y0

We can then deduce all the characteristics of the movement such as the trajectory for example. In this case, the equations of motion are very simple to solve but there are situations where they are almost impossible to solve analytically, so let’s see how we can do it by computer.

Computer resolution:

In order to solve the equations of motion by computer, they must be discretized. That is to say that we will ask the computer to solve them step by step. For that it is necessary to express in discrete form the expression of the acceleration. You probably remember the mathematical definition of a derivative at a point:

  • Is f( x )f(x)a function defined on RR, we define the derivative of ff in x0∈ Rx0∈R as follows :

f′(x0) =limx -x0→ 0f( x +x0) – f( x )x -x0f′(x0)=limx-x0→0f(x+x0)-f(x)x-x0

If we apply this definition to and in the sense of discretization we obtain:x ( t )x(t)y( t )y(t)

  • dxdt(t0) =x ( t -t0) – x ( t )t -t0dxdt(t0)=x(t-t0)-x(t)t-t0and dydt(t0) =y( t -t0) – y( t )t -t0dydt(t0)=y(t-t0)-y(t)t-t0

By repeating this operation a second time, we obtain the discrete expression of the second derivative of and :x ( t )x(t)y( t )y(t)

  • d2xdt2(t0) =x ( t – 2t0) – 2 x ( t -t0) + x ( t )( t -t0)2d2xdt2(t0)=x(t-2t0)-2x(t-t0)+x(t)(t-t0)2and d2ydt2(t0) =y( t – 2t0) – 2 y( t -t0) + y( t )( t -t0)2d2ydt2(t0)=y(t-2t0)-2y(t-t0)+y(t)(t-t0)2

We can, to make it simpler, rewrite these expressions by expressing and not as functions but as sequences of numbers; this is equivalent to replacing with an index and becomes . These expressions will be useful throughout the rest of the article:xxyyttiit +t0t+t0i+1i+1

  • Speed: andvxi=xi−1−xiΔtvxi=xi−1−xiΔtvyi=yi−1−yiΔtvyi=yi−1−yiΔt
  • Acceleration: andaxi=xi−2−2xi−1+xi(Δt)2axi=xi−2−2xi−1+xi(Δt)2ayi=yi−2−2yi−1+yi(Δt)2ayi=yi−2−2yi−1+yi(Δt)2

Finally, the equations of motion in the case of an object launched into the air give something of the following form:

  • xi−2−2xi−1+xi(Δt)2=0xi−2−2xi−1+xi(Δt)2=0and where is the acceleration of gravity.yi−2−2yi−1+yi(Δt)2=−gyi−2−2yi−1+yi(Δt)2=−gg=81m.s−2g=9.81m.s−2

Then we just have to send the instructions to the computer so that it compiles the algorithm and returns the result to us. Here is what you get when you launch a point object with an initial speed and for three different angles to the vertical:v0=5 m.s−1v0=5 m.s−1

We see that when an object is launched at 5 meters per second with an angle between 30 ° and 60 °, it always falls to  and from the place of launch. But 5 meters per second is not much, let’s see what happens with a pistol bullet thrown at 300 meters per second.2.25m2.25m2.7m2.7m

Whatever angle the ball is fired at, it still drops extremely far. Almost 9 km if it is drawn at an angle of 45 °! This is not very realistic, and for good reason, we did not take into account the friction of the air. In reality, our equations of motion have rather the following form:

a⃗ =g⃗ −αmv⃗ 2v⃗ va→=g→−αmv→2v→v

where is the coefficient of friction of the air, the mass of our object and its speed. In the same way as earlier we can discretize our equation system to make them readable by the computer:ααmmv⃗ v→

  • xi−2−2xi−1+xi(Δt)2+αm(xi−1−xiΔt)2=0xi−2−2xi−1+xi(Δt)2+αm(xi−1−xiΔt)2=0
  • yi−2−2yi−1+yi(Δt)2+αm(yi−1−yiΔt)2=−gyi−2−2yi−1+yi(Δt)2+αm(yi−1−yiΔt)2=−g
  • Here . I obtained this value of the coefficient of friction after making large approximations because the problem is much more complicated than it seems. And assume that the ball weighs 50 grams.α=42×10−6SIα=3.42×10−6 SI

The results are amazing!

 

We see that the ball falls only a few tens of meters from our starting point while without air, it fell several kilometers! This result does not seem very realistic either, it seems that the air friction are too intense, the term friction seems inappropriate, you can try to replace it with a term of more “soft” friction: . We then obtain the following result.−αv⃗ 2v⃗ v−αv→2v→v−αv⃗ −αv→

 

We see that the trajectories are almost the same as in the case where there is no air. Indeed the coefficient of friction of the air is very low and has practically no influence when the force of friction is expressed as because the speed of the object is too high. It is therefore the first friction model which is the most realistic.≈10−6SI≈10−6SI−αv⃗ −αv→

And if now we had fun adding wind horizontally in the opposite direction to the movement of our object? For this we must add a term “forcing” in the equation associated with the abscissa. However to put it simply, we will say that the force exerted by the wind on the object is the same regardless of the speed, shape or mass of it. We will write the system:

a⃗ =g⃗ −αmv⃗ −f⃗ a→=g→−αmv→−f→ or f⃗ ey→=0f→ey→=0

Finally for winds of force 1, 5, 7 and 15 Newtons respectively and knowing that the ball weighing 50 grams was launched with an angle of 45 ° at a speed we obtain the following trajectories which seem quite realistic.V0=3m.s−1V0=3m.s−1

The object is launched to the right, so we recognize the different trajectories associated with winds of different strength. We even see that in the case of a force of 15 N, the ball turns back the way carried by the wind.

 

We have seen many different ways of modeling a physical phenomenon.While writing this article I realized how difficult it is to precisely model a phenomenon. When we look a little further in precision, we quickly realize that the models taught in school are only valid in very specific cases. The two expressions of the force of friction of the air against the ball are rough approximations which depend on many different parameters starting with the speed, the geometric shape, the material composition, and incidentally the temperature. The expression that I gave you of the force exerted by the wind on my mobile is also very approximate because it depends not only on the same parameters as those on which the friction depends but in addition the wind is not necessarily constant in the time and space,

All this to tell you that modeling a phenomenon is something very complicated and that from an analytical point of view mathematics is picking up. The vast majority of computers are used to model this kind of complex phenomenon.

Here we are at the end of this article, in the following I will publish new articles in order to model other more or less known physical phenomena which are not so obvious to analyze mathematically. On those I hope you liked this article, if it is the case tell me, do not hesitate to comment and share this article around you

 

Leave a Comment