Project

Breaking Ice with Air Cushion Vehicle - Find Minimum Pressure with Newton-Raphson Method in PYTHON

Breaking Ice with Air Cushion Vehicle - Find Minimum Pressure with Newton Raphson Method

Newton Raphson Method

  • The Newton-Raphson method (also known as Newton's method) is a way to quickly find a good approximation for the root of a real-valued function f(x) = 0.
  • It uses the idea that a continuous and differentiable function can be approximated by a straight line tangent to it. It tries to linearise the function
  • It is an Iterative Method.
  • It is a major tool to find the roots of the Non-Linear Functions.
  • It tries to find the value of x when the function f(x) evaluates to 0.

Suppose if you need to find the root of a continuous, differentiable functionf(x), and you know the root you are looking for is near the point x = x_0. Then Newton's method tells us that a better approximation for the root is,

This process may be repeated as many times as necessary to get the desired accuracy. In general, for any x-value x_n​, the next value is given by

Draw a tangent line to the graph of f(x) at the point x = x_n​. This line has slope f'(x_n) and goes through the point (x_n, f(x_n)).

  • Assumption/Guessing of the initial value is the Primary Criteria in solving the Non Linear Functions.
  • The solution from the n'th iteration serves as the input to (n+1)th iteration.

Objective :

To determine the minimum cushion pressure needed to break a given thickness of ice using an air cushion vehicle.

Given Data :

The Mathematical is as follows,

Where,

p = Cushion Pressure = 150 psi

h = Thickness of the Ice field

r = Size of Air Cushion = 40 feet

σ = Tensile strength of the Ice

β = Width of the Ice Wedge = 0.5

Program :

# minimum pressure to break ice with air cushion vehicle

import math
import matplotlib.pyplot as plt
import numpy as np
from tabulate import tabulate

def f(p,h):
	term1=pow(p,3)*(1-pow(b,2))
	term2=((0.4*h*pow(b,2))-((sigma*pow(h,2))/pow(r,2)))*pow(p,2)
	term3=(pow(sigma,2)*pow(h,4)*p)/(3*pow(r,4))
	term4=pow((sigma*pow(h,2))/(3*pow(r,2)),3)

	F=term1+term2+term3-term4

	return F

def df(p,h):

	term5=3*pow(p,2)*(1-pow(b,2))
	term6=2*p*(0.4*h*pow(b,2)-(sigma*pow((h/r),2)))
	term7=(pow(sigma,2)*pow(h,4))/(3*pow(r,4))

	dF=term5+term6+term7

	return dF

# inputs
r=40
b=0.5
sigma=21600
height=[0.6,1.2,1.8,2.4,3,3.6,4.2]

p_guess=20
tol=1e-4
alpha=1

ct=1

pressure=[]
iterations=[]

for h in height:
	while(abs(f(p_guess,h))>tol):
		p_guess=p_guess-alpha*((f(p_guess,h))/(df(p_guess,h)))

		ct=ct+1

	pressure.append(p_guess)
	iterations.append(ct)

headers=['THICKNESS','ITERATIONS','PRESSURE']
data = tuple(zip(height,iterations,pressure))
print(tabulate(data,headers=headers,tablefmt='pipe'))


# case 2
# to evaluate for the optimum relaxation factor for a given thickness

h=height[0]
tol=1e-4
itr=[]
alpha=np.linspace(0.1,1.9,50)
x=[]

for alp in alpha:
	iter=1
	p_guess=30
	while (abs(f(p_guess,h))>tol):
		p_guess=p_guess - alp*(f(p_guess,h)/df(p_guess,h))
		iter=iter+1

	itr.append(iter)
	x.append(alp)

header = ['alpha','itr']
info = tuple(zip(x,itr))
s=sorted(info)
print(tabulate(info,headers=header,tablefmt='pipe'))

plt.figure()
plt.plot(height,pressure)
plt.xlabel('Thickness')
plt.ylabel('Pressure')
plt.title('Minimum Pressure required against different Thickness')

plt.figure()
plt.plot(alpha,itr)
plt.xlabel('Relaxation Factor')
plt.ylabel('Iterations')
plt.title('Optimization of Relaxation Factor')

plt.show()

Procedure :

  • All the required modules are imported using import comand, math for mathematical functions, matplolib for plotting, numpy for array processing, tabulate for tabulation.
  • Function f and its derivative df are defined according the given equation by splitting up the equation according to feasiblity.
  • Inputs are added according to the given data.
  • Height is an array of different Thickness.
  • Initially Pressure is guessed accordingly p_guess serves as input for further iterations.
  • Tolerance tol is considered because the function while evaluating to zero will inheritly has some minor error.

Relaxation Factor (α) is an primary criteria in arriving to the optimal solution.

  • α=1 is an general case
  • α<1 Under Relaxation case, which is an cautious & steady approach to the solution.
  • α>1 Over Relaxation case , which is a rapid & rigorous which causes overshooting of the solution range.

Case 1 :

To find the minimum pressure for different ice thickness of h = 0.6, 1.2, 1.8, 2.4, 3.0, 3.6, 4.2 feet using relaxation factor of α=1.

By Newton Raphson Method, assume or guess an initial value which fits to be the minimum pressure and it follows iterative method by then,

  • An empty array for pressure and iterations are called to store the values.
  • for loop has been called to take up elements from array height
  • while the absolute value of function f is greater than tolerance then it will calculate the p_guess.
  • ct=ct+1 is used to support the next source of iteration.
  • The value for pressure and iterations are then added in the respective arrays using append comand.
  • tuple is called to store the list of elements, zip is am iterator of the tuple which is used to pair the elements together.
  • The values are printed in table using the tabulate comand and passing the arguments for header and format.

Results for case 1

From case 1, it can be observed that by keeping the Relaxation factor at 1 throughout, the number of iterations is proportional to any of the depending factors like Pressue or the Thickness.

Case 2 :

In this case the height is considered to be constant, and Relaxation factor is selected over a range of under relaxation & over relaxation to find the optimal one.

The idea is to Coverge the solution in as minimum number of iterations.

  • np.linspace is used to create an array of elements.
  • for loop has been defined to evaluate for every value in alpha.
  • while loop has been used to calculate the value of p_guess.
  • tuple is called out in the table to view the results.

Results

From the above graph it can be observed that upto relaxation factor of 1, the solution is converging into minimum number of iterations but beyond that it is overshooting. Hence under-relaxation factor can be an effective tool in approaching to the solution.

References :

____________********************END**********************______________

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.