MATLAB My Crank-Nicolson code for my diffusion equation isn't working
- Thread starter hunt_mat
- Start date
Click For Summary
The discussion focuses on issues with implementing the Crank-Nicolson method for solving the diffusion equation in spherical coordinates, specifically regarding stability and divergence problems. The original poster's code diverges despite Crank-Nicolson being theoretically unconditionally stable for diffusion problems. Suggestions include correcting a missing factor in the discretization and considering alternative spatial discretization methods that conserve mass. Participants emphasize the importance of correctly handling boundary conditions and propose exploring Cartesian coordinates as a simpler alternative. The conversation highlights the need for rigorous justification of numerical methods used in simulations.
Similar threads
- · Replies 23 ·
- · Replies 3 ·
- · Replies 4 ·
- · Replies 2 ·
- · Replies 8 ·
- · Replies 1 ·
- · Replies 4 ·
- · Replies 3 ·
- · Replies 1 ·