Breaking Ice with Air cushion Vehicle: Find minimum pressure with Newton-Raphson method Using Python Programming
Aim
Objective
- The objective is to determine the pressure that is required to break the thickness of ice using the air-cushion vehicle muller and by using mathematical modeling by using the newton raphson method using python.
Theory
- NEWTON RAPHSON METHOD
The newton-raphson method is that numerical analysis for which to find the root's value in the approximation of a particular equation of real value- function. hence it uses the iterated differential solving method which tends to find the approximate value by the straight-line tangent to it.
Python Script
"""
Created on Wed Jul 15 17:14:26 2020
@author: slomo
"""
import matplotlib.pyplot as plt
import numpy as np
from tabulate import tabulate
#inputs
be=0.5
r=40
sig=150*144
h=[0.6,1.2,1.8,2.4,3.0,3.6,4.2]
alp=1 #under relaxation factor
#equation
def f(p,h): #user defined function
q1= (p**3)*(1-be**2)
q2= ((0.4*h*be**2)-((sig*h**2)/r**2))*p**2
q3= ((sig**2*h**4)/(3*r**4))*p
q4= ((sig*h**2)/(3*r**2))**3
equ=q1+q2+q3-q4
return equ
def fx(p,h): #differentiated equation
te1=3*(pow(p,2))*(1-pow(be,2))
te2=2*p*(((0.4*h*pow(be,2))-(sig*pow(h,2))/pow(r,2)))
te3=((pow(sig,2)*pow(h,4))/(3*pow(r,4)))
equ1=te1+te2+te3
return equ1
x_g=10
alp=1
tol=1e-4
#print('hello')
table_list=['iteration','thickness','pressure',]
it=[]
x_gn=[]
for s in h: #this for loop is to know curve fact between thichness and pressure
i=0
while (abs(f(x_g,s))>tol): #this while loop is type of condition to satisfy the following pressure not be below the tolerance value
x_g=x_g-(f(x_g,s)/fx(x_g,s))
i=i+1
it.append(i)
x_gn.append(x_g)
#print(i,x_g,s)
mydata=tuple(zip(it,h,x_gn)) #tuple is a set in which consists the araryinside the array
print(tabulate(mydata,table_list,tablefmt="grid")) #tabulate is predefined func is to create table according to the variables.
plt.plot(h,x_gn,'r')
plt.xlabel('thickness')
plt.ylabel('pressure')
plt.show()
'''optimization relaxation'''
#as by varying the uber relaxation factor to certian values to get get optimized value
alp=np.linspace(0.01,1.99,150)
it=[]
for s in alp:
i=0
x_g=10
while (abs(f(x_g,0.6))>tol):
x_g=x_g-s*(f(x_g,0.6)/fx(x_g,0.6))
i=i+1
it.append(i)
#print(it,alp)
z=tuple(zip(it,alp))
l=sorted(z)
#print(l[0])
plt.plot(alp,it,'g')
plt.xlabel('under relaxation factor')
plt.ylabel('iteration')
plt.legend(['relaxed curve'])
plt.show()
Procedure
Inputs for the calculation using the program
- size of air cushion, r=40 ft
- relaxation factor (αα)=1
- thickness (h)=(0.6,1.2,1.8,2.4,3.0,3.6,4.2)
- tensile strength (σσ)=150 psi = 150*144 psf(per square feet)
- β=0.5
By defining the user-defined function for the given equation with a separate function as a differential equation. As to find the approximation of the pressure value using the iteration method with the help newton raphson method, the formula defined in the iteration is given below
xn=xg−α⋅(f(xg)f′(xg))xn=xg-α⋅(f(xg)f′(xg))
by iterating this formula with certain pressure value as assumed. So that the tolerance value of the pressure is defined 1e−41e-4 in which the loop iterates until the value reaches below the tolerance value And by optimizing the relaxation factor for the particular thickness of 0.6 of and using the same looping conditions the approximate pressure value in which iteration taking place is found out
Output
Plots Obtained
Conclusion
The table for which the iteration and thickness and pressure condition is differentiated. And the graph is plotted for pressure and thickness with approximated values. Then the after varying the relaxation factor and the thickness as a constant value of 0.6 is plotted.