Project

Minimum pressure for ice breaking by air cushioning

import matplotlib.pyplot as plt
import numpy as np
import plotly.graph_objects as go

def function(p,h,beta,r,sigma):    #equation
	term1 = pow(p,3)*(1-pow(beta,2))     
	term2 = (0.4*h*pow(beta,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) 
	return term1 + term2 + term3 - term4 

def fprime(p,h,beta,r,sigma):      # f\' equation
	term1 = 3*pow(p,2)*(1-pow(beta,2))     
	term2 = (0.4*h*pow(beta,2) - (sigma*pow(h,2))/pow(r,2))*2*p     
	term3 = (pow(sigma,2)*pow(h,4))/(3*pow(r,4)) 
	return term1 + term2 + term3 

# inputs
p_guess = 100000 
h = [0.6,1.2,1.8,2.4,3.0,3.6,4.2] 
beta = 0.5 
r = 40 
sigma = 150*144 

# convert into fps units 
tol = 1e-2 
iter = 1 
alpha = 1 
minimum_pressure = [] 

# getting root buy newton raphson method

for i in range(len(h)):  #loop i for all values of h 
	while(abs(function(p_guess,h[i],beta,r,sigma)) > tol): #absolute value of equation return by functiom
		p_guess = p_guess - alpha*function(p_guess,h[i],beta,r,sigma)/fprime(p_guess,h[i],beta,r,sigma) 
		iter += 1
	minimum_pressure.append(p_guess) 

# Table Generation by plotly.graph_objects module

fig = go.Figure(data=[go.Table(header=dict(values=[\'Thickness of ice field (in feet)\', \'Minimum Cusion Pressure (in psf)\']),
	cells=dict(values=[h,minimum_pressure])) ])
fig.show()

 
# Choosing optimum relaxation factor- i.e alpha value which gives result in les ser iterations(since it will take lesser time to compute)
h=0.6
alpha = np.linspace(0.1,1.9,19)
tol = 1e-4
no_of_iteration = [] 

for i in range(len(alpha)):
	p_guess = 50
	iter = 1
	while(abs(function(p_guess,h,beta,r,sigma)) > tol):
		p_guess = p_guess - alpha[i]*(function(p_guess,h,beta,r,sigma)/fprime(p_guess,h,beta,r,sigma))
		iter += 1
	#print(p_guess)
	no_of_iteration.append(iter)
	print(no_of_iteration)

# plotting graph 
plt.plot(alpha,no_of_iteration)
plt.xlabel(\"Relaxation Factor\")
plt.ylabel(\"No. of Iteration occurs\")
plt.show() 

Code explaination

1.import library
matplotlib.pyplot
numpy
plotly.graph_objects
2.define a function for ice breaking to return value
with inputs p,h,beta,r,sigma
3.define dev of that function wrt to p
4.give input values for function
p_guess
h=string of values
beta , r ,sigma
5.fps units conversion
tol=1e-2
iter=1
alpha=1
minimum pressure = []
6.initiate a loop for different values of i
while get absolute value from function greater than tollerance
newton raphson method get pressure guess value.
add on itteration value
append p guess values in mimimum pressure array.
7.create a table using plotly.graph_objects module
8.select optimum relaxation factor i.e h=0.6
9.get array of alpha from 0.1 to 1.9.
10.get values for no. of iteration
intiate for loop for i in range of alpha
while function grater than tol
append values for no. of iteration
11.plot graph


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.