Stability issues of ODE solutions using Matlab

In summary, the stability of u in solving the diffusion equation depends on the value of r, which is determined by the parameters D, r0, std, and tau. The code provided shows that when r is set to 200, the results are stable, but when r is set to 1, the results become unstable and oscillate. Possible solutions to this issue could be adjusting the parameter values or using a different numerical method for solving the equation.
  • #1
Ein Krieger
34
0
Hello, guys


I am struggling with attaining stability values for u in solving the diffusion equation. The stability of u depends on the value of r from :

Code:
D=1000;
r0=1000;
std=1.0;
tau=1.0;

IP=2500;  %initial pressure
%
% Radial grid and inhomogeneous term
nr=51;
dr=r0/(nr-1);
dr=50;
for i=1:nr
r(i)=(i-1)*dr+200;
end

Values of u doesn't oscillate and follow stable path from r at i=1 i.e. at r=200 as can be seen from the code above. Ideally u should vary with time and r exponentially as you will see from the graph in the code attached. However, when I replace 200 from the above equation with 1 to obtain u at r=1, the results become unstable and oscillates. So I would like to obtain variation of u from r=1 not from r=200 without osciallation

Can you please help me to fix that problem.

All necessary codes are attached.
 

Attachments

  • pde_1_main_3D_rad_oil.m
    3 KB · Views: 430
  • pde_1_oil.m
    940 bytes · Views: 417
  • dss008.m
    9.6 KB · Views: 416
Physics news on Phys.org
  • #2


Hello,

Thank you for sharing your question and code. It seems like you are working on solving the diffusion equation using a radial grid and an inhomogeneous term. The stability of u in this case depends on the value of r, which is determined by the parameters D, r0, std, and tau. I understand that you are struggling with obtaining stable values for u when r is set to 1 instead of 200.

One possible solution to this issue could be adjusting the values of the parameters to ensure stability at r=1. For example, you could try increasing the value of D or decreasing the value of r0 to see if that helps stabilize the results at r=1. Additionally, you could also try using a smaller time step (dt) in your code to see if that improves the stability at r=1.

Another approach could be to use a different numerical method for solving the diffusion equation. It is possible that the method you are currently using may not be suitable for solving the equation at r=1. You could try researching and implementing other methods, such as the finite difference method or the finite element method, to see if they provide more stable results at r=1.

I hope these suggestions help you in addressing the instability issue at r=1. If you have any further questions or need more clarification, please don't hesitate to ask. Best of luck with your research!
 

1. What are stability issues in ODE solutions?

Stability issues in ODE solutions refer to the potential for the solution to become inaccurate or diverge as the simulation progresses. This can be caused by rounding errors, numerical instability, or other factors.

2. How can I check for stability in my ODE solution using Matlab?

Matlab has built-in functions such as "ode45" and "ode23" that can solve ODEs numerically. These functions also have options to check for stability, such as the "RelTol" and "AbsTol" parameters.

3. What are some common reasons for instability in ODE solutions?

Some common reasons for instability in ODE solutions include using a large time step, having a stiff system of equations, or using an inappropriate numerical method for the specific problem.

4. How can I improve the stability of my ODE solution in Matlab?

There are several ways to improve the stability of ODE solutions in Matlab, such as decreasing the time step, using a more appropriate numerical method, or adjusting the "RelTol" and "AbsTol" parameters for greater accuracy.

5. Can I use other software or programming languages to solve ODEs with better stability?

There are many software and programming options for solving ODEs, and some may have better stability than others for certain types of problems. It is important to carefully consider the specific characteristics of your ODE system and choose the appropriate tool for your needs.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
487
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
41
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
184
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
897
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top