annotate +time/+rk/Explicit.m @ 1104:aa7850e8f68c feature/timesteppers

Remove some obsolete comments
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 09 Apr 2019 22:22:03 +0200
parents d4fe089b2c4a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
996
3b903011b1a9 Rename time.rk.General to time.rk.Explicit and fix some errors
Jonatan Werpers <jonatan@werpers.com>
parents: 995
diff changeset
1 classdef Explicit < time.Timestepper
888
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
2 properties
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
3 F % RHS of the ODE
918
679f4ddd982f Add properties for stage approximations and stage rates in the Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 888
diff changeset
4 dt % Time step
888
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
5 t % Time point
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
6 v % Solution vector
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
7 n % Time level
995
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
8 bt
888
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
9 end
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
10
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
11
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
12 methods
995
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
13 % Timesteps v_t = F(t,v), using the specified ButcherTableau
993
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
14 % from t = t0 with timestep dt and initial conditions v(0) = v0
996
3b903011b1a9 Rename time.rk.General to time.rk.Explicit and fix some errors
Jonatan Werpers <jonatan@werpers.com>
parents: 995
diff changeset
15 function obj = Explicit(F, dt, t0, v0, bt)
993
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
16 assertType(bt, 'time.rk.ButcherTableau')
888
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
17 obj.F = F;
918
679f4ddd982f Add properties for stage approximations and stage rates in the Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 888
diff changeset
18 obj.dt = dt;
888
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
19 obj.t = t0;
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
20 obj.v = v0;
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
21 obj.n = 0;
918
679f4ddd982f Add properties for stage approximations and stage rates in the Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 888
diff changeset
22
993
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
23 assert(bt.isExplicit())
995
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
24 obj.bt = bt;
888
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
25 end
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
26
918
679f4ddd982f Add properties for stage approximations and stage rates in the Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 888
diff changeset
27 % v: Current solution
679f4ddd982f Add properties for stage approximations and stage rates in the Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 888
diff changeset
28 % t: Current time
995
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
29 function [v,t] = getV(obj)
888
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
30 v = obj.v;
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
31 t = obj.t;
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
32 end
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
33
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
34 function obj = step(obj)
995
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
35 s = obj.bt.nStages();
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
36 a = obj.bt.a;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
37 b = obj.bt.b;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
38 c = obj.bt.c;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
39
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
40 % Compute rates K
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
41 K = zeros(length(v), s);
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
42 for i = 1:s
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
43 V_i = obj.v;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
44 for j = 1:i-1
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
45 V_i = V_i + dt*a(i,j)*K(:,j);
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
46 end
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
47 K(:,i) = F(t+dt*c(i), V_i);
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
48 end
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
49
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
50 % Compute updated solution
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
51 v_next = v;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
52 for i = 1:s
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
53 v_next = v_next + dt*b(i)*K(:,i);
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
54 end
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
55
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
56 obj.v = v_next;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
57 obj.t = obj.t + obj.dt;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
58 obj.n = obj.n + 1;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
59 end
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
60
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
61 % TBD: Method name
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
62 % TBD: Parameter name
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
63 %
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
64 % Takes a regular step but with discreteRates(:,i) added to RHS for stage i.
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
65 % v_t = F(t,v) + discreteRates(:, ...)
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
66 %
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
67 % Also returns the stage approximations (V) and stage rates (K).
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
68 function [v,t, V, K] = stepWithDiscreteData(obj, discreteRates)
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
69 s = obj.bt.nStages();
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
70 a = obj.bt.a;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
71 b = obj.bt.b;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
72 c = obj.bt.c;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
73
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
74 % Compute rates K and stage approximations V
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
75 K = zeros(length(v), s);
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
76 V = zeros(length(v), s);
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
77 for i = 1:s
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
78 V_i = obj.v;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
79 for j = 1:i-1
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
80 V_i = V_i + dt*a(i,j)*K(:,j);
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
81 end
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
82
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
83 K_i = F(t+dt*c(i), V_i);
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
84 K_i = K_i + discreteRates(:,i);
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
85
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
86 V(:,i) = V_i;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
87 K(:,i) = K_i;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
88 end
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
89
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
90 % Compute updated updated solution
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
91 v_next = v;
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
92 for i = 1:s
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
93 v_next = v_next + dt*b(i)*K(:,i);
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
94 end
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
95
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
96 obj.v = v_next;
918
679f4ddd982f Add properties for stage approximations and stage rates in the Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 888
diff changeset
97 obj.t = obj.t + obj.dt;
888
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
98 obj.n = obj.n + 1;
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
99 end
933
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
100
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
101 % Returns a vector of time points, including substage points,
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
102 % in the time interval [t0, tEnd].
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
103 % The time-step obj.dt is assumed to be aligned with [t0, tEnd] already.
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
104 function tvec = timePoints(obj, t0, tEnd)
995
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
105 % TBD: Should this be implemented here or somewhere else?
933
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
106 N = round( (tEnd-t0)/obj.dt );
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
107 tvec = zeros(N*obj.s, 1);
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
108 s = obj.coeffs.s;
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
109 c = obj.coeffs.c;
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
110 for i = 1:N
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
111 ind = (i-1)*s+1 : i*s;
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
112 tvec(ind) = ((i-1) + c')*obj.dt;
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
113 end
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
114 end
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
115
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
116 % Returns a vector of quadrature weights corresponding to grid points
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
117 % in time interval [t0, tEnd], substage points included.
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
118 % The time-step obj.dt is assumed to be aligned with [t0, tEnd] already.
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
119 function weights = quadWeights(obj, t0, tEnd)
995
10c5eda235b7 Full use of butcher tableau in time.rk.General. Inline rungekutta step methods
Jonatan Werpers <jonatan@werpers.com>
parents: 993
diff changeset
120 % TBD: Should this be implemented here or somewhere else?
933
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
121 N = round( (tEnd-t0)/obj.dt );
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
122 b = obj.coeffs.b;
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
123 weights = repmat(b', N, 1);
34b3d092a4d0 Add methods timePoints and quadWeights to Rungekutta class.
Martin Almquist <malmquist@stanford.edu>
parents: 932
diff changeset
124 end
888
8732d6bd9890 Add general Runge-Kutta class
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
125 end
993
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
126
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
127 methods(Static)
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
128 % TBD: Function name
996
3b903011b1a9 Rename time.rk.General to time.rk.Explicit and fix some errors
Jonatan Werpers <jonatan@werpers.com>
parents: 995
diff changeset
129 function ts = methodFromStr(F, dt, t0, v0, methodStr)
993
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
130 try
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
131 bt = time.rk.ButcherTableau.(method);
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
132 catch
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
133 error('Runge-Kutta method ''%s'' is not implemented', methodStr)
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
134 end
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
135
996
3b903011b1a9 Rename time.rk.General to time.rk.Explicit and fix some errors
Jonatan Werpers <jonatan@werpers.com>
parents: 995
diff changeset
136 ts = time.rk.Explicit(F, dt, t0, v0, bt);
993
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
137 end
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
138 end
44e7e497c3b7 Make time.rk.General accept a butcher tableau instead of a string to choose method. String variant implemented as a static method
Jonatan Werpers <jonatan@werpers.com>
parents: 992
diff changeset
139 end