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.

  • 1
    $\begingroup$ 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. $\endgroup$ – nluigi Dec 10 '15 at 22:36
  • $\begingroup$ thank you. in what way is it not efficient? I am only using it for one dimensional laminar problems. $\endgroup$ – melody Dec 10 '15 at 23:16
  • $\begingroup$ 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 $\endgroup$ – nluigi Dec 10 '15 at 23:30

I think that this can be achieved using ODE Events. You can define your custom function(s)/expression(s) that will be evaluated and can terminate the solution process – thus serving as a custom convergence criterion/criteria.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.