[关闭]
@zy-0815 2016-10-16T22:37:26.000000Z 字数 10132 阅读 1127

张梓桐 第五次计算物理

1 Problem

With the base of Page 34 on textbook.I fantastically consider the track of an cannon shell with air resistance,density of air(both aidabatic and isothermal approximation),and the variation of gravity via altitude.

2 Abstract

In this passage,we are going to talk about the different factors that may have effects on the movment of a cannon shell by Euler method.

3 Background Introduction

Acquiring from the previous knowledge of the Euler applied into the Computational Physics,we now can conclude more relastic factors into the movement of a cannon shell.
Now I still want to stress the importance of Euler method in the projectile movement:


It seems impossible to use the Euler method as there's a order two differentiation.But as we substitute the variables,the solution appears above the fog clearly:


Here we change this into finite difference form:


Now we already have the basic knowldege of projectile movement,next we want to focus on the different factors that affect the solution:

3.1 Resistance:

There will add one extra term in each equation of velocity:


3.2 Effects of altitude on air density:

3.2.1 The isothermal situation:

3.2.2 The aidabatic situation:


The effect of altitude on air density is determined by:

3.3 Effects of altitude on gravation:

With the law of Newton,


Hence:

where is the gravational constant, is the mass of earth, is the radius of earth, and is the hight of object.

4 Main body

4.1 The movement with(without) resistance

  1. import pylab as pl
  2. import math
  3. class projectile():
  4. def __init__(self,time_step=0.1,total_time=10,intial_velocity_x=50,\
  5. intial_velocity_y=50, intial_x=0,intial_y=0,mass=10,B2=0.001,B1=0.001):
  6. self.v_x=[intial_velocity_x]
  7. self.v_y=[intial_velocity_y]
  8. self.v=[math.sqrt(pow(intial_velocity_x,2)+pow(intial_velocity_y,2))]
  9. self.x=[intial_x]
  10. self.y=[intial_y]
  11. self.dt=time_step
  12. self.time=total_time
  13. self.m=mass
  14. self.B2=B2
  15. self.B1=B1
  16. self.intial_velocity_x=intial_velocity_x
  17. self.intial_velocity_y=intial_velocity_y
  18. def run(self):
  19. _time=0
  20. while(_time<self.time):
  21. self.v.append(math.sqrt(pow(self.v_x[-1],2)+pow(self.v_y[-1],2)))
  22. self.v_x.append(self.v_x[-1]-(self.B2/self.m)*self.v[-1]*self.dt*self.v_x[-1])
  23. self.x.append(self.v_x[-1]*self.dt+self.x[-1])
  24. self.v_y.append(self.v_y[-1]-10*self.dt-(self.B1/self.m)*self.v[-1]*self.dt*self.v_y[-1])
  25. self.y.append(self.v_y[-1]*self.dt+self.y[-1])
  26. _time+=self.dt
  27. def show_results(self):
  28. pl.plot(self.x,self.y,label='angle is %f'%(math.atan(self.intial_velocity_y/self.intial_velocity_x)*180/math.pi))
  29. pl.ylim(0,)
  30. pl.title('With resistance')
  31. pl.show
  32. pl.legend()
  33. a=projectile()
  34. a.run()
  35. a.show_results()

To obtain the movement withoud we only need to set and equal 0.And that becomes the ideal situation.

4.2 Movement with isothermal effect and resistance.

  1. import pylab as pl
  2. import math
  3. class projectile():
  4. def __init__(self,time_step=0.1,total_time=10,intial_velocity_x=50,\
  5. intial_velocity_y=50, intial_x=0,intial_y=1,mass=10,B2=0.001,B1=0.001,F_0=5):
  6. self.v_x=[intial_velocity_x]
  7. self.v_y=[intial_velocity_y]
  8. self.v=[math.sqrt(pow(intial_velocity_x,2)+pow(intial_velocity_y,2))]
  9. self.x=[intial_x]
  10. self.y=[intial_y]
  11. self.dt=time_step
  12. self.time=total_time
  13. self.m=mass
  14. self.B2=B2
  15. self.B1=B1
  16. self.F_0=F_0
  17. self.intial_velocity_x=intial_velocity_x
  18. self.intial_velocity_y=intial_velocity_y
  19. def run(self):
  20. _time=0
  21. while(_time<self.time):
  22. self.v.append(math.sqrt(pow(self.v_x[-1],2)+pow(self.v_y[-1],2)))
  23. self.v_x.append(self.v_x[-1]-\
  24. (self.B2/self.m)*self.v[-1]*self.dt*self.v_x[-1]-\
  25. self.F_0*pow(math.e,-self.y[-1]/self.y[0])*self.dt*self.v_x[-1]/(self.m*self.v[-1]))
  26. self.x.append(self.v_x[-1]*self.dt+self.x[-1])
  27. self.v_y.append(self.v_y[-1]-10*self.dt-\
  28. (self.B1/self.m)*self.v[-1]*self.dt*self.v_y[-1]-\
  29. self.F_0*pow(math.e,-self.y[-1]/self.y[0])*self.dt*self.v_y[-1]/(self.m*self.v[-1]))#isothermal term#
  30. self.y.append(self.v_y[-1]*self.dt+self.y[-1])
  31. _time+=self.dt
  32. def show_results(self):
  33. pl.plot(self.x,self.y,label='angle is %f'%(math.atan(self.intial_velocity_y/self.intial_velocity_x)*180/math.pi))
  34. pl.ylim(0,)
  35. pl.title('With resistance and isothermal altitude effect')
  36. pl.show
  37. pl.legend()
  38. a=projectile()
  39. a.run()
  40. a.show_results()

Here you can see,the main differnece is in the 'run' classes,we change the fomula of and.

4.3 Movement with adbiatic effect and resistance.

  1. import pylab as pl
  2. import math
  3. class projectile():
  4. def __init__(self,time_step=0.1,total_time=10,intial_velocity_x=50,\
  5. intial_velocity_y=50, intial_x=0,intial_y=1,mass=10,B2=0.001,B1=0.001,F_0=5,alpha=2.5,a=0.0025,T_0=273):
  6. self.v_x=[intial_velocity_x]
  7. self.v_y=[intial_velocity_y]
  8. self.v=[math.sqrt(pow(intial_velocity_x,2)+pow(intial_velocity_y,2))]
  9. self.x=[intial_x]
  10. self.y=[intial_y]
  11. self.dt=time_step
  12. self.time=total_time
  13. self.m=mass
  14. self.B2=B2
  15. self.B1=B1
  16. self.F_0=F_0
  17. self.alpha=alpha
  18. self.a=a
  19. self.T_0=T_0
  20. self.intial_velocity_x=intial_velocity_x
  21. self.intial_velocity_y=intial_velocity_y
  22. def run(self):
  23. _time=0
  24. while(_time<self.time):
  25. self.v.append(math.sqrt(pow(self.v_x[-1],2)+pow(self.v_y[-1],2)))
  26. self.v_x.append(self.v_x[-1]-\
  27. (self.B2/self.m)*self.v[-1]*self.dt*self.v_x[-1]-\
  28. self.F_0*pow(1-self.a*self.y[-1]/self.T_0,self.alpha)*self.dt*self.v_x[-1]/(self.m*self.v[-1]))
  29. self.x.append(self.v_x[-1]*self.dt+self.x[-1])
  30. self.v_y.append(self.v_y[-1]-10*self.dt-\
  31. (self.B1/self.m)*self.v[-1]*self.dt*self.v_y[-1]-\
  32. self.F_0*pow(1-self.a*self.y[-1]/self.T_0,self.alpha)*self.dt*self.v_y[-1]/(self.m*self.v[-1]))#isothermal term#
  33. self.y.append(self.v_y[-1]*self.dt+self.y[-1])
  34. _time+=self.dt
  35. def show_results(self):
  36. pl.plot(self.x,self.y,label='angle is %f'%(math.atan(self.intial_velocity_y/self.intial_velocity_x)*180/math.pi))
  37. pl.ylim(0,)
  38. pl.title('With resistance and adiabatic altitude effect. ')
  39. pl.legend()
  40. pl.show
  41. a=projectile()
  42. a.run()
  43. a.show_results()

Now take a look into the adiabatic,which is also a more precis situation of relastic situation,the formula is even mor complicated.

4.4 Movement with both aidabtic and gravational effect.

  1. #For the calculation of graviety we use the formula:g(h)=\frac{GM}{(h+re)^{2}} to
  2. #calculate,G means the gravational constant,M means the mass of sun,re is the raius of earth#
  3. #For convenience,GM=4.03^10^13,re=6.371*10^6#
  4. #Replace g=10 with g=(4.03*pow(10,14)/pow((self.y[-1]+6.371*pow(10,6)),2))#
  5. import pylab as pl
  6. import math
  7. class projectile():
  8. def __init__(self,time_step=0.1,total_time=10,intial_velocity_x=50,\
  9. intial_velocity_y=50, intial_x=0,intial_y=1,mass=10,B2=0.001,B1=0.001,F_0=5,alpha=2.5,a=0.0025,T_0=273):
  10. self.v_x=[intial_velocity_x]
  11. self.v_y=[intial_velocity_y]
  12. self.v=[math.sqrt(pow(intial_velocity_x,2)+pow(intial_velocity_y,2))]
  13. self.x=[intial_x]
  14. self.y=[intial_y]
  15. self.dt=time_step
  16. self.time=total_time
  17. self.m=mass
  18. self.B2=B2
  19. self.B1=B1
  20. self.F_0=F_0
  21. self.alpha=alpha
  22. self.a=a
  23. self.T_0=T_0
  24. self.intial_velocity_x=intial_velocity_x
  25. self.intial_velocity_y=intial_velocity_y
  26. def run(self):
  27. _time=0
  28. while(_time<self.time):
  29. self.v.append(math.sqrt(pow(self.v_x[-1],2)+pow(self.v_y[-1],2)))
  30. self.v_x.append(self.v_x[-1]-\
  31. (self.B2/self.m)*self.v[-1]*self.dt*self.v_x[-1]-\
  32. self.F_0*pow(1-self.a*self.y[-1]/self.T_0,self.alpha)*self.dt*self.v_x[-1]/(self.m*self.v[-1]))
  33. self.x.append(self.v_x[-1]*self.dt+self.x[-1])
  34. self.v_y.append(self.v_y[-1]-(4.03*pow(10,14)/pow((self.y[-1]+6.371*pow(10,6)),2))*self.dt-\
  35. (self.B1/self.m)*self.v[-1]*self.dt*self.v_y[-1]-\
  36. self.F_0*pow(1-self.a*self.y[-1]/self.T_0,self.alpha)*self.dt*self.v_y[-1]/(self.m*self.v[-1]))#isothermal term#
  37. self.y.append(self.v_y[-1]*self.dt+self.y[-1])
  38. _time+=self.dt
  39. def show_results(self):
  40. pl.plot(self.x,self.y,label='angle is %f'%(math.atan(self.intial_velocity_y/self.intial_velocity_x)*180/math.pi))
  41. pl.ylim(0,)
  42. pl.title('With resistance,gravity and adiabatic altitude effect. ')
  43. pl.legend()
  44. pl.show
  45. a=projectile()
  46. a.run()
  47. a.show_results()

Note that the maxium distance can bedetermined by the following code adding to the 'run':

  1. if self.y[-1]<=0 and self.y[-2]>=0:
  2. print "The maxium distance is %f" %self.x[-2]-self.y[-2]*(self.x[-1]-self.x[-2])/(self.y[-1]-self.y[-2])

For the calculation of graviety we use the formula:

tocalculate,G means the gravational constant,M means the mass of sun,re is the raius of earth#
For convenience,,.
Replace with g=(4.03*pow(10,14)/pow((self.y[-1]+6.371*pow(10,6)),2)),we obtain the final solution.

5 Result

5.1 Difference with different angel without resistance

Set the intial velocity being ,with angle being,,,and .figure_2.png-69.9kB

5.2 Difference with or without resistance

With the intial angle being , the mass being , velocity component being . The difference in resistance is shown in the track as:
figure_3.png-39.2kB
It is obvious that the green one is with resistance,and its maxium height and ranges become smaller as the ideal one.In the above figure,we set .

Now we change the parameter,you can see the difference even more clearly.figure_4.png-33.2kB

5.3 Difference with resistance and isothermal effect

We set ,and
figure_5.png-39kB
From the above figure,we see in the isothermal situation,the track changes slightly before the maxium height,but differes greatly after the maxium height.

5.4 Difference with isothermal,adibatic and none effect

Here we set ,
figure6.png-46.2kB
It is evidently that the adiabatic process decrease greatly than the isothermal effect,and shows a characteristic of unsymmertic.

To make the difference even more clearly,I amplify the details to show:
figure_7.png-36.9kB

5.5 Difference with or without gravational variation.

, ,
figure_8.png-43.3kB
As the altitude isn't so high,the gravation constant almost remains constan,which means little variation in the figure,just as we have expected!

5.6 Difference of all

figure_9.png-62.5kB
And the detailed one:
figure_10.png-51.1kB
(In the previous without gravational effect,we set ,so there may be some faluts with the last two rows.)

6 Acknowlegement

1.Matplotlib
2.Computational Physics
3.Tutorial-Chapter 2 Realistic Projectile Motion

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注