Mercurial > repos > public > sbplib
annotate +time/Rungekutta4proper.m @ 774:66eb4a2bbb72 feature/grids
Remove default scaling of the system.
The scaling doens't seem to help actual solutions. One example that fails in the flexural code.
With large timesteps the solutions seems to blow up. One particular example is profilePresentation
on the tdb_presentation_figures branch with k = 0.0005
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 18 Jul 2018 15:42:52 -0700 |
parents | e1a05acc1b5d |
children | c6fcee3fcf1b 8894e9c49e40 |
rev | line source |
---|---|
41
910a05dcdfdf
Added Rk4 as it should be.
Jonatan Werpers <jonatan@werpers.com>
parents:
13
diff
changeset
|
1 classdef Rungekutta4proper < time.Timestepper |
0 | 2 properties |
3 F | |
4 k | |
5 t | |
6 v | |
7 m | |
8 n | |
9 end | |
10 | |
11 | |
12 methods | |
280
e1a05acc1b5d
Added some documentation.
Jonatan Werpers <jonatan@werpers.com>
parents:
41
diff
changeset
|
13 % Timesteps v_t = F(v,t), using RK4 fromt t = t0 with timestep k and initial conditions v = v0 |
41
910a05dcdfdf
Added Rk4 as it should be.
Jonatan Werpers <jonatan@werpers.com>
parents:
13
diff
changeset
|
14 function obj = Rungekutta4proper(F, k, t0, v0) |
910a05dcdfdf
Added Rk4 as it should be.
Jonatan Werpers <jonatan@werpers.com>
parents:
13
diff
changeset
|
15 obj.F = F; |
0 | 16 obj.k = k; |
17 obj.t = t0; | |
18 obj.v = v0; | |
19 obj.m = length(v0); | |
13
b18d3d201a71
Fixed initialization of step counter in timesteppers.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
20 obj.n = 0; |
0 | 21 end |
22 | |
23 function [v,t] = getV(obj) | |
24 v = obj.v; | |
25 t = obj.t; | |
26 end | |
27 | |
28 function obj = step(obj) | |
29 obj.v = time.rk4.rungekutta_4(obj.v, obj.t, obj.k, obj.F); | |
30 obj.t = obj.t + obj.k; | |
31 obj.n = obj.n + 1; | |
32 end | |
33 end | |
34 | |
35 | |
36 methods (Static) | |
37 function k = getTimeStep(lambda) | |
38 k = rk4.get_rk4_time_step(lambda); | |
39 end | |
40 end | |
41 | |
42 end |