All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Objective : To understand the Numerical stability and convergence over time step and grid spacing , and CFL criteria. Description : Numerical simulation understanding is very important as it is the approach to get accurate approximate results for complex …
Epuri Yoga Narasimha
updated on 05 Feb 2021
Objective : To understand the Numerical stability and convergence over time step and grid spacing , and CFL criteria.
Description : Numerical simulation understanding is very important as it is the approach to get accurate approximate results for complex
physical problems in real world.
Every physical problem are described in PDE's (mathematical perspective).
Coverting it into linear Algebraic equation for computations.
Three approaches to convert , we called this process as discretization .
Discretization : Means we are finding solutions at discrete points in the domains , but domain is continous , we consider the nodes so that the results are accurate enough to judge the process.
Approaches : FDM (Finite difference approach).
FVM (Finite volume approach).
FEM (Finite element approach).
Here we are solving linear transient convection equation using Finite difference approach , transient since it contain time derivative.
Genearal form of conservation of linear momentum :
∂(ρ→v)∂t+∇⋅(ρ→v⊗→v)=-∇p+∇→τ+ρ.→f
Types of Finite difference schems:
1. Forward difference (or) skewed right.
2. Backward difference (or) skewed left.
3. Central difference.
Types of errors :
1. Discretization error : Difference between the exact solution of PDE(round off free) and the exact solution of FDE(round off free).
2. Round off error : Any computational solution , due to restriction of limit of number affected by rounding of a finite number of digits in the arithematic operations.
Round off error α number of grid points (sometimes).
3. Truncation error : Difference between exact solution of PDE and Numerical solution of FDE.
Accuracy of finite difference solution:
3 terms to determine about the accuracy of finite difference solution...
1. Consistency.
Finite difference scheme representation of a PDE is said to be consistent if shown that the difference between PDE and its finite difference
representation vanishes as the mesh is refined.
One way is to do this , to make the mesh finer.
Truncation Error = 0... (condition)
caution :
Making the mesh over finer , may influence increase in round off error.
Fine the mesh upto a limit , so that error stay in bounds...
2. Stability.
Numerical scheme is said to be stable , if any sources of errors (Truncation , Round off) are not permitting to grow in the sequence of numerical
Procedure as the calculations proceeds from one marching step to the next.
Errors bounds to a limit.
3. Convergence.
We say the scheme is convergence if , it is both stable and consistent , these are prerequisites to convergence.
Convergence means , the solution of FDE approaches to the true solution to the PDE having the same IC and BC as the mesh is refined.
Mainly for Marching problems.
Lax Equivalance Theorem :
Given a properly posed initial value problem and a finite-difference approximations to it that Satisfies the the consistency condition , stability is the
necessary and the sufficient criteria for Convergence.
Types of methods used for solving marching problems:
1. Explicit method.
This method is use present solutions , for the corresponding time step solutions.
2. Implicit method.
This method used the future guy , for corresponnding future values.
Here , will use Explicit method , to solve linear convection equation.
3. Crank Nichalison Method(Implicit + Explicit methods).
Transient linear Convection equation :
∂u∂t+C⋅∂u∂x=0
C is a constant.
In Discretized form , using Forward difference sheme to transient part , Backward difference approach to convective part.
un+1i-uniΔt=-c⋅(uni-uni-1Δx)
un+1i=uni-c⋅ΔtΔx⋅(uni-uni-1)
Let's consider square plot for better understanding...
This is the initial condition of our pde plotted using discretization technique , red dots denote Nodes (or) Grid Points.
u22=u12-1⋅ΔtΔx(u12-u11).
By using graph results can find , future solutions , according to above equation for remaining nodes.
Results depends on the mesh size and time step.
The term c⋅ΔtΔxhas a special name ' Courant number '.
Courant Number :
This provides the reference to check stability of our model , w.r.t grid size and time step.
Also called CFL NUMBER or Courant-Frendrichs and Lewy criteria or CFL Criteria.
Courant Number nomenclature used at many references...
What this decscribe??
Its just ratio two length , fraction of cells that flows moves through the cell.
Co = cell distance/cell length.
Co=U⋅ΔtΔx.
Co = 0.3 , represents , flow covered 30% of the cell in a time step.
Co = 1.1 , represents , flow covered extra 10% over the cell in a time step.
So , here information overlfow , so instability occures if it is Advection equation.
This can be calulated easily , as here considered 1D linear flow.
In physical problem won't then ,,,
like , shape of the cell , orientation of faces of the cell , velocity in any arbitary direction over the face.
Co=12⋅Δt⋅∑f|Vf⋅ˆnf|⋅AfVp
Vf = Velocity at that face.
Vp= Volume of the cell.
Af = Area of the face.
ˆnf = normal vector to face.
∑f -> represents sum along all faces.
Here , 12 considered , we are reversing direction of half of flux , as mod|| considered.
As can observe that the cell shape is Hectagon and , velocity not normal to face.
Method to calclute Grid size (Δx) :
On simple steps , we get equation (1) , which is applicable to 1D,2D,3D , regardless of cell shape.
NOTE :
Courant number is used for explicit method analysis.
For implicit method , courant number can be any number but we get the good accurate reslults . But required more computation linear solvers (drawback).
Implicit method is unconditionally stable (always) ; no restriction on size of Δx.
NOTE 2 :
CFL Field :
In the domain won't be a constant courant number , every grid has a diiferent courant number , so we can call it as a courant field.
We consider Maximum Courant number in the filed for better stability in the domain...
Some maximum courant number recommended :
1. Large eddy simulation (0.5-1).
2. Free surface flows (<1).
3. Compressible flows (depends on speed of sound).
4. Turbomachinary (<80).
5. Explicit time stepping (<1).
Marching :
Marching means the evolution of the main dependent property (e.g. Temperature, velocity, density, pressure, concentration....etc)
according the independent dimensions (three coordinates of space and time). In CFD, the numerical solutions rely on domain discretization,
which means dividing the geometry and time (added virtual dimension) into small structures called cells and defined as space and time step to
reach to final solution from the known part (initial and boundary conditions) to the unknown zones.Meanwhile, the differential equation describing
the physical phenomenon (relation between flow variables) is also changed to algebraic form to adapt with the new transformation applied to the geometry.
It's worth noting, not only discretization is important, but also determining how small is the time and space steps to have stable and accurate results.
Code snippet :
%% Clearing commands
close all
clear all
clc
% Input variables for the linear convection
L =1;
n = [20 , 40 , 80 ,160];
%n = 20;
c = 1;
dt = 1e-2;
t = 0.4;
nt = t/dt;
% Calculations
[q,u,dx] = linear_convection_func1(n,L);
u_initial = u;
for k = 1:length(n)
figure(k)
v = u{1,k};
cfl = (c*dt)/dx(k);
% Now for different time steps for velocity
% For loop for number of time steps
for i = 1:nt
% For loop for all grid velocity values in the mesh
for j = 2:length(q{1,k})
z(j) = v(1,j) - (c*dt)/dx(k)*(v(1,j) - v(1,j-1));
% Tried relaxation not pretty sure...
%{
if cfl<1
cfl = 1.10*cfl
end
if cfl>1
cfl = cfl - 0.50*cfl
end
%}
end
z(1) = 1;
v = z;
plot(q{1,k},u{1,k},'color','b','linewidth',3)
hold on
plot(q{1,k},z,'r')
pause(0.3)
axis([0 1 0 2])
end
hold off
end
Description about code snippet :
1. Used clear command for to clear the data in the present interface.
2. Declared the required variables.
3. Used function defination , for to get data to plot the initial velocity profile for different number of grids considered.
4. Used for loops , to calculate velocity data and plot the results at the simulation time itslef using 'pause' command.
5. axis command , to set the axis bounds.
6. 'hold on' command used , not to clear axes properties for the corresponding future plots.
function [q,v,dx] = linear_convection_func1(n,L)
for i = 1:length(n)
q{1,i} = linspace(0,L,n(i)); % Making mesh
x = q{1,i};
dx(i) = x(2) - x(1); % Grid spacing
u = 1*ones(1,n(i)); % Initial conditions
A = logical(x>=0.1 & x<=0.3);
index = find(A==1);
n_start = index(1);
n_end = index(end);
u(n_start:n_end) = 2;
v{1,i} = u;
end
end
%{
1. find [start,stop] values.
2. U values;
%}
Description of function code snippet :
1. Used function , to find the mesh discretization , grid spacing , velocity profiles data , start and end indices for grid locations (0.1 and 0.3).
2. Using simple steps and properties in matlab.
Note 3:
Numerical diffusion , dispersion and disspation :
The numerical dissipation dispersion and diffusion arise depending on the kind of truncation we use . Let us consider an example of a finite difference sequence. When we trauncate the terms greater than dx^2
have second order accuracy and have higher order terms like dx^3,dx^4,dx^5.. the odd powered terms givs rise to dispersion of numerical solution and the even powered terms give rise to dissipation
of numerical solution. When dissipation and dispersion are combined together we get diffusion.
To understand whether in our numerical solution diffusion , dispersion (or) dissipation occurs we should do Global truncation error analysis...
General Equation using discretization and taylor series :
This scheme is First order upwind scheme
∂ϕ∂t=-c⋅∂ϕ∂x+c⋅Δx2⋅(1-λ)⋅∂2ϕ∂x2+O([Δx2])
As leading term of truncation error here is even power derivative , so dissipation occurs...
Can observe that in results below , as over time loss in momentum (velocity decreases)...
As by defination , dissipation means loss of quanitity over time...
here λ is courant number.
If we use central difference scheme , Mid point leap frog method :
Here we get local truncation error as term as odd order derivative.
So, dispersion occurs , phase change occrs over time.
Results :
1. The first polt , for n = 20. (number of grids)
2. Fixed Time step (dt) = 1e-2.
3. Number of iterations , nt = t/dt = 40 time steps for final velocity profile.
-> Co = 1⋅dtdx
-> dx = 0.052631578947368.
-> dt = 1e-2.
-> Co = 0.1900 < 1. Diffusion occurs.
-> dx = 0.025641025641026
-> dt = 1e-2.
-> Co = 0.3900 < 1. Diffusion occurs. Rate of convergence increaces as grid is refined.
-> dx = 0.012658227848101
-> dt = 1e-2.
-> Co = 0.7900 < 1. Diffusion occurs but convergence increased.
-> dx = 0.006289308176101
-> dt = 1e-2.
-> Co = 1.5900 > 1 , Local truncation error increases instability occurs.
This condition is for courant number is 'one' , so No truncation erroe -> No diffusion...
Conclusions :
1. Even if we are not considering the diffusion term , diffusion occures due to numerical error.
2. So , need to stability analysis such that it gives more accurate results approaches to exact solution of governing equation.
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...
Project 4
Objective 1. Detect lanes using Hough Transform Method. Steps in lane Detection 1. Detect Edges using Canny Edge Detection Method. 2. Capture the Region of Interest in Image. 3. Detect lines using Hough Transform. 4. Calculate the actual left and right lanes from all lines. 6. Find the coordinates of the lines. 7. Display…
21 Feb 2023 05:22 AM IST
Lane Detection using Hough Transform
Objective 1. Detect lanes using Hough Transform Method. Steps in lane Detection 1. Detect Edges using Canny Edge Detection Method. 2. Capture the Region of Interest in Image. 3. Detect lines using Hough Transform. 4. Calculate the actual left and right lanes from all lines. 6. Find the coordinates of the lines. 7. Display…
21 Feb 2023 05:20 AM IST
Edge Detection and Hough Transform
Objective: Detecting Edges using Canny Edge Detector. Understand and display the outputs of all steps in the canny Edge Detection process. Effect on the output on changing the parameters of the Non-Maximum Suppression. Understand Hough Transform and Lane Detection using Hough Transform. Steps Follow in the Discussion:…
28 Dec 2022 09:58 PM IST
week 2 : Image Filtering
Objective: Apply Prewitt and Laplacian filter on the image Libraries used: Opencv Open Source computer vision library. cross-platform supported. can perform through c, c++, and python. numpy Mathematical library to work in the domain of Linear algebra, Fourier transform, and matrices. Image Filtering…
09 Jul 2022 06:36 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.