Is there any difference between getting solution for diffusion equation using pdepe and crank Nicholson algorithm?

3 visualizaciones (últimos 30 días)
I am trying to solve partial differential equation (fick's diffusion equation) Du/Dt= D* D2u/dx2. I got solutions from pdepe. Will I get the same solutions when I use crank Nicholson algorithm? Is there any difference between both?

Respuestas (1)

Prasanna
Prasanna el 21 de Ag. de 2024
Hi Sasireka,
When solving partial differential equations (PDEs), different numerical methods can yield similar results, but there are nuances that might lead to differences in the solutions obtained from pdepe" and the Crank-Nicolson method.
Pdepe" solver uses a finite element method whereas “Crank-Nicholson" algorithm uses a finite difference method that is implicit and is stable for linear problems. The general differences between the 2 methods are:
  • Pdepe abstracts away many of the details, while Crank-Nicholson requires more hands-on implementation.
  • Pdepe may be easier to solve complex problems with varying boundary conditions, whereas “Crank-Nicholson might require more manual adjustments.
  • Pdepe uses adaptive time-stepping and spatial discretization, which can lead to different time step sizes and grid resolutions compared to a fixed grid and time step in Crank-Nicolson.
In theory, both methods should converge to the same solution as the grid is refined. However, due to differences in numerical schemes, discretization, and handling of boundary conditions, there might be slight differences in solutions, in cases with larger time steps. For practical purposes, if both methods are implemented correctly and with sufficiently fine discretization, they should provide similar results.
For more information regarding the methods, refer the following documentations:
Hope this helps!

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by