Skip to content

Commit a75aa2e

Browse files
Move PhysicalConstants to utils
1 parent 00e36ff commit a75aa2e

File tree

8 files changed

+13
-11
lines changed

8 files changed

+13
-11
lines changed

src/+otp/+bouncingball/+presets/Canonical.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
classdef Canonical < csl.odetestproblems.bouncingball.presets.Simple
1+
classdef Canonical < otp.bouncingball.presets.Simple
22
% [Name]
33
% Canonical
44
%

src/+otp/+bouncingball/+presets/Parabola.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
%
1616
methods
1717
function obj = Parabola
18-
params.g = 9.80665;
18+
params.g = otp.utils.PhysicalConstants.EarthGravity;
1919
params.groundFunction = @(x) x^2;
2020
params.dgroundFunction = @(x) 2*x;
2121

src/+otp/+bouncingball/+presets/RandomTerrain.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
%
1212
methods
1313
function obj = RandomTerrain
14-
params.g = 9.80665;
14+
params.g = otp.utils.PhysicalConstants.EarthGravity;
1515

1616
n = 1000;
1717

1818
rng(6);
1919

20-
genf = @(x) cos(x);
21-
dgenf = @(x) sin(x);
20+
genf = @cos;
21+
dgenf = @sin;
2222

2323
magnitudes = 1/32*randn(n, 1);
2424
periods = 0.9*randn(n, 1);

src/+otp/+bouncingball/+presets/Simple.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
%
1515
methods
1616
function obj = Simple
17-
params.g = 9.80665;
17+
params.g = otp.utils.PhysicalConstants.EarthGravity;
1818
params.groundFunction = @(x) 0;
1919
params.dgroundFunction = @(x) 0;
2020

src/+otp/+nbody/+presets/SunEarth.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
classdef SunEarth < otp.nbody.NBodyProblem
22
methods
33
function obj = SunEarth()
4-
import otp.nbody.presets.PhysicalConstants
4+
import otp.utils.PhysicalConstants
55

66
params.spacialDim = 2;
77
params.masses = [PhysicalConstants.SunMass; PhysicalConstants.EarthMass] / 1e24;
@@ -17,4 +17,4 @@
1717
obj = obj@otp.nbody.NBodyProblem(tspan, y0, params);
1818
end
1919
end
20-
end
20+
end

src/+otp/+nbody/+presets/SunEarthMoon.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
classdef SunEarthMoon < otp.nbody.NBodyProblem
22
methods
33
function obj = SunEarthMoon()
4-
import otp.nbody.presets.PhysicalConstants
4+
import otp.utils.PhysicalConstants
55

66
params.spacialDim = 2;
77
params.masses = [PhysicalConstants.SunMass; PhysicalConstants.EarthMass; PhysicalConstants.MoonMass] / 1e24;
@@ -25,4 +25,4 @@
2525
obj = obj@otp.nbody.NBodyProblem(tspan, y0, params);
2626
end
2727
end
28-
end
28+
end

src/+otp/+nbody/NBodyProblem.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function validateNewState(obj, newTimeSpan, newY0, newParameters)
2626
end
2727

2828
function sol = internalSolve(obj, varargin)
29-
sol = internalSolve@otp.Problem(obj, 'Method', @ode23t, varargin{:});
29+
sol = internalSolve@otp.Problem(obj, 'Method', @ode45, varargin{:});
3030
end
3131

3232
function mov = internalMovie(obj, t, y, varargin)

src/+otp/+nbody/+presets/PhysicalConstants.m renamed to src/+otp/+utils/PhysicalConstants.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
SecondsPerDay = 86400; % s
1717
DaysPerYear = 365.25; % d
18+
19+
EarthGravity = 9.80665;
1820
end
1921

2022
end

0 commit comments

Comments
 (0)