Breaking Ice with Air cushion Vehicle
AIM: Find minimum pressure with Newton-Raphson method to break ice with air cushion vehicle with the help of a PYTHON program
OBJECTIVES:
- The main objective pf the project is to find the minimum pressure for the given value of height
- Analyse the change in values of number of iteration with respect to change in relaxation factor
- Improvise the code to obtain to optimum value of relaxation factor
- Also plot the variation of cushion pressure w.r.t to the height
PROBLEM STATEMENT:
There are some values of relaxation factor for which the equation will never converge or will take large amount of iterations. This concept is also used in designing the drag corfficient for complex 3-D geometrical figures e.g spacecraft. Also we need to make a good guess for the initial value of the equation to get a accurate root. Hence this will help us to optimize the equation without using complex concepts like CFD.
GOVERNING EQUATIONS:
p^3*(1-beta^2) + (0.4*h*beta^2-sigma*h^2/(r^2)*p^2) + (((sigma^2*h^4)/(3*r^4))*p) - ((sigma*h^2)/(3*r^2))^3 = 0
Where p denotes the cushion pressure,
the thickness of the ice field,
r the size of the air cushion,
σ the tensile strength of the ice,
β is related to the width of the ice wedge
THEORY AND EXPLAINATION:
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) = 0f(x)=0. It uses the idea that a continuous and differentiable function can be approximated by a straight line tangent to it.
Newton's method may not work if there are points of inflection, local maxima or minima around x0 or the root.
ICE BREAKING WITH AN AIR CUSHION VEHICLE:
The ice breaking mechanism under a slow moving air cushion vehicle is explored. The bending moments which cause the circumferential cracks in the ice are determined for the case where the pressure of the air cushion is sufficient to depress the water and force air below the ice field. There are some more difficult case where the pressure is insufficient to form an air cavity
CODE AND ITS EXPLAINATION:
Function code:
"""
Function for Newton - Raphson Method
"""
# importing modules
import numpy as np
import matplotlib.pyplot as plt
import math
# inputs
B = 0.5 # beta
r = 40
sigma = 150 * 144 # to convert to psft
# defining the function
def f(p, h):
term1 = pow(p, 3)*(1 - pow(B, 2))
term2 = pow(p, 2)*((0.4 * h * pow(B, 2)) - (sigma * pow(h, 2)/ pow(r, 2)))
term3 = pow(sigma, 2)*pow(h, 4)*p/(3*pow(r, 4))
term4 = sigma*pow(h, 2)/(3*pow(r, 2))
term4 = pow(term4, 3)
term = term1 + term2 + term3 - term4
return term
# setting up the first diffrential equation
def df(p, h):
term1 = 3*pow(p, 2)*(1-pow(B, 2))
term2 = 2 * p * ((0.4 * h * pow(B, 2)) - (sigma * h * h / pow(r, 2)))
term3 = pow(sigma, 2)*pow(h, 4)/(3*pow(r, 4))
term = term1 + term2 + term3
return term
# setting up the second differential equation
def ddf(p, h):
term1 = 6 * p * (1-pow(B, 2))
term2 = 2 * ((0.4 * h * pow(B, 2)) - (sigma * h * h / pow(r, 2)))
term = term1 + term2
return term
MAIN CODE AND LINE-WISE EXPLAINATION:
# importing functions and modules
from NRM_functions import f, df, ddf
import numpy as np
import matplotlib.pyplot as plt
"""
case1) Value of pressure at h = 0.6 * 12 inch
"""
# required additional inputs
h = 0.6
acc = 1e-4
p_guess = 30
# to check if the guess will converge or not
if f(p_guess, h) * ddf(p_guess, h)/pow(df(p_guess, h),2) < 1:
pass
else:
print('this wont converge, try another guess')
# the relaxation factor
alpha = 1
# defining h vector
h = [0.6, 1.2, 1.8, 2.4, 3, 3.6, 4.2]
P = []
itr = 1 # initial value
# iterating through the each value of h
for i in range(len(h)):
while abs(f(p_guess, h[i])) > acc:
p_guess = p_guess - alpha*(f(p_guess, h[i])/df(p_guess, h[i]))
itr += 1 # incrementing the value by 1
P.append(p_guess) # adds to the existing array
plt.figure(1)
plt.plot(h,P)
plt.xlabel(" height in ft")
plt.ylabel('Cushion pressure in psft')
plt.title('Cushion pressure vs height')
#plt.show()
print('the optimum pressure at 0.6 ft is', P[0],'psft')
# printing the results:
print('-----------RESULT TABLE------------')
print('HEIGHT(in ft) Pressure(in psft)')
for j in range(len(h)):
print(h[j],' ',P[j])
print('---------------------------------------')
"""
case2 ) optimum relaxation factor
"""
# consider the array of relaxation factor
alpha = np.linspace(0.1, 1.9, 20)
# initial condition
h = 0.6
n_i = []
# iterate through each value of alpha
for k in range(len(alpha)):
ct = 1
p_guess = 30
while abs(f(p_guess, h)) > acc:
p_guess = p_guess - alpha[k]*(f(p_guess, h)/df(p_guess, h))
ct += 1
n_i.append(ct)
# plotting the results for iter vs alpha
plt.figure(2)
# tomark to optimum point
plt.plot(alpha[10],min(n_i),'x',color= 'r')
plt.text(alpha[10],min(n_i),"Optimum point")
plt.plot(alpha, n_i)
plt.xlabel('Relaxation Factor')
plt.ylabel('Number of iterations')
plt.show()
Brief Procedure:
- First setup the function so than it can be invoked when necessary
- Then check if the function would converge for the initial guess value
- setup a value of accuracy or tolerance
- Set up a value of h in a array and check for consistency of units
- Then make a table for h and its corresponding cushion pressure value
- Then make an array of relaxation factor
- And obtain the number of iteration at which the accuracy is obtained
- Then plot the value of iteration vs the alpha(relaxation factor)
- Find the optimum point on same curve
PROBLEMS FACED:
This error was solved by setting the initial vlue of guess and iteration inside the for loop
Rest of the errors we solved by manual debugging
RESULTS AND DISCUSSION:
Case 1)
the optimum pressure at 0.6 ft is 4.239063953659794 psft
Hence we could observe that as the height increases the cushion pressure increases in parabolic form
The slope could be calculated using the suitable parabolic equation
case 2)
We could observe that iterations decreases with increase in relaxation factor to some extend
but after a optimum point it again starts to increase, you could see the optimal point on the graph for this case
CONCLUSION:
- We got an optimal point at which we get the root in lest number of iterations
- We also made a plot for calculated pressure and height characterictics
- And obtained the same results in tabular form
- We also understood the importace of setting a optimum relaxation factor and good initial guess value.