Executive Programs

Workshops

Projects

Blogs

Careers

Student Reviews

More

Informative Articles

Find Jobs

We are Hiring!

All Courses

Choose a category

All Courses

All Courses

10 May 2020

# Comparing the time of recoil in a gun obtained through numerical and analytical methods

Skill-Lync

When a gun is triggered, it will generate a counterforce on the shooter, and this is called a recoil force. This recoiling force is the reaction force to the accelerating bullet and the momentum transfer caused by exploding gasses.

## Main Objective

The objective of this project is to calculate the time of recoil numerically and analytically using ODEs. Using these methods, we can verify the strength of our mathematical model representing a system – In this case, the gun.

## Steps to be done

1. First, we will solve the problem analytically using a Forced Harmonic Oscillator function and plot the velocity vs. time graph.
2. Then we will solve the problem numerically using:
• Runge-Kutta (4,5) method for solving ODEs
• Impulse formulation using a transfer function
3. Compare the results.

To solve the problem numerically, we use MATLAB.

## Solving the system analytically

To represent this system, we use the Forced Harmonic Oscillator function which is of the form,

In our specific case let us assume:

Mass of the gun = 1 kg

Spring coefficient (K) = 2000 N/m

Damping force = 0.1

When you fire the gun, pressure builds up inside the barrel for a short amount of time as the bullet moves from the closed chamber to open. When the bullet exits the gun, the force falls. This force that acts for a short duration is called as pulse function. This pulsing function reacts by causing the gun to recoil and we going to calculate the recoil time. Let us assume that this pulse function lasts for 0.7 milliseconds. So the ODE can be broken into 2 parts when the pulsing function is present and when it is not present,

Solution for the first part of equation is,

To find the solution to the next part of the combined D.E, the x(0.7 msec) and x’(0.7 msec) needs to be found.

Solution for 2nd part of equation,

Plot of the function is as follows,

The combined equation for the system

Plot of the function is as follows,

Distance vs time plot (pulse forcing function).

And the duration of the recoil cycle is approximately 0.0133 seconds.

### Solving the system numerically:

Now that the result has been attained using an analytical method, the next step will be to verify the results using 2 numerical models:

1. Runge-Kutta (4,5) method for solving ODEs
2. Impulse formulation using a transfer function

### Runge-Kutta(4,5) – ODE 45 Method using MATLAB

Range-Kutta(4,5) method is a numerical method which uses higher order Taylor series approximation to predict the solution of the ODE. (4,5) refers to the fact that the equation uses up to fourth order Taylor series to approximate the numerical scheme.This method is an explicit numerical integration and is inherently more accurate than lower order schemes. However, the input equation to be solved should be given as a set of first order coupled equations.

Screen capture from MATLAB with code, execution and velocity and displacement plots.

From here it can be observed that the time for recoil is approximately 0.013 sec.

## Impulse formulation using a transfer function

To further verify the solution, it would also be beneficial to show that the results are consistent and converge. This can be proved using the impulse dynamic system model.

The Impulse solver is a tool/function offered by MATLAB. It takes in information about the system in the form of its transfer function and subjects it to an impulse at any given time instant and measures its response afterwards. The answer is formulated in the form,

From here it is observed that the time of recoil is found to be approximately 0.013 sec.

Result:

The results from the various analysis can be compared with regards to time and interpreted,

 Name of methodology used Time of recoil Analytical (pulse forcing function) 0.0133 Numerical (ODE solver analysis) 0.013 Dynamic system (impulse function) 0.013

As you can see here, the solutions obtained are approximately equal.

#### Conclusion:

From here it is clear that the ODE representing our system is robust since the results are very consistent. From the results, you can deduce that the time of recoil calculated analytically is more accurate, giving a solution up to four decimal places. One might ask, why then do we use numerical methods?

The answer is quite simple – solving an equation analytically is complex as compared to numerical methods. In numerical methods, you solve an equation by finding one approximated value and then proceed to the next step to find the next value. This is repeated until we arrive at the desired value. This is called a time-marching. In analytical methods, you derive a function or a formula and substitute the variable with the necessary values to find the desired result. You don’t have to find a string of preceding values but rather jump straight to the desired point. While this sounds easy, the catch is that deriving the function to solve analytically is a complicated process, and in some cases, deriving a function would be impossible. Some ODEs/PDEs cannot be solved analytically. In such cases, numerical methods are more convenient.

Let us assume that you are designing a gun with minimal recoil force. To create such a gun, you will have to calculate the different recoil velocities to see which value will work efficiently. Doing this by analytical methods will consume a lot of time but numerically, you can just change the value in the code and you will be able to analyse different values in a matter of minutes. This is another major reason why numerical methods are preferred widely.

Author

SugavaneshM

Author

Skill-Lync

Related Blogs

A Guide to Help FEA Engineers Get Started With Vehicle Dynamics - Part 1

Explore the fundamentals of vehicle dynamics and ultimate trends in the field from design and modeling to control with Skill Lync's exclusive course on the subject. Read about how Skill-Lync's CAE courses can help you get employed.

29 Jul 2020

How Using GT-Power in CFD Can Benefit the Automation Industry

In this article, we will briefly discuss the working, applications, and features of the one-dimensional systematic simulation tool, GT-Power, in Emission Control Strategy, engine calibration, hybrid vehicle modeling. Read about how Skill-Lync's CAE courses can help you get employed.

29 Jul 2020

Design Basics of Geometric Dimensioning and Tolerancing

This article offers a brief introduction to the globally accepted standard of Geometric Dimensioning and Tolerancing, and its importance for the entire manufacturing process. Read about how Skill-Lync's CAE courses can help you get employed.

29 Jul 2020

Chapter 5 – Going a step into Biomechanics

10 May 2020

The Basics of the Powertrain NVH: Part 2

The powertrain is the most prominent source of vibrations that affects the driving experience for the people on board. This blog from Skill-Lync examines these vibrations to help enhance that experience.

22 Aug 2020

Author

Skill-Lync

Related Blogs

A Guide to Help FEA Engineers Get Started With Vehicle Dynamics - Part 1

Explore the fundamentals of vehicle dynamics and ultimate trends in the field from design and modeling to control with Skill Lync's exclusive course on the subject. Read about how Skill-Lync's CAE courses can help you get employed.

29 Jul 2020

How Using GT-Power in CFD Can Benefit the Automation Industry

In this article, we will briefly discuss the working, applications, and features of the one-dimensional systematic simulation tool, GT-Power, in Emission Control Strategy, engine calibration, hybrid vehicle modeling. Read about how Skill-Lync's CAE courses can help you get employed.

29 Jul 2020

Design Basics of Geometric Dimensioning and Tolerancing

This article offers a brief introduction to the globally accepted standard of Geometric Dimensioning and Tolerancing, and its importance for the entire manufacturing process. Read about how Skill-Lync's CAE courses can help you get employed.

29 Jul 2020

Chapter 5 – Going a step into Biomechanics

10 May 2020

The Basics of the Powertrain NVH: Part 2

The powertrain is the most prominent source of vibrations that affects the driving experience for the people on board. This blog from Skill-Lync examines these vibrations to help enhance that experience.

22 Aug 2020

Related Courses

MATLAB Python and CFD using Solidworks for Mechanical Engineering Applications
4.7
13 Hours of content
Cfd Domain
4.7
149 Hours of content
Cae Domain
4.7
5 Hours of content
Cfd Domain
4.8
19 Hours of content
Cae Domain
4.7
3 Hours of content
Cae Domain
4.8
37 Hours of content
Cae Domain
Recently launched
2 Hours of content
Cae Domain
Recently launched
0 Hours of content
Cae Domain
Showing 1 of 13 courses