My Crank-Nicolson code for my diffusion equation isn't working
- Context: MATLAB
- Thread starter hunt_mat
- Start date
Click For Summary
Discussion Overview
The discussion revolves around a user's implementation of the Crank-Nicolson method to solve the diffusion equation in spherical coordinates. Participants explore issues related to code divergence, discretization methods, and boundary conditions, with a focus on numerical stability and accuracy.
Discussion Character
- Technical explanation
- Debate/contested
- Mathematical reasoning
Main Points Raised
- One participant notes that a missing factor of 2 in the user's equation may contribute to the divergence issue.
- Another participant suggests an alternative discretization method that conserves mass and questions the user's approach, emphasizing the importance of evaluating terms at half-way points.
- Some participants express skepticism about the justification for the user's discretization scheme, requesting a derivation to support its validity.
- There are multiple suggestions to rewrite the PDE in different forms, including transforming it to Cartesian coordinates, which may simplify the problem.
- Concerns are raised regarding the use of central differences instead of forward Euler in the Crank-Nicolson method, which could impact convergence.
- One participant shares a reference to John Crank's book on diffusion, indicating that the transformation used is not widely known among others.
- Questions arise about how to handle boundary conditions in light of the proposed transformations.
Areas of Agreement / Disagreement
Participants express differing views on the appropriateness of the user's discretization method and the Crank-Nicolson implementation. There is no consensus on the best approach, and several competing suggestions are presented.
Contextual Notes
Participants highlight potential limitations in the user's code, including the handling of boundary conditions and the implications of different discretization methods on mass conservation and stability. The discussion remains open-ended regarding the effectiveness of the proposed solutions.
Similar threads
- · Replies 1 ·
- · Replies 23 ·
- · Replies 3 ·
- · Replies 4 ·
- · Replies 4 ·
- · Replies 2 ·
- · Replies 8 ·
- · Replies 1 ·
- · Replies 4 ·
- · Replies 1 ·