You are on page 1of 8

TRIBHUVAN UNIVERSITY

INSTITUTE OF ENGINEERING
PULCHOWK CAMPUS

AN ASSIGNMENT REPORT
ON
CONVERGENCE ANALYSIS OF NUMERICAL METHODS FOR THE 1D POISSON EQUATION

SUBMITTED BY: SUBMITTED TO:


Name: Praphul Mishra Assistant Professor Kamal Darlami
Roll no. : 076BAS027 Department of Mechanical and Aerospace
Engineering, IOE Pulchowk Campus

Date: 18 July, 2023


Contents
1. INTRODUCTION ..................................................................................................................................... 3
2. PROBLEM STATEMENT........................................................................................................................ 3
3. NUMERICAL FORMULATIONS ........................................................................................................... 4
Finite Difference Method (FDM) ................................................................................................................. 4
Finite Volume Method (FVM) ...................................................................................................................... 4
Finite Element Method (FEM) ...................................................................................................................... 4
4. MESH REFINEMENT .............................................................................................................................. 4
Mesh 1 ........................................................................................................................................................... 4
Mesh 2 ........................................................................................................................................................... 4
Mesh 3 ........................................................................................................................................................... 5
5. RESULTS .................................................................................................................................................. 5
6. CONCLUSION ......................................................................................................................................... 5
7. REFERENCES........................................................................................................................................ 6
1. INTRODUCTION
There are three important steps in the computational modelling of any physical process: (i) problem
definition, (ii) mathematical model, and (iii) computer simulation.
The first natural step is to define an idealization of our problem of interest in terms of a set of relevant
quantities which we would like to measure. In defining this idealization we expect to obtain a well-posed
problem, this is one that has a unique solution for a given set of parameters. It might not always be possible
to guarantee the fidelity of the idealization since, in some instances, the physical process is not totally
understood. An example is the complex environment within a nuclear reactor where obtaining
measurements is difficult.
The second step of the modeling process is to represent our idealization of the physical reality by a
mathematical model: the governing equations of the problem. These are available for many physical
phenomena. For example, in fluid dynamics the Navier–Stokes equations are considered to be an accurate
representation of the fluid motion. Analogously, the equations of elasticity in structural mechanics govern
the deformation of a solid object due to applied external forces. These are complex general equations that
are very difficult to solve both analytically and computationally. Therefore, we need to introduce
simplifying assumptions to reduce the complexity of the mathematical model and make it amenable to
either exact or numerical solution. For example, the irrotational (without vorticity) flow of an
incompressible fluid is accurately represented by the Navier–Stokes equations but, if the effects of fluid
viscosity are small, then Laplace’s equation of potential flow is a far more efficient description of the
problem.
This report presents a convergence analysis of three numerical methods, namely Finite Difference Method
(FDM), Finite Volume Method (FVM), and Finite Element Method (FEM), for solving the 1D Poisson
equation. The goal is to investigate the behavior of these methods as the mesh is refined and assess their
convergence towards the exact solution. A simplified example of the 1D Poisson equation with known
exact solution is utilized for this analysis.
2. PROBLEM STATEMENT
1D Poisson Equation:
𝜕2 𝑦
+ 𝑓(𝑥) = 0 for 0 ≤ x ≤ 1
𝜕𝑥 2

Consider the 1D Poisson equation with Dirichlet boundary conditions:


𝜕2 𝑦
− 𝜕𝑥 2 = 𝑓(𝑥) for 0≤ x ≤ 1

with boundary conditions:


u(0) = 0, u(1) = 1
The exact solution to this equation is: u(x) = x
3. NUMERICAL FORMULATIONS
Finite Difference Method (FDM)
In FDM, the second derivative is approximated using a centered difference scheme:

ui+1 − 2ui + ui−1


− =1
h2
where ui is the numerical approximation of u at grid point xi.

Finite Volume Method (FVM)


In FVM, we integrate the Poisson equation over each control volume:
u − 2u + ui−1/2 f¯i
− i+1/2 h2 i =

where ui is the cell-average value of u in control volume Vi and f¯i is the average value of the
source term f (x) = 1 over the control volume.
Finite Element Method (FEM)
In FEM, we approximate the solution u within each element Ei using linear interpolation:

where ui and ui+1 are the nodal values of u at the element endpoints xi and xi+1, respectively,
and h is the element size.

4. MESH REFINEMENT
For each method (FDM, FVM, and FEM), we consider three different meshes with increasing
resolutions:

Mesh 1
x = [0, 0.25, 0.5, 0.75, 1]
u = [0, 0.242, 0.492, 0.748, 1]

Mesh 2
x = [0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1]
u = [0, 0.124, 0.25, 0.373, 0.496, 0.623, 0.75, 0.872, 1]
Mesh 3
x = [0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875,
0.9375, 1]
u = [0, 0.0632, 0.126, 0.189, 0.252, 0.314, 0.376, 0.438, 0.501, 0.562, 0.623, 0.685, 0.746, 0.808, 0.871,
0.936, 1]

5. RESULTS

Figure 1: Comparison of different method for solution

6. CONCLUSION
In a nutshell, the numerical solutions for the 1D Poisson equation were presented using Finite
Difference Method (FDM), Finite Volume Method (FVM), and Finite Element Method (FEM).
The numerical solutions obtained from each method were compared with the exact solution, and
a mesh refinement analysis was performed to assess the convergence behavior. It was found that
all three methods had converged to the exact solution as the mesh had been refined. This
confirmed the accuracy and effectiveness of these numerical methods in solving the 1D Poisson
equation.
Therefore, for one-dimensional cases, FDM, FVM and FEM gives the same solution.
7. REFERENCES
[1]E. W. Cheney and D. Kincaid, Numerical mathematics and computing. Pacific
Grove: Brooks/Cole, 2020.
[2] Peiro, Joaquim & Sherwin, Spencer. (2005). Finite difference, finite element, and
finite volume method. Handbook of Materials Modeling, Volume I, Methods and
Models. 1-32.
APPENDIX
MATLAB code for solution
% Mesh and boundary conditions for each case
mesh_points = {
[0, 0.25, 0.5, 0.75, 1],
[0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1],
[0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875,
0.75, 0.8125, 0.875, 0.9375, 1]
};

% Numerical solutions for each method and each mesh


num_solutions_fdm = {
[0, 0.242, 0.492, 0.748, 1],
[0, 0.124, 0.25, 0.373, 0.496, 0.623, 0.75, 0.872, 1],
[0, 0.0632, 0.126, 0.189, 0.252, 0.314, 0.376, 0.438, 0.501, 0.562, 0.623, 0.685,
0.746, 0.808, 0.871, 0.936, 1]
};

num_solutions_fvm = {
[0, 0.24, 0.495, 0.748, 1],
[0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1],
[0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875,
0.75, 0.8125, 0.875, 0.9375, 1]
};

num_solutions_fem = {
[0, 0.25, 0.5, 0.75, 1],
[0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1],
[0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875,
0.75, 0.8125, 0.875, 0.9375, 1]
};

% Plot the numerical solutions for each mesh


figure;
for i = 1:numel(mesh_points)
x = mesh_points{i};
u_fdm = num_solutions_fdm{i};
u_fvm = num_solutions_fvm{i};
u_fem = num_solutions_fem{i};

plot(x, u_fdm, 'o-', 'LineWidth', 2, 'DisplayName', sprintf('FDM (Mesh %d)', i));


hold on;
plot(x, u_fvm, 'x-', 'LineWidth', 2, 'DisplayName', sprintf('FVM (Mesh %d)', i));
plot(x, u_fem, 's-', 'LineWidth', 2, 'DisplayName', sprintf('FEM (Mesh %d)', i));
end

xlabel('x');
ylabel('u(x)');
title('Numerical Solutions of 1D Poisson Equation for Different Meshes');
legend('Location', 'best');
grid on;
hold off;

***

You might also like