CFD Assignment 1D FDM, FVM, Fem
CFD Assignment 1D FDM, FVM, Fem
CFD Assignment 1D FDM, FVM, Fem
INSTITUTE OF ENGINEERING
PULCHOWK CAMPUS
AN ASSIGNMENT REPORT
ON
CONVERGENCE ANALYSIS OF NUMERICAL METHODS FOR THE 1D POISSON EQUATION
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
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]
};
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]
};
xlabel('x');
ylabel('u(x)');
title('Numerical Solutions of 1D Poisson Equation for Different Meshes');
legend('Location', 'best');
grid on;
hold off;
***