Week 5.2 - Literature review: ODE Stability
AIM:-
To do the literature review and write a code to substantiate your claims
and Explain the below
- When does a ODE become unstable?
- How does stability affect engineering simulations?
- Can stability condition be derived for all types of problems?
Explanation and Code:-
When does a ODE becomes unstable:-
Let us understand what is ODE, So ODE is a equation that involves some odinary derivatives of a function. An ODE contains differencetials wrt only one variable, PDE (Partial Differential equation) contains differentials wrt several independent values
For example:-
ODE:- `dy/dx = ax`
PDE `(d^2z)/(dx*dy)+dz/dx+z=0`
Python code:
Code for Eualer's Explicit, Implicit and Analytical solution
import matplotlib.pyplot as plt
import math
import numpy as np
def explicit_euler(t_end, dt):
t = np.arange(0, t_end, dt)
y = np.zeros(len(t))
for i in range(1, len(t)):
y[i]=y[i-1]+dt*(-1000*y[i-1]-np.exp(-t[i-1]))
return [t,y]
def implicit_euler(t_end, dt):
t=np.arange(0, t_end, 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+1000*dt)
return [t,y]
def analytical(t_end, dt):
t = np.arange(0, t_end, dt)
y=np.zeros(len(t))
for i in range(1, len(t)):
y[i] = np.exp(-1000*t[i])*(1-np.exp(999*t[i]))/999
return [t,y]
t_end = 0.1
dt = 1e-4
t, y_explicit=explicit_euler(t_end, dt)
t, y_implicit=implicit_euler(t_end, dt)
t, y_analytical=analytical(t_end, dt)
plt.plot(t, y_explicit, color='blue')
plt.plot(t, y_implicit, color='black')
plt.plot(t, y_analytical, color='orange')
plt.legend(['Explicit','Implicit','Analytical'])
plt.show()
an ODE becomes unstable when an explicit method has greater time step and less number of grid points. From the above code we can get results for different time step values. The plots are shhown below
We can also see that there is limit to step for explicit solution, if we are moving high or low this limit the solution is getting unstable.
1e-4

10e-4

15e-4
20e-4

From the above plots you can see that the solution is getting unstable from dt= 15e-4.
How does Stability affect engineering simulations:-
The unstable solution can be really bad becasue we cannot trust the simulation based on the physical world.
For example:- If we are running a simulation for landing gear and we get the unstable solution for coefficient of drag and lift then the simulation will be of no use as the results will not be matching to gthe real life situations.
Can Stability condition be derived for all types of problems:-
Yes, we can derive the types of problem by the below stability analysis.
1. Eighen Value analysis
2. Linear ODE stability
3. Stability of autonomous ODE systems
4. Non-Linear stability systems
From these systems we can derive cover the most problems arised in the complex engineering situations.