Skip to content

Commit 00e36ff

Browse files
Switch default solver form ode45 to ode15s
1 parent 81ef2ab commit 00e36ff

File tree

23 files changed

+48
-72
lines changed

23 files changed

+48
-72
lines changed

src/+otp/+allencahn/AllenCahnProblem.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,5 @@ function validateNewState(obj, newTimeSpan, newY0, newParameters)
4040
.checkField('beta', 'scalar', 'real', 'finite', 'positive') ...
4141
.checkField('forcing', @(f) isempty(f) || isa(f, 'function_handle'));
4242
end
43-
44-
function sol = internalSolve(obj, varargin)
45-
sol = internalSolve@otp.Problem(obj, 'Method', @ode15s, varargin{:});
46-
end
4743
end
4844
end

src/+otp/+ascherlineardae/AscherLinearDAEProblem.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ function validateNewState(obj, newTimeSpan, newY0, newParameters)
2727
otp.utils.StructParser(newParameters) ...
2828
.checkField('beta', 'scalar', 'real', 'finite');
2929
end
30-
31-
function sol = internalSolve(obj, varargin)
32-
sol = internalSolve@otp.Problem(obj, 'Method', @ode15s, varargin{:});
33-
end
3430
end
3531
end
3632

src/+otp/+bouncingball/BouncingBallProblem.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
end
66
end
77

8-
methods (Access = protected)
8+
methods (Access = protected)
99
function onSettingsChanged(obj)
1010
g = obj.Parameters.g;
1111
gF = obj.Parameters.groundFunction;
@@ -43,6 +43,10 @@ function validateNewState(obj, newTimeSpan, newY0, newParameters)
4343
mov = otp.bouncingball.BouncingBallMovie(obj.Name, obj.Parameters.groundFunction, varargin{:});
4444
mov.record(t, y);
4545
end
46+
47+
function sol = internalSolve(obj, varargin)
48+
sol = internalSolve@otp.Problem(obj, 'Method', @ode45, varargin{:});
49+
end
4650
end
4751
end
4852

src/+otp/+brusselator/BrusselatorProblem.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
RhsNonlinear
3232
end
3333

34-
methods (Access = protected)
34+
methods (Access = protected)
3535
function onSettingsChanged(obj)
3636
a = obj.Parameters.a;
3737
b = obj.Parameters.b;
@@ -63,5 +63,9 @@ function validateNewState(obj, newTimeSpan, newY0, newParameters)
6363
label = 'Reactant Y';
6464
end
6565
end
66+
67+
function sol = internalSolve(obj, varargin)
68+
sol = internalSolve@otp.Problem(obj, 'Method', @ode45, varargin{:});
69+
end
6670
end
6771
end

src/+otp/+cusp/CUSPProblem.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,5 @@ function validateNewState(obj, newTimeSpan, newY0, newParameters)
4848
.checkField('epsilon', 'finite', 'positive') ...
4949
.checkField('sigma', 'finite', 'positive');
5050
end
51-
52-
function sol = internalSolve(obj, varargin)
53-
sol = internalSolve@otp.Problem(obj, 'Method', @ode15s, varargin{:});
54-
end
5551
end
5652
end

src/+otp/+e5/E5Problem.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ function onSettingsChanged(obj)
2323
M = obj.Parameters.M;
2424

2525
obj.Rhs = otp.Rhs(@(t, y) otp.e5.f(t, y, A, B, C, M), ...
26-
otp.Rhs.FieldNames.Jacobian, @(t, y) otp.e5.jac(t, y, A, B, C, M));
26+
otp.Rhs.FieldNames.Jacobian, @(t, y) otp.e5.jac(t, y, A, B, C, M), ...
27+
otp.Rhs.FieldNames.NonNegative, 1:obj.NumVars);
2728
end
2829

2930
function fig = internalPlot(obj, t, y, varargin)
@@ -32,7 +33,8 @@ function onSettingsChanged(obj)
3233
end
3334

3435
function sol = internalSolve(obj, varargin)
35-
sol = internalSolve@otp.Problem(obj, 'Method', @ode15s, varargin{:});
36+
% Set tolerances due to the very small scales
37+
sol = internalSolve@otp.Problem(obj, 'AbsTol', 1e-50, 'RelTol', 1e-10, varargin{:});
3638
end
3739
end
3840
end

src/+otp/+hires/HiresProblem.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,5 @@ function onSettingsChanged(obj)
1717
otp.Rhs.FieldNames.JacobianVectorProduct, @otp.hires.jvp, ...
1818
otp.Rhs.FieldNames.JacobianAdjointVectorProduct, @otp.hires.javp);
1919
end
20-
21-
function sol = internalSolve(obj, varargin)
22-
sol = internalSolve@otp.Problem(obj, 'Method', @ode15s, varargin{:});
23-
end
2420
end
2521
end

src/+otp/+inverterchain/InverterChainProblem.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
classdef InverterChainProblem < otp.Problem
1+
classdef InverterChainProblem < otp.Problem
22
methods
33
function obj = InverterChainProblem(timeSpan, y0, parameters)
44
obj@otp.Problem('Inverter Chain', [], timeSpan, y0, parameters);
55
end
66
end
77

88
methods (Access = protected)
9-
function fig = internalPlot(obj, t, y, varargin)
9+
function fig = internalPlot(obj, t, y, varargin)
1010
fig = internalPlot@otp.Problem(obj, t, y, ...
1111
'ylabel', 'Voltage', varargin{:});
1212
end
@@ -34,4 +34,4 @@ function validateNewState(obj, newTimeSpan, newY0, newParameters)
3434
.checkField('gamma', 'scalar', 'real', 'finite', 'positive');
3535
end
3636
end
37-
end
37+
end

src/+otp/+kpr/KPRProblem.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,5 @@ function onSettingsChanged(obj)
2424
obj.RhsSlow = otp.Rhs(@(t,y) otp.kpr.fslow(t, y, Omega, omega), ...
2525
otp.Rhs.FieldNames.Jacobian, @(t, y) otp.kpr.jacslow(t, y, Omega, omega));
2626
end
27-
28-
function sol = internalSolve(obj, varargin)
29-
sol = internalSolve@otp.Problem(obj, 'Method', @ode15s, varargin{:});
30-
end
3127
end
32-
end
28+
end

src/+otp/+lienard/LienardProblem.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ function validateNewState(obj, newTimeSpan, newY0, newParameters)
2929
.checkField('p', 'function') ...
3030
.checkField('dp', 'function');
3131
end
32-
33-
function sol = internalSolve(obj, varargin)
34-
sol = internalSolve@otp.Problem(obj, 'Method', @ode15s, varargin{:});
35-
end
3632
end
3733
end
3834

0 commit comments

Comments
 (0)