[关闭]
@zqbinggong 2016-04-19T04:45:47.000000Z 字数 5234 阅读 1061

the 3D Trajectory of Cannon

        ——with Vpython and easygui

homework of Computational Physics(level2),

张强 2013301020039

!!!(If you have read the sixth homework, you can skip to the part [Results].)

In this modification(16,04,19),I add the easygui to the program so that you can use graphical interfaces to input your arguments.

You can directly jump to the part [Results(with easygui)] to see the exhibition of graphical interfaces.

code

3Dcannon.py

Abstract

The Euler methonds we used to treat the bicycle problem can easily be generalized to deal with motion in two spatial dimentions.To be spoecific, we consider a projectile such as a shell shot by a cannon.We have a very large cannon in mind,and the large size will determine some of the important physics.

Key word

Euler methonds,projectile,air drag,isothermal,adiabatic

Background

The problem ask us to deal with situations in which the target is at a different altitude than the cannon, and consider cases in which the target is highter or lower than the cannon.Also we have to investigate how tge minumum firing velocity required to hit the target varies tas teh altitude of the target is varied;.

Body

1.Projectile motion

1.Kinematic quantities of projectile motion

In projectile motion, the horizontal motion and the vertical motion are independent of each other; that is, neither motion affects the other. This is the principle of ''compound motion'' established by Galileo in 1638.Galileo Galilei, ''[[Two New Sciences]]'', Leiden, 1638, p.249

2.Acceleration
Since there is only in the vertical direction, the velocity in the horizontal direction is constant, being equal to . The vertical motion of the projectile is the motion of a particle during its free fall. Here the acceleration is constant, being equal to g .The g is the Standard gravity|acceleration due to gravity. ( 9.81 m/s^2 near the surface of the Earth) The components of the acceleration are:

3.Velocity
The horizontal component of the [[velocity]] of the object remains unchanged throughout the motion. The downward vertical component of the velocity increases linearly, because the acceleration due to gravity is constant. The accelerations in the x and y directions can be integrated to solve for the components of velocity at any time t , as follows:


The magnitude of the velocity (under the Pythagorean theorem, also known as the triangle law):

4.Displacement

At any time t , the projectile's horizontal and vertical are:


The magnitude of the displacement is:

2.Air Drag

As is mentioned above and will be discussed thoroughly in our codes, air drag force plays a critical role in the shells' trajactory. But engineers have come up ideas of rifling to fight against such impedence.
Rifling is a series of spiral line inside the pipe of fire guns like rifles and cannons. When the shells get out of the pipe pushed by the gunpowder at the end of the bore of a gun, the high temperarure will inflate the shell making it rub with the rifling and spin. Such spin motion will effectively reduce the air drag force.

Air Density Distribution

In the first section we gave the form of air drag force under simple assumptions. Now we come to a stage a little more complex. The force is sill propotional to the density of air. However, the density of air is a decreaseing function of altitude.

Isothermal Condition

The simplest approximation is to treat the atmosphere as an isothermal ideal gas.One then finds that the pressure p depends on altitude according to

Adiabatic condition

The more realistic approach is to assume that the ait is a poor conductor of heat, and that convection is very slow.
The adiabatic approxination leads to a somewhat different dependence of the density on altitude

3. Implementation of the program

1.Firstly,the program ask you to input some parameters such as target coordinate,the effective attack range and the "h",which is used to determine the approximation methonds.For d=0,we consider the isothermal condition and d=1 for adiabatic condition.
2.Then,the program run ,calculate the firing speed and angular.
3.In the end, program draw the 3D trajectory using vpyhton according to the firing speed and angular calculated and outpute the related information.

Results(with easygui)(modified on 16,04,19)

reamrk:I just show the situation1 where hit_area is 10 ,the target is[10000,1000,10000] and the the gas is considered as isothermal gas.

Show some details



Results(without easygui),the old edition

1.

please input the hit_area : 10
please enter the x_component of the target : 10000
please enter the y_component of the target : 10000
plesae enter the z_component of the target : 10000
please enter 0 for isothermal gas or 1 for adiabatic gas : 1
theta: 37.3478897565
initSpeed: 710.409868665

2.

please input the hit_area : 10
please enter the x_component of the target : 10000
please enter the y_component of the target : 10000
plesae enter the z_component of the target : 10000
please enter 0 for isothermal gas or 1 for adiabatic gas : 0
theta: 36.7478897565
initSpeed: 681.75948603

3.

please input the hit_area : 100
please enter the x_component of the target : 100000
please enter the y_component of the target : 1000
plesae enter the z_component of the target : 100000
please enter 0 for isothermal gas or 1 for adiabatic gas : 1
theta: 40.6478897565
initSpeed: 1957.58009383

4.

please input the hit_area : 100
please enter the x_component of the target : 100000
please enter the y_component of the target : 1000
plesae enter the z_component of the target : 100000
please enter 0 for isothermal gas or 1 for adiabatic gas : 0
theta: 40.6478897565
initSpeed: 1957.58009383

Connclusion

1.According to the results,we draw a conclusion that the cannon needs faster speeds and biggsmaller angular on adiabatic condition to hit the same target.

2.The program needs a long time to calculate the firing speed and angular,so you should be patient to wait the outcome information.

3.It is similar to the 2D case. In deed, we just rotate the firing plane around the y-axis by the angular of .

And
is the target coordinates.$

Acknowledgement

Thanks to Liu Wentao for his template.

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