Project

Newton-Raphson Method- Minimum Pressure To Break Ice with an Air cushion vehicle

OBJECTIVE:- To write a program in PYTHON which Calculates the minimum pressure required to break the given ice using an Air cushion Vehicle by Newton Raphson Method.

AIR CUSHION VEHICLE:-

A hovercraft is an amphibious vehicle also called as \"Air Cushion Vehicle\" which can be operated on water body as well as land. It consists of a hull(also called as skirt) which is made of rubber and is hollow from inside and fans at the back which propel air into it.

The main principle for the operation of the hovercraft is that the fan which is responsible for lifting the vehicle by forcing high pressure air under the craft. The air inflates the \"skirt\" under the vehicle, causing it to rise above the surface. And other engines provide thrust in order to propel the craft.

The air is typically blown through slots or holes around the outside of a disk or oval shaped platform, giving most hovercraft a characteristic rounded-rectangle shape. Typically this cushion is contained within a flexible \"skirt\", which allows the vehicle to travel over small obstructions without damage.

The primary uses of this machine is for transportation purposes by military as well as civilian.

Air cushion vehicle inside mechanism

A TYPICAL AIR CUSHION VEHICLE


And regarding concept cars, it is a car made to showcase new styling or new technology. Concept cars never go into production directly. In modern times all would have to undergo many changes before the design is finalized for the sake of practicality, safety and cost.

NEWTON-RAPHSON METHOD:-

Newton\'s method is also called as the Newton-Raphson method, is a root-finding algorithm that uses the first few terms of the Taylor series of a function \"f(x)\" in the vicinity of a suspected root. Newton\'s method is sometimes also known as Newton\'s iteration, although in this work the latter term is reserved to the application of Newton\'s method for computing square roots. This proces may be repeated as many times as necessary to get the desired accuracy. In our case we set the certain tolerances as condition to stop the iterations.

Mathematical Equation:-

Where,

p = cushion pressure

h = thickness of ice field

r = size of air cushion

sigma = tensile strength of ice

beta related to width of ice wedge

Applying Newton-Raphson method to the equation to find minimum pressure:-

Initial conditions :-

  1. p = 10(initial guess value)
  2. Tolerance = 1e-4.
  3. Alpha = 1 (i.e for first case)

Given parameters:-

1. beta = 0.5

2. r = 40 feet

3. sigma = 150 psi

4. h = [0.6,1.2,1.8,2.4,3.0,3.6,4.2]

Newton-Raphson algorithm:-

We take derivative of the equation and feed it in the algorithm wherever \'f\' is mentioned.

This algorithm iterates until the set tolerance limit is achieved.

MAIN CODE:-

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

#inputs

beta = 0.5
r = 40
sigma = 21600  #(for pound to psi i.e 150*144)
h = 0.6
p = []

def f(p,h):  #breaks eqn into 4 parts
      a1 = pow(p,3)*(1-pow(beta,2))
      a2 = (0.4*h*pow(beta,2)-(sigma*pow(h,2)/pow(r,2)))*p**2
      a3 = pow(sigma,2)*pow(h,4)*p/(3*pow(r,4))
      a4 = pow((sigma*h*h/(3*r*r)),3)
      f1 = a1+a2+a3-a4
      return f1

def fprime(p,h):  #breaks eqn into 3 parts
      b1 = 3*pow(p,2)*(1-beta*beta)
      b2 = 2*p*((0.4*h*beta*beta)-(sigma*h*h/(r*r)))
      b3 = pow(sigma,2)*pow(h,4)/(3*pow(r,4))
      fprime1 = b1+b2+b3
      return fprime1


#Performing N-R Iteration
alpha = 1  # relaxation factor
tol = 1e-4
x_guess = 10
it = []
i = 1
while(abs(f(x_guess,h))>tol):
	   x_guess = x_guess - alpha*(f(x_guess,h)/fprime(x_guess,h))
	   i = i +1
	   p.append(x_guess)
	   it.append(i)
print(i,\'|\',x_guess)

PROCEDURE:-

  1. Import module - math, matplotlib, numpy as np & tabulate them for creating tables.
  2. For coding we have to define 2 functions f(x) i.e \'f\' & f\'(x) i.e \'fprime\'. f(x) is the equation given above and f\'(x) is the derivative of f(x).
  3. f(x) equation breaks into 4 terms and then create function f and simillarly for fprime function.

Finding minimum pressure by taking relaxatio factor as 1 and h=0.6.

  • After importing module, define inputs and create f and fprime function & return values from them.
  • Take Relaxation factor i.e alpha =1.
  • Tolerances as tol = 1e-4.
  • x_guess = 10(x-guess - first guess value of pressure which we assume for the iteration process in N-R method.
  • Use new variable \'it\' for storing the value of no of iterations.
  • For creating table, create header variable for table and give the specific name to the columns.
  • Here the value of h is in array.So for loop is used and then use while loop for calling function and do the N-R iteration for the given input.
  • Use append function for storing values in p and for it arrays.
  • Print values.

Result:-

The minimum pressure value is 4.23906 and it is obtained after 8(eight) iteration for the above equation using Newton Raphson method.

Coding for Print pressure, h values and no.of iteration in a table format.

  • After importing module, define inputs and create f and fprime function & return values from them.
  • Take Relaxation factor i.e alpha =1.
  • Tolerances as tol = 1e-4.
  • x_guess = 10(x-guess - first guess value of pressure which we assume for the iteration process in N-R method.
  • Use new variable \'it\' for storing the value of no of iterations.
  • For creating table, create header variable for table and give the specific name to the columns.
  • Here the value of h is in array.So for loop is used and then use while loop for calling function and do the N-R iteration for the given input.
  • Use append function for storing values in p and for it arrays.
  • Use mydata = tuple(zip(it,h,p)) ; A Tuple is a collection of python objects separated by commas. In some ways a tuple is similar to a list in terms of indexing, nested objects and repitition but a tuple is immutable unlike lists which are mutable. This command is basically used to arrange the values in order.
  • Then, use the print command to print the values in table format by use of mydata and header variable.
import matplotlib.pyplot as plt 
import math
from tabulate import tabulate
import numpy as np 

#inputs

beta = 0.5
r = 40
sigma = 21600  #(for pound to psi i.e 150*144)
h =[0.6,1.2,1.8,2.4,3.0,3.6,4.2]
p = []

def f(p,h):  #breaks eqn into 4 parts
      a1 = pow(p,3)*(1-pow(beta,2))
      a2 = (0.4*h*pow(beta,2)-(sigma*pow(h,2)/pow(r,2)))*p**2
      a3 = pow(sigma,2)*pow(h,4)*p/(3*pow(r,4))
      a4 = pow((sigma*h*h/(3*r*r)),3)
      f1 = a1+a2+a3-a4
      return f1

def fprime(p,h):  #breaks eqn into 3 parts
      b1 = 3*pow(p,2)*(1-beta*beta)
      b2 = 2*p*((0.4*h*beta*beta)-(sigma*h*h/(r*r)))
      b3 = pow(sigma,2)*pow(h,4)/(3*pow(r,4))
      fprime1 = b1+b2+b3
      return fprime1


#Performing N-R Iteration
alpha = 1  # relaxation factor
tol = 1e-4
x_guess = 10
it = []

headers = [\"iteration\",\"thickness\",\"pressure\"]

for i in h:
      
     iter = 1
     while(abs(f(x_guess,i))>tol):
      x_guess = x_guess - alpha*(f(x_guess,i)/fprime(x_guess,i))
     iter = iter +1
     p.append(x_guess)
     it.append(i)

mydata = tuple(zip(it,h,p))
print(tabulate(mydata,headers=headers, tablefmt=\'grid\'))

Result:-

The below result is the table we get after executing the code above code and shows us the iteration, h-value(thickness) and the p-value(pressure) related dat.

Coding for Find minimum relaxation fctor using graph.

  • After importing module, define inputs and create f and fprime function & return values from them.
  • Take Relaxation factor i.e alpha =1.
  • Tolerances as tol = 1e-4.
  • x_guess = 10(x-guess - first guess value of pressure which we assume for the iteration process in N-R method.
  • Use new variable \'it\' for storing the value of no of iterations.
  • For creating table, create header variable for table and give the specific name to the columns.
  • Here the value of h is in array.So for loop is used and then use while loop for calling function and do the N-R iteration for the given input.
  • Use append function for storing values in p and for it arrays.
  • Use linspace command for alpha value.
  • Create two variables with empty array.
  • Then use for loop for different value of alpha. Find minimum pressure by N-P iteration.
  • Using append function save J and CT arrays.
  • Use tuple command to sort the values and by using sorted command we can find the accurate minimum relaxation factor.
  • Print values.
  • Using plot command plot two graph one in between thickness and pressure and other between relaxation factor and iteration.
  • Using plt.show() command shows the plot.
import matplotlib.pyplot as plt 
import math
from tabulate import tabulate
import numpy as np 

#inputs

beta = 0.5
r = 40
sigma = 21600  #(for pound to psi i.e 150*144)
h =[0.6,1.2,1.8,2.4,3.0,3.6,4.2]
p = []

def f(p,h):  #breaks eqn into 4 parts
      a1 = pow(p,3)*(1-pow(beta,2))
      a2 = (0.4*h*pow(beta,2)-(sigma*pow(h,2)/pow(r,2)))*p**2
      a3 = pow(sigma,2)*pow(h,4)*p/(3*pow(r,4))
      a4 = pow((sigma*h*h/(3*r*r)),3)
      f1 = a1+a2+a3-a4
      return f1

def fprime(p,h):  #breaks eqn into 3 parts
      b1 = 3*pow(p,2)*(1-beta*beta)
      b2 = 2*p*((0.4*h*beta*beta)-(sigma*h*h/(r*r)))
      b3 = pow(sigma,2)*pow(h,4)/(3*pow(r,4))
      fprime1 = b1+b2+b3
      return fprime1


#Performing N-R Iteration
alpha = 1  # relaxation factor
tol = 1e-4
x_guess = 10
it = []


for i in h:
      
   iter = 1
   while(abs(f(x_guess,i))>tol):
        x_guess = x_guess - alpha*(f(x_guess,i)/fprime(x_guess,i))
        iter = iter +1
   p.append(x_guess)
   it.append(i)

Alpha = np.linspace(0.01,1.99,200)
J=[]
CT=[]
for j in Alpha:
        x_guess = 10
        ct = 1
        while(abs(f(x_guess,0.6))>tol):
             x_guess = x_guess - (j*f(x_guess,0.6)/fprime(x_guess,0.6))
             ct = ct +1
        J.append(j)
        CT.append(ct)

W = tuple(zip(CT,Alpha))
w = sorted(W)

print(w[0])
plt.figure()
plt.xlabel(\"Thickness\")
plt.ylabel(\"Pressure\")
plt.plot(h,p)
plt.show()
plt.xlabel(\"Relaxation Factor\")
plt.ylabel(\"Iteration\")
plt.plot(J,CT)
plt.show()

Result:-

The minimum relaxation factor for the given equation is 1.054 at 7 iterations.

Output:-

PLOTS:-

1). Relaxation factor vs iterations

2). Pressure vs Thickness

CONCLUSION:-

  • We learnt how Newton-Raphson method works using python
  • Learnt how to create tables in python and plot results in graph.
  • Understood For & while loop.
  • Minimum pressure is 4.23906 and it is obtained after 8 iterations at h = 0.6.
  • Create table for pressure values for different given h-values by taking relaxation factor as 1.
  • Plot graph between thickness vs pressure, & relaxation factor vs iteration.
  • We also learnt How to find minimum relaxation factor.
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.