Week 5 - Literature review: ODE Stability
Introduction
what is ODE
ODE is an Ordinary Differential Equation is an equation that contains one or several derivatives of unknown Function such as time & space ( For example temperature variation T(x), T(t)). The equation may contain T itself as a known function of x or t.
Term Ordinary distinguishes Partial Differential Equation (PDE's) which involve partial derivative of unknown function of two or more variable
ODE is side to be the order of n. if nth derivative unknown function of variable is the highest order derivative of a variable in the equation
below case study gives clear understanding
Problem state
`f(t)=dy/dt=-1000y-exp(-t),when y(0)=0`
Explicit
`(y^(New)-y(old))/dt=-1000y-e^(-t)`
`y^(New)=(-1000y^(old)-e^(-t))*dt+y(old)`
Implicit
`(y^(New)-y(old))/dt=-1000y-e^(-t)`
`y^(New)=(-1000y^(New)-e^(-t))*dt+y(old)`
`(1+1000*dt)y^(New)=(-e^(-t))*dt+y(old)`
`y^(New)=(y^(old)-e^(-t)*dt)/(1+1000*dt)`
Numerical
`dy/dt=-1000y-exp(-t)`
`(.e^(-1000*t)*(1-e^((1000-1)*t)))/(1000-1)`
PYTHON Program
import math
import matplotlib.pyplot as plt
import numpy as np
# Numerical solving
def explicit_euler(t_total,dt):
t=np.arange(0,t_total,dt)
y=np.zeros(len(t))
for i in range(1,len(t)):
y[i]=y[i-1]+dt*(-c*y[i-1]-np.exp(-t[i-1]))
return [t,y]
def implicit_euler(t_total,dt):
t=np.arange(0,t_total,dt)
y=np.zeros(len(t))
for i in range(1,len(t)):
y[i]=(y[i-1]-np.exp(-t[i-1])*dt)/(1+c*dt)
return [t,y]
# analytical anaylsis equation solve in wolframalpha
def analytical_euler(t_total,dt):
t=np.arange(0,t_total,dt)
y=np.zeros(len(t))
for i in range(1,len(t)):
y[i]=(np.exp(-c*t[i])*(1-np.exp((c-1)*t[i])))/(c-1)
return [t,y]
# Time known constrain
t_total=0.1
c=1000
dt=1.8e-6
#print(dt)
t,y_explicit=explicit_euler(t_total,dt)
t,y_implicit=implicit_euler(t_total,dt)
t,y_analytical=analytical_euler(t_total,dt)
plt.plot(t,y_explicit,'--',color='blue')
plt.plot(t,y_implicit,color='red')
plt.plot(t,y_analytical,'-.',color='orange')
plt.xlabel('time')
plt.ylabel('y')
plt.legend(['Explicit','Implicit','analytical'])
plt.savefig('euler_time_analysis_c2')
plt.show()
ODE becomes unstable
when dt=total time/ constant is < value the solution become unstable
Graph
Diverge
dt=1.2e-2
Totally diverged in Explicit time analysis
dt=1.1e-3
Explicit Trying to converge converged after some time analysis
dt=1.8e-3
The initial time step the solution become unstable linearly after 0.04s solution started to converge
Converge
dt=1e-4
Explicit trying to converge entire solution initial & final solution is converged to an analytical solution but there is a small error or diverged in initial time step
dt=1.8e-4
The explicit analysis is fully converged with an analytical solution when the solution satisfies dt=total time/ constant is >
converge solution
How does stability affect engineering simulations
with various time step (dt) variation of result which is shown in the graph for the explicit method is time various method implicit is a time-independent problem. A constant solution called as equilibrium. An equilibrium solution called Stability is an important condition to conflict the function of the variant to the numerical solution to the analytical result. when the function approach close to it for further all time. If a function does not remain constant to time when an increase then it's unstable
explicit
a=1e-4
when dt=total time/ constant is > a value of solution becomes unstable in an explicit analysis
dt=total time/ constant = a value of the solution becomes stable nearby value the solution start converging which is explained above
dt=total time/ constant < a value the solution becomes stable in an explicit analysis
the explicit analysis clearly shows time depended on the analysis
To make explicit analysis to stable dt=total time/ constant is = dt ( time step)
further, reduce the value of dt the solution becomes entirely stable at each time
Can stability condition be derived for all types of problems
Yes we can derive stability condition for all problem for example in combustion ODE is formed for a single property variable with change function of time & conflict to the numerical solution
For modelling a system for time-variable problem stability, bondedness is an important factor to stable a solution
Conclusion
ODE is important for all application not only restricted to engineering solution for modelling a solution in all application
for explicit analysis the value of dt (change in time) is analysed with time step
Source
ODE exact solving
https://www.wolframalpha.com/input/?i=solve+dy%2Fdt%3D-1000y-exp%28-t%29+when+y%280%29%3D0
Reference
https://www.cs.princeton.edu/courses/archive/fall11/cos323/notes/cos323_f11_lecture19_pde2.pdf
https://www.math.utk.edu/~ccollins/M577/Handouts/cond_stab.pdf