Solving Diffusion Problem with Crank Nicholson Method

  • Context: Graduate 
  • Thread starter Thread starter cl19726
  • Start date Start date
  • Tags Tags
    Diffusion
Click For Summary
SUMMARY

The discussion focuses on solving a diffusion problem using the Crank-Nicholson method, specifically addressing challenges with the tridiagonal matrix and boundary conditions. The equation dy/dt = k * d^2y/dx^2 is used, with K increasing with x. The initial condition is set as y(x,0)=0, while the boundary conditions include dy/dx at y=0 equal to z, which varies with time, and d^2y/dx^2 at y=1 equal to 0. The user seeks guidance on implementing this method step-by-step.

PREREQUISITES
  • Understanding of the Crank-Nicholson method for numerical solutions
  • Familiarity with solving tridiagonal matrices
  • Knowledge of boundary value problems in partial differential equations
  • Proficiency in C++ programming for numerical simulations
NEXT STEPS
  • Research the implementation of the Crank-Nicholson method in numerical analysis
  • Learn techniques for solving tridiagonal systems, such as the Thomas algorithm
  • Explore boundary condition handling in finite difference methods
  • Examine examples of diffusion problems solved using C++
USEFUL FOR

Mathematicians, physicists, and software developers working on numerical simulations of diffusion processes, particularly those utilizing the Crank-Nicholson method in C++.

cl19726
Messages
1
Reaction score
0
Hi
I am trying to solve the following diffusion problem using crank Nicholson method, but having trouble on how to proceed with the tridiagonal matrix and boundary conditions.

dy/dt = k* d^2y/dx^2 K = increases with x

My initial condition is y(x,0)=0;

Boundary conditions are

dy/dx (at y=0) = z (z changes with time step)

d^2y/dx^2 (at y=1) = 0 (y goes from 0 to 1,n=10)

I need to solve for y(0 to 1) for 1 timestep at a time. Y becomes nonzero everywhere after a particular time.

any inputs in how to solve is greatly appreciated.

thanks
 
Physics news on Phys.org
Can you show some more work? I have programmed the Crank-Nicholson method in C++ in the past for some problems of my own.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
961
  • · Replies 10 ·
Replies
10
Views
2K