Mercurial > repos > public > sbplib
comparison +time/+rk/get_rk4_time_step.m @ 1111:1a265a376b36 feature/timesteppers
Clean up time.rk.get_rk4_time_step()
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 10 Apr 2019 22:21:13 +0200 |
parents | 50d5a3843099 |
children |
comparison
equal
deleted
inserted
replaced
1104:aa7850e8f68c | 1111:1a265a376b36 |
---|---|
1 % Calculate the size of the largest time step given the largest evalue for a operator with pure imaginary e.values. | 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) | 2 function k = get_rk4_time_step(lambda,l_type) |
3 default_arg('l_type','complex') | 3 default_arg('l_type','complex') |
4 assertIsMember(l_type, {'real', 'imag', 'complex'}) | |
4 | 5 |
5 rad = abs(lambda); | 6 rad = abs(lambda); |
6 if strcmp(l_type,'real') | 7 switch l_type |
7 % Real eigenvalue | 8 case 'real' |
8 % kl > -2.7852 | 9 % kl > -2.7852 |
9 k = 2.7852/rad; | 10 k = 2.7852/rad; |
10 | 11 case 'imag' |
11 elseif strcmp(l_type,'imag') | 12 % |kl| < 2.8284 |
12 % Imaginary eigenvalue | 13 k = 2.8284/rad; |
13 % |kl| < 2.8284 | 14 case 'complex' |
14 k = 2.8284/rad; | 15 % |kl| < 2.5 |
15 elseif strcmp(l_type,'complex') | 16 k = 2.5/rad; |
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 | 17 end |
21 end | 18 end |