All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM: To write a python script to solve for the minimum value of pressure using the Newton Raphson method. OBJECTIVES : To use the Newton Raphson method to find out the value of pressure for h = 0.6. To find the optimal relaxation factor for this problem with the help of a suitable plot. To tabulate the results…
Shubhranshu Mishra
updated on 03 Jul 2020
AIM: To write a python script to solve for the minimum value of pressure using the Newton Raphson method.
OBJECTIVES :
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.
THEORY: Ice sheet can be broken into small slabs with a heavy air-cushion vehicle (ACV) traveling on the float ice sheet at the critical speed. Ice-breaking with ACV is a new ice-breaking method in the inland river which has an important application in the prevention of ice jam flood in the Yellow River. Dependent on ice thickness, an ACV can readily break the ice in flexure by making depression and send cracks through the ice. Once a crack is made, the path of least resistance for the ACV's air curtain gets under the ice and reduces the supporting water under the ice. The ice then fails under its own weight. At speed, an ACV can setup a wave in the ice and send cracks through it. This would act similar to the dynamics of a transport truck on an ice road.
NEWTON RAPHSON METHOD :
Newton's method, also called the Newton-Raphson method, is a root-finding algorithm that uses the first few terms of the Taylor series of a function f(x)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 for the application of Newton's method for computing square roots.
The Taylor series of f(x)f(x) about the point x=x0+εx=x0+ε is given by-
f(x0+ε)=f(x0)+f′(x0)ε+12f''(x0)ε2+....f(x0+ε)=f(x0)+f′(x0)ε+12f′′(x0)ε2+.... , -(1)(1)
Keeping terms only to first order,
f(x0+ε)≈f(x0)+f′(x0)ε.f(x0+ε)≈f(x0)+f′(x0)ε. , - (2)(2)
Equation (2) is the equation of the tangent line to the curve at (x0,f(x0))(x0,f(x0)), so (x1,0)(x1,0) is the place where that tangent line intersects the x-axis. A graph can, therefore, give a good intuitive idea of why Newton's method works at a well-chosen starting point and why it might diverge with a poorly-chosen starting point. This expression above can be used to estimate the amount of offset epsilon needed to land closer to the root starting from an initial guess x0x0. Setting f(x0+ε)=0f(x0+ε)=0 and solving (2) for ε=ε0ε=ε0 gives,
ε0=−f(x0)f′(x0)ε0=-f(x0)f′(x0) , - (3)(3)
which is the first-order adjustment to the root's position. By letting x1=x0+ε0x1=x0+ε0, calculating a new ε1ε1 , and so on, the process can be repeated until it converges to a fixed point (which is precisely a root) using,
εn=−f(xn)f′(xn)εn=-f(xn)f′(xn) , -(4)(4)
Unfortunately, this procedure can be unstable near a horizontal asymptote or a local extremum. However, with a good initial choice of the root's position, the algorithm can be applied iteratively to obtain,
xn+1=xn−f(xn)f′(xn)xn+1=xn-f(xn)f′(xn) - (5)(5)
for n=1, 2, 3, .... An initial point x_0 that provides safe convergence of Newton's method is called an approximate zero.
GOVERNING EQUATION USED :
⇒f(x)=p3(1−β2)+(0.4hβ2−σh2r2)p2+(σ2h43r4)p−(σh23r2)3⇒f(x)=p3(1-β2)+(0.4hβ2-σh2r2)p2+(σ2h43r4)p-(σh23r2)3 ,
⇒f'(x)=3p2(1−β2)+2p(0.4hβ2−σh2r2)+σ2h43r4⇒f′(x)=3p2(1-β2)+2p(0.4hβ2-σh2r2)+σ2h43r4
where pp denotes the cushion pressure,
hh the thickness of the ice field,
rr the size of the air cushion,
σσ the tensile strength of the ice and
ββ is related to the width of the ice wedge.
SOLUTION STEPS :
PYTHON CODE :
# A program to calculate pressure for given thickness of ice using Newton Raphson Method
import math
import numpy as np
import matplotlib.pyplot as plt
# Inputs
# beta is related to the width of the ice wedge
beta = 0.5
# r is the size of the air cushion (feet)
r = 40
# sigma the tensile strength of the ice (pounds per square inch (psi))
sigma = 150
# sigma the tensile strength of the ice (pounds per square foot)| 1foot = 12inches | 1 square feet = 12*12 square inches
sigma = 21600
# h the thickness of the ice field
h = [0.6, 1.2, 1.8, 2.4, 3.0, 3.6, 4.2]
# Relaxation factor assumed
alpha = 1.1
def f(p,h,r,beta,sigma):
term_1 = pow(p, 3)*(1-pow(beta, 2))
term_2a = 0.4*h*pow(beta, 2)
term_2b = (sigma*(pow(h,2))/pow(r,2))
term_3 = pow(sigma,2)*(pow(h,4))/(pow(r,4))
term_4 = (sigma/3)*(pow(h,2))/(pow(r,2))
return term_1 + (term_2a - term_2b)*pow(p,2) + term_3*(p/3) - pow(term_4, 3)
def fprime(p,h,r,beta,sigma):
term_5 = 3*pow(p,2)*(1-pow(beta, 2))
term_6a = 0.4*h*pow(beta, 2)
term_6b = (sigma*(pow(h,2))/pow(r,2))
term_7 = pow(sigma,2)*(pow(h,4))/(pow(r,4))
return term_5 + 2*(term_6a - term_6b)*p + term_7/3
# Null pressure array for storing calculated values after each iterations
pressure = [] # pound per square feet
pressure_0 =[] # pound per square inches(psi)
# Null array for storing the number of iterations in future
num = []
for i in h:
# Assuming initial pressure value
p_guess = 100
# Tolerance
tolerance = 1e-6
# Loop counter for incrementing the number of iterations
counter = 1
while(abs(f(p_guess, i, r, beta, sigma)) > tolerance):
p_guess = p_guess - alpha*(f(p_guess, i, r, beta, sigma)/fprime(p_guess, i, r, beta, sigma))
counter = counter+1
pressure.append(p_guess)
pressure_0.append(p_guess/144)
num.append(counter)
print('*Thickness of the Ice wedge :n',h)
print('*Cushion Pressure (pound per square feet) :n',pressure)
print('*Cushion Pressure (psi) :n',pressure_0)
print('*Number of iterations :n',num)
# Plotting graph
plt.figure(1)
plt.plot(h, pressure, marker = '.',color='black',markerfacecolor='red',markersize=10)
plt.title('Cushion pressure versus Ice field thickness')
plt.xlabel('Thickness of ice field (feet)')
plt.ylabel('Cushion Pressure (pound per square feet)')
plt.grid()
plt.show()
plt.figure(2)
plt.plot(h, pressure_0, marker = '.',color='black',markerfacecolor='green',markersize=10)
plt.title('Cushion pressure versus Ice field thickness')
plt.xlabel('Thickness of ice field (feet)')
plt.ylabel('Cushion Pressure (pound per square inches)')
plt.grid()
plt.show()
''' Part 2 of the program to calculate optimal relaxation factor for given thickness of ice field'''
# h_1 the thickness of the ice field
h_1 = 0.6
# Relaxation factor array assumed considering underrelaxing and overrelaxing values
alpha_array = np.linspace(0.1,1.9,50)
# Null array for storing the number of iterations in future
num_1 = []
for j in alpha_array:
# Assuming initial pressure value
p_guess = 100
# Tolerance
tolerance = 1e-6
# Loop counter for incrementing the number of iterations
counter = 1
while (abs(f(p_guess,h_1,r,beta,sigma)) > tolerance):
p_guess = p_guess - (j*f(p_guess,h_1,r,beta,sigma))/fprime(p_guess,h_1,r,beta,sigma)
counter = counter + 1
num_1.append(counter)
print(j)
# Plotting graph
plt.figure(3)
plt.plot(alpha_array,num_1,marker = '.',color='black',markerfacecolor='red',markersize=7.5)
plt.xlabel('Relaxation factor (alpha)')
plt.ylabel('No. of iterations')
plt.title('Iterations versus Relaxation factor')
plt.grid()
plt.show()
OUTPUTS :
Figure(1)
Figure(2)
Figure(3)
ERRORS: Python throws an error if there is indentation mismatching. It is important to take care of this. The error encountered was-
The reason for this error was that the pressure values which were iterated inside while loop was stored in the same loop without coming out of it. It was rectified by just removing spaces before line 61,62,63 so that they were out of while loop and now values calculated will be stored in that.
CONCLUSION: In this way, we can observe that the Newton Raphson method is a powerful tool for calculating solutions for non-linear functions as it is a more fast technique and gives approximately close solutions in fewer iterations compared to other methods.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Frequency Analysis of a rotating shaft (Finite Element Analysis using SolidWorks)
Aim- The aim of this project is to perform a frequency analysis on a rotating shaft, from there we need to determine the critical frequencies and the mode shapes. 5 Mode Shapes were simulated and analyzed. Introduction:- Frequency is the number of occurrences of a repeating event per unit of time. The formula…
06 Jul 2020 03:57 PM IST
Project - Rankine cycle Simulator (MATLAB)
AIM: To create a basic 'RANKINE CYCLE SIMULATOR'. THEORY: The Rankine cycle is the fundamental operating cycle of all power plants where an operating fluid is continuously evaporated and condensed. The selection of operating fluid depends mainly on the available temperature range. The above figure shows us the basic rankine…
03 Jul 2020 10:43 AM IST
Curve fitting (MATLAB)
AIM: To write a program to fit a linear and cubic polynomial for the specific heat data set then calculate the goodness of fit using different parameters and different ways to improve the fit in MATLAB THEORY: Curve fitting is the process of constructing a curve or mathematical function that best fits the data points,…
03 Jul 2020 10:24 AM IST
Solving second order ODEs (MATLAB)
Aim: To solves the ODE which represents the equation of motion of a simple pendulum with damping. Objective: To write a program that solves the following ODE which represents the equation of motion of a simple pendulum with damping and create an animated video of output obtains by solving this ODE. Theory:…
03 Jul 2020 10:20 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.