Week - 2 - Explicit and Implicit Analysis
Aim:
solving the given equation by using both explicit and Implicit method
Solution:
import matplotlib.pyplot as plt
import numpy as np
def diff(u):
#a=((u**3)/3 + u)
#b=(u**2)+1
a=((u**3)+(9*u**2)+(4*u))
b=((3*u**2)+(18*u)+4)
return [a,b]
u=0
f1=0.01
error=1
u_1=[]
de_u=[]
f=0
f_int=[]
f_int.append(0)
u_1.append(0)
while (f<3):
a=diff(u)
del_u=f1/a[1]
de_u.append(del_u)
u=del_u+u
f=f+f1
a=diff(u)
f_i=a[0]
if(f>=1):
f_int.append(f)
u_1.append(u)
error=abs(f-f_i)
f=np.linspace(0,0.4,50)
a3=[]
a4=[]
a3.append(0)
a4.append(0)
for i in f:
if(i>0.17):
a2=diff(i)
a3.append(a2[0])
a4.append(i)
u_int = 0
del_f=1
F_final=[]
U_final=[]
F_final.append(0)
U_final.append(0)
while(del_f<4):
b=diff(u_int)
k=b[1]
f_internal = b[0]
u_del=k/del_f
u_int=u_del+u_int
b=diff(u_int)
k=b[1]
f_internal = b[0]
error = f_internal-del_f
while(error>0.001):
u_del_correc=-error/k
u_int=u_del_correc+u_int
b=diff(u_int)
k=b[1]
f_internal = b[0]
error = f_internal-del_f
F_final.append(del_f)
U_final.append(u_int)
del_f=del_f+1
print(u_1,f_int)
plt.plot(a4,a3,label="Exact")
plt.plot(u_1,f_int,label="Explicit")
plt.plot(U_final,F_final,marker='*',label="implicit")
plt.title('Explicit_0.01 vs Implicit_1')
plt.legend()
plt.show()

For the above plot, we have given the load step value as 1 for both explicit and implicit. Explicit answers are deviating from the actual results that is due to the larger load step value which I took. But the implicit answers are matching with the actual result, the reason behind is the newton raphson method which is used to reduce the residual value.


From the above two plot, we can see if the load step is decreased the explicit answers are matching with the actual results. But it will also increase the computational memory

When we increase the residual value, the implicit answers are deviating small from the actual result. From the above plot, we can see how the residual makes an impact on the implicit solutions. if we decrease the residual to too low, there might be the overshoot or divergence problem in the newton raphson method which will be rectified by using either full newton or modified newton raphson method
Conclusion:
From this challenge, we could understand, how the implicit and explicit calculation is carried out in the solver and how can we increase the accuracy of the solution.