# maltab ode solver- user defined criteria to stop calculations

is there a way to add a user defined convergence criteria to an ode solver so that the solution is stopped?

I know that Matlab uses absolute and relative tolerances but would that suffice in solving CFD equations or is a user-defined criteria needed?

Thank you.

• Solving CFD equations essentially boils down to solving discretized ODE's, the absolute and relative tolerances should suffice. Typically you want mass to be conserved so you want the tolerance on the residuals of the continuity equations to be low ($\sim 10^{-6}$). If i may be so direct, i would not solve CFD problems using Matlab unless using Mex files or the GPU functions, Matlab is simply not efficient enough for that. – nluigi Dec 10 '15 at 22:36
• thank you. in what way is it not efficient? I am only using it for one dimensional laminar problems. – melody Dec 10 '15 at 23:16
• that will be fine, but going into higher dimensions you will need to move away from interpreted languages like Matlab to more dedicated compiled codes like in C/C++, Fortran, Cuda etc – nluigi Dec 10 '15 at 23:30