Solving Diffusion Problem with Crank Nicholson Method

  • Thread starter cl19726
  • Start date
  • Tags
    Diffusion
In summary, the conversation is about solving a diffusion problem using the Crank-Nicholson method. The person is having trouble with the tridiagonal matrix and boundary conditions. The problem involves finding the solution for y(0 to 1) for one timestep at a time, where y becomes nonzero after a certain time. The person is looking for input on how to proceed with the problem and has experience programming the Crank-Nicholson method in C++.
  • #1
cl19726
1
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
  • #2
Can you show some more work? I have programmed the Crank-Nicholson method in C++ in the past for some problems of my own.
 

Related to Solving Diffusion Problem with Crank Nicholson Method

1. What is the Crank Nicholson method and how does it work?

The Crank Nicholson method is a numerical algorithm used for solving diffusion problems. It involves discretizing the diffusion equation and using a combination of explicit and implicit schemes to approximate the solution at the next time step. This method is known for its stability and accuracy compared to other numerical methods.

2. When is the Crank Nicholson method most commonly used?

The Crank Nicholson method is commonly used for solving time-dependent diffusion problems, such as heat transfer, mass transfer, and fluid flow. It is also used in financial modeling and option pricing.

3. What are the advantages of using the Crank Nicholson method?

The Crank Nicholson method is known for its stability and accuracy, especially for problems with high diffusion coefficients. It also has a higher convergence rate compared to other numerical methods, making it more efficient for solving diffusion problems.

4. Are there any limitations to using the Crank Nicholson method?

One limitation of the Crank Nicholson method is its complexity, as it involves solving a system of equations at each time step. It also requires the use of smaller time steps for accurate results, which can increase computational time.

5. How do you validate the results obtained from the Crank Nicholson method?

The results obtained from the Crank Nicholson method can be validated through comparison with analytical solutions or experimental data. It is also important to check for convergence and stability of the numerical solution. Sensitivity analysis can also be performed to assess the impact of input parameters on the results.

Similar threads

  • Differential Equations
Replies
2
Views
2K
Replies
13
Views
2K
Replies
8
Views
2K
Replies
7
Views
2K
Replies
1
Views
1K
  • Differential Equations
Replies
8
Views
4K
  • Differential Equations
Replies
3
Views
2K
  • Differential Equations
Replies
2
Views
1K
  • Differential Equations
Replies
10
Views
1K
Replies
2
Views
1K
Back
Top