Mercurial > repos > public > sbplib
view isEquidistant.m @ 815:fae41958af4f feature/burgers1d
Add support for artificial viscosity to the 1d burgers scheme.
- Add support for artificial viscosity by parametrizing the discretization operator and boundary closure on the viscosity.
- Add a time stepper which evaluates and updates the residual viscosity of the solution.
author | Vidar Stiernstrom <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 06 Sep 2018 12:43:51 +0200 |
parents | b43c4d841afe |
children |
line wrap: on
line source
% Tests if consecutive elements of vector v are euidistant function b = isEquidistant(v) if length(v) < 2 error('sbplib:isEquidistant:inputTooShort', 'Input vector is too short'); end tol = 1e-8; d = v(2:end) - v(1:end-1); err = abs(d - d(1)); relErr = err./abs(d); I_zero = find(d < tol); relErr(I_zero) = err(I_zero); b = all(relErr < tol); end