1D advection-diffusion-need to check my code; any suggestions?

Click For Summary
SUMMARY

The discussion centers on a self-taught programmer seeking validation for their 1D advection-diffusion code, which employs constant velocity, a diffusion coefficient, central differencing, and the Crank-Nicolson method. The user is looking for resources or examples in Excel, MATLAB, or C++ to compare their implementation against established analytical solutions. They emphasize the importance of verifying their results with textbook problems to ensure accuracy.

PREREQUISITES
  • Understanding of 1D advection-diffusion equations
  • Familiarity with the Crank-Nicolson method
  • Basic programming skills in MATLAB or C++
  • Knowledge of numerical methods for solving differential equations
NEXT STEPS
  • Research analytical solutions for 1D advection-diffusion problems
  • Explore MATLAB implementations of the Crank-Nicolson method
  • Study numerical stability and convergence in central differencing
  • Find and analyze textbook problems related to advection-diffusion
USEFUL FOR

This discussion is beneficial for self-taught programmers, students in transport phenomena, and anyone interested in numerical methods for solving partial differential equations.

bzz77
Messages
33
Reaction score
0
1D advection-diffusion--need to check my code; any suggestions?

Hi everyone:

I am teaching myself transport/programming, and have created a simple program for 1-D advection-diffusion (constant velocity, diffusion coefficient, central differencing, Crank-Nicolson).

I would like to check that my code is working properly and would appreciate any advice about how to go about this. I have not been successful on Google at finding code that others have written... If anyone can direct me or provide advice about getting an analytical solution, I would be very grateful. An EXCEL-based spreadsheet or a Matlab or a c++ implementation would be useful; I am not a Fortran or C user.
 
Physics news on Phys.org


probably the best way is to find a textbook problem and see if your solution agrees with the book's.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K
Replies
1
Views
2K
  • · Replies 41 ·
2
Replies
41
Views
10K
  • · Replies 25 ·
Replies
25
Views
9K
Replies
3
Views
4K
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 11 ·
Replies
11
Views
4K