Solving a diffusion-reaction equation using method of lines

16 views (last 30 days)
Hi all, I am trying to solve a diffusion-reaction equation (under cylindrical co-ordinate) using method of lines (MOL). The partial differential equation, initial and boundary conditions, and the corresponding derivations can be seen in the attachment. The corresponding code has also been uploaded. I also simulated the PDE using the pde solver in Matlab, and found that my MOL code cannot obtain the right results. Moreover, what weird is that the results of MOL depend on the number of spatial grids (the variable n in my code). I have checked my code many times and did not find any errors. Can anyone help me with this? Thanks in advance.
  19 Comments
Dadi Bi
Dadi Bi on 24 Oct 2020
Yes, for the mesh dependence, although the mesh nodes are different, I think the concentration changes for different meshes should be almost the same (I am not comparing two different nodes but comparing the whole concentration change). For exmaple, if the concentration follows a function y=2x+1, for mesh settings x_mesh1=0:0.01:2 and x_mesh2=0:0.03:2, these two different meshes can result in the same concentrations 2x_mesh1+1 and 2x_mesh2+1.
J. Alex Lee
J. Alex Lee on 24 Oct 2020
If you are comparing C1 values to C1 values (the first value in your mesh), instead of C0 values to C0 values, your answers WILL depend on your mesh because of the way you are defining the mesh.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!