Breaking Ice with Air cushion Vehicle - Find minimum pressure with Newton-Raphson method
Aim:
To write a python script to solve for the minimum value of pressure using the newton Raphson method for a give value of the thickness of the ice field of Air cushion vehicle.
Objective:
- To Use the Newton Raphson method to find out the value of pressure for h = 0.6 ft.
- To Find the optimal relaxation factor for this problem with the help of a suitable plot.
- To Tabulate the results of p for h = [0.6,1.2,1.8,2.4,3,3.6,4.2] assuming a suitable relaxation factor.
Problem Statement:
To write a python script to solve for the minimum value of pressure using the newton Raphson method for given expression
where p denotes the cushion pressure, h the thickness of the ice field, r the size of the air cushion, σ the tensile strength of the ice and β is related to the width of the ice wedge.
Take β = 0.5, r = 40 feet and σ = 150 pounds per square inch (psi).
Introduction:
A hovercraft, also known as an air-cushion vehicle or ACV, is an amphibious craft capable of travelling over land, water, mud, ice, and other surfaces.
Hovercraft use blowers to produce a large volume of air below the hull, or air cushion, that is slightly above atmospheric pressure. The pressure difference between the higher-pressure air below the hull and lower pressure ambient air above it produces lift, which causes the hull to float above the running surface. For stability reasons, 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 [1].
Newton Raphson Method:
The Newton–Raphson method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a real-valued function. The most basic version starts with a single-variable function f defined for a real variable x, the function's derivative f ′, and an initial guess x0 for a root of f. If the function satisfies sufficient assumptions and the initial guess is close, then
is a better approximation of the root than x0. Geometrically, (x1, 0) is the intersection of the x-axis and the tangent of the graph of f at (x0, f (x0)): that is, the improved guess is the unique root of the linear approximation at the initial point. The process is repeated as
until a sufficiently precise value is reached [2].
Here is picture to demonstrate how Newton–Raphson method works:
Solution Procedure:
- Converting all the units in equation to feet i.e. for converting psi to psf we need multiply by 144.
- Breaking down the given function so that it would be easier to code and also, diffrentiate the given function.
- Writing the code for Newton Raphson method.
- Assuming alpha and initial guess.
- Writing the code for Plotting the graph of alpha vs iterations.
- Writing the code for Tabulating the results of p for h.
Code:
# Breaking Ice with Air cushion Vehicle - Find minimum pressure with Newton-Raphson method
# By Abhishek Savakar
from matplotlib.pyplot import * # importing modules
from math import *
from numpy import *
from scipy import *
def f(p, b, h, s, r):
t1 = pow(p, 3) * (1 - pow(b, 2))
t2 = ((0.4 * h * pow(b, 2)) - (s * pow(h, 2)) / (pow(r, 2))) * (pow(p, 2))
t3 = (pow(s, 2) * pow(h, 4) * p) / (3 * pow(r, 4))
t4 = pow(((pow(h, 2) * s) / (3 * pow(r, 2))), 3)
return t1 + t2 + t3 - t4
def fprime(p, b, h, s, r):
dt1 = 3 * pow(p, 2) * (1 - pow(b, 2))
dt2 = ((0.4 * h * pow(b, 2)) - (s * pow(h, 2)) / pow(r, 2)) * pow(p, 1) * 2
dt3 = (pow(s, 2) * pow(h, 4)) / (3 * pow(r, 4))
return dt1 + dt2 + dt3
# Performing newton iterations to Find the optimal relaxation factor for this problem with the help of a suitable plot.
# Case 1: To find out the value of pressure for h = 0.6 ft and
# Case 2: To Find the optimal relaxation factor for this problem with the help of a suitable plot
tol = 1e-4
alpha_list = linspace(0, 2, 200)
alphas = []
arr = []
for alpha in alpha_list:
# inputs for the formula
limit = 1000
p_guess = 30
b = 0.5
h = 0.6
s = 150 * 144
r = 40
i = 0
# Newton Raphson Method
while (abs(f(p_guess, b, h, s, r)) > tol):
p_guess = p_guess - alpha * (f(p_guess, b, h, s, r) / fprime(p_guess, b, h, s, r))
i += 1
if limit < i:
arr.append(i)
alphas.append(alpha)
break
alphas.append(alpha)
arr.append(i)
print(f"\n\n\nCase 1: The value of pressure for h = 0.6 ft is: {p_guess} when alpha is : {alpha}")
print(f"\nCase 2: The optimal relaxation factor is {alphas[arr.index(min(arr))]} with {min(arr)} iterations.\n\n")
# plotting alpha vs iteration graph
figure()
plot(alphas, arr)
xlabel('alpha')
ylabel('Number of iteration')
grid(True)
show()
# Case 3: Performing newton iterations to Tabulate the results of p for h = [0.6,1.2,1.8,2.4,3,3.6,4.2]
# assuming a suitable relaxation factor.
h_list = [0.6, 1.2, 1.8, 2.4, 3, 3.6, 4.2]
p_list = []
arr = []
for h in h_list:
alpha = 1.226
limit = 1000
p_guess = 30
b = 0.5
s = 150 * 144
r = 40
i = 0
tol = 1e-4
# Newton Raphson Method
while (abs(f(p_guess, b, h, s, r)) > tol):
p_guess = p_guess - alpha * (f(p_guess, b, h, s, r) / fprime(p_guess, b, h, s, r))
i += 1
arr.append(i)
p_list.append(p_guess)
# plotting thickness vs Cushion pressure
figure()
plot(h_list, p_list)
xlabel('Thickness of the ice field(feet)')
ylabel('Cushion pressure(psf)')
grid(True)
show()
print('Case 3:\n')
print('Thickness of the ice field cushion pressure Number of iterations')
for j in range(len(h_list)):
print(f' {h_list[j]} {p_list[j].__round__(4)} {arr[j]}')
Code Explanation:
- Importing all required modules to solve the solution
- Define a function to find the value of f(xn).
- Define a function for a differentiable function f(x).
- Case 1: To find out the value of pressure for h = 0.6 ft.
- Define all the input parameters and assume alpha and guess initial.
- Write a code for Newton Raphson method using while loop. And calculate the value of pressure.
- Case 2: To Find the optimal relaxation factor for this problem with the help of a suitable plot.
- Assume appropriate list of alpha values and other parameters are kept constant.
- Use for loop to solve Newton Raphson method for each value of alpha.
- Write a code for Newton Raphson method using while loop.
- Appending all values of number of iterations corresponding to alphas, when the solution is sufficient close.
- Plot thee Alpha vs Number of Iteration.
- And find optimal relaxation factor (alpha).
- Case 3: Tabulate the results of p for h = [0.6,1.2,1.8,2.4,3,3.6,4.2]
- Use h = [0.6,1.2,1.8,2.4,3,3.6,4.2] and optimal relaxation factor(alpha) value is used from case 2 so that we will solution in least iteration.
- other parameters are kept constant
- Use for loop to solve Newton Raphson method for each value of h.
- Write a code for Newton Raphson method using while loop.
- Appending all values of Cushion pressures corresponding to Thickness of the ice field when the solution is sufficient close.
- Plot thee Cushion pressures vs Thickness of the ice field.
- Tabulate the values of Cushion pressures, Thickness of the ice field and number of iterations.
output screen:
Results and Discussion:
Case 1 , Case 2 and case 3 solutions on output screen
Case 1: The value of pressure for h = 0.6 ft is: 4.204410765321682 psi when alpha is : 2.0
Case 2: The optimal relaxation factor is 1.2261306532663316 with 8 iterations.
Case 3: Tabulation of p and h is shown in above figure.
Case 2 plot: Alpha vs Number of iterations plot
Case 3 plot: Cushion pressures vs Thickness of the ice field plot
From above plot its clear that as the thickness of the ice field increases the cusion pressure required to break the ice also increases.
References: