Mercurial > repos > public > sbplib
comparison +time/+rk/get_rk4_time_step.m @ 846:c6fcee3fcf1b feature/burgers1d
Add generalized RungeKutta and RungeKuttaRV class which extracts its coefficients from a butcher tableau, specified on the scheme.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 20 Sep 2018 17:51:19 +0200 |
parents | +time/+rk4/get_rk4_time_step.m@48b6fb693025 |
children | 1a265a376b36 |
comparison
equal
deleted
inserted
replaced
845:1e057b0f2fed | 846:c6fcee3fcf1b |
---|---|
1 % Calculate the size of the largest time step given the largest evalue for a operator with pure imaginary e.values. | |
2 function k = get_rk4_time_step(lambda,l_type) | |
3 default_arg('l_type','complex') | |
4 | |
5 rad = abs(lambda); | |
6 if strcmp(l_type,'real') | |
7 % Real eigenvalue | |
8 % kl > -2.7852 | |
9 k = 2.7852/rad; | |
10 | |
11 elseif strcmp(l_type,'imag') | |
12 % Imaginary eigenvalue | |
13 % |kl| < 2.8284 | |
14 k = 2.8284/rad; | |
15 elseif strcmp(l_type,'complex') | |
16 % |kl| < 2.5 | |
17 k = 2.5/rad; | |
18 else | |
19 error('l_type must be one of ''real'',''imag'' or ''complex''.') | |
20 end | |
21 end |