Solving a diffusion-reaction equation using method of lines

조회 수: 11 (최근 30일)
Dadi Bi
Dadi Bi 2020년 10월 9일
댓글: J. Alex Lee 2020년 10월 24일
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
Dadi Bi
Dadi Bi 2020년 10월 24일
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 2020년 10월 24일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Boundary Conditions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by