Skip to content

Commit 7b0ec8f

Browse files
Support for Octave (#24)
* Start support for Octave * Put Arenstorf problem in Octave-compatible format * Fix warnings and Andrey's comments * Force consistent line ending * Fix Andrey's comments * More detailed documentation for Arenstorf problem * Add contributing guide * Rewrite installer to support Octave. Currently untested in MATLAB * Conversion of the Lorenz '63 problem to the new style defined by Steven * Made the install script work with matlab, and added stubs for mac and windows * added 'cite as' text as before. * Converted the matlab prj file to use the build directory * converted the find-replace functionality to use matlab built-in commands * Switch from sed to pure matlab preprocessing for installer * Lorenz 96 modified to octave format * added a small test script to help with the conversion to octave. This can be removed later, but is very helpful to keep track of everything now * updated the temp test script to look at all presets * Allen Cahn support for octave * Problem fix for events * change script to validate all presets, and changed format to not do warnings * Converted Bouncing Ball to octave format * Changed solver of nbody to default to ode15s as some of the systems are stiff * Changed the Ascher linear DAE to be octave compatible * Brusselator into octave now * We cusp now * CUSP octave fix * Nbody is octave compatible * Changed Nbody to work with ode23t * Quadratic problem done * QG octave gogogogo * Changes and cleanup to the lienard problem, octave support * Fix for lineard problem * Linear problem should work with octave now * Vanderpol done * Lotka volterra octave * pendulum octave * Trig DAE, simple octave * Update E5 for octave * Vectorization and capitilization fixes for all problems currently in octave format * Updates to docs * PR done * sanz serna octave * ZLA kinetics octave * fixes for zla * Update HIRES for octave * Update inverter chain for octave * Update KPR for octave * Update Oregonator for octave * Transistor amplifier octave * Fixes for validation tests * Fixes for validation tests * renaming jacobian, jvp and javp * Revert "renaming jacobian, jvp and javp" This reverts commit 3e90edd. * jacobian correct renaming * Revert "jacobian correct renaming" This reverts commit e94b5b6. * WIll I ever get this right? * Support linear problem in octave * Modified hessian filenames too * changed install to only use w on windows * changed validatepresets to always find the OTP directory. * fixed matlab parameter validation issues * always use w flag on install * Capitalized RHS * Update README.md * Documentation inprovements * Finish renaming RHS functions * fix warnings Co-authored-by: Andrey A Popov <apopov@vt.edu>
1 parent 83ac84f commit 7b0ec8f

File tree

236 files changed

+2318
-1661
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+2318
-1661
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto
2+
*.m text eol=lf
3+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.asv
22
*.m~
33
*.mltbx
4+
build/
5+

DESCRIPTION

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Name: ODE Test Problems
2+
Version: 0.0.1
3+
Date: 2021-13-12
4+
Author: Steven Roberts, Andrey Popov, Arash Sarshar, Adrian Sandu
5+
Maintainer: Steven Roberts, Andrey Popov
6+
Title: A MATLAB suite of initial value problems
7+
Description: TODO
8+
Categories: ODEs
9+
Url: https://github.com/ComputationalScienceLaboratory/ODE-Test-Problems
10+
License: MIT
11+

ODE Test Problems.prj

Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,90 @@
1-
<deployment-project plugin="plugin.toolbox" plugin-version="1.0">
2-
<configuration name="ODE Test Problems" target="target.toolbox" target-name="Package Toolbox">
3-
<param.appname>ODE Test Problems</param.appname>
4-
<param.authnamewatermark>Steven Roberts, Andrey Popov, Ardian Sandu</param.authnamewatermark>
5-
<param.email />
6-
<param.company>Computational Science Laboratory</param.company>
7-
<param.summary>A MATLAB suite of initial value problems</param.summary>
8-
<param.description />
9-
<param.screenshot />
10-
<param.version>0.0.1</param.version>
11-
<param.output>${PROJECT_ROOT}/ODE Test Problems.mltbx</param.output>
12-
<param.products.name />
13-
<param.products.id />
14-
<param.products.version />
15-
<param.platforms />
16-
<param.guid>0970ed36-a788-484f-beca-105eecd2562a</param.guid>
17-
<param.exclude.filters></param.exclude.filters>
18-
<param.exclude.pcodedmfiles>true</param.exclude.pcodedmfiles>
19-
<param.examples />
20-
<param.demosxml />
21-
<param.apps />
22-
<param.registered.apps />
23-
<param.docs />
24-
<param.getting.started.guide />
25-
<param.matlabpath.excludes />
26-
<param.javaclasspath.excludes />
27-
<param.exported.on.package>false</param.exported.on.package>
28-
<param.required.addons />
29-
<param.matlab.project.id />
30-
<param.matlab.project.name />
31-
<param.release.start />
32-
<param.release.end />
33-
<param.release.current.only>false</param.release.current.only>
34-
<param.compatiblity.windows>true</param.compatiblity.windows>
35-
<param.compatiblity.macos>true</param.compatiblity.macos>
36-
<param.compatiblity.linux>true</param.compatiblity.linux>
37-
<param.compatiblity.matlabonline>true</param.compatiblity.matlabonline>
38-
<param.installation.map />
39-
<param.additional.sw.names />
40-
<param.additional.sw.licenses />
41-
<param.additional.sw.win.url />
42-
<param.additional.sw.mac.url />
43-
<param.additional.sw.linux.url />
44-
<unset>
45-
<param.email />
46-
<param.description />
47-
<param.screenshot />
48-
<param.output />
49-
<param.products.name />
50-
<param.products.id />
51-
<param.products.version />
52-
<param.platforms />
53-
<param.exclude.pcodedmfiles />
54-
<param.examples />
55-
<param.demosxml />
56-
<param.apps />
57-
<param.registered.apps />
58-
<param.docs />
59-
<param.getting.started.guide />
60-
<param.matlabpath.excludes />
61-
<param.javaclasspath.excludes />
62-
<param.exported.on.package />
63-
<param.required.addons />
64-
<param.matlab.project.id />
65-
<param.matlab.project.name />
66-
<param.release.start />
67-
<param.release.end />
68-
<param.release.current.only />
69-
<param.compatiblity.windows />
70-
<param.compatiblity.macos />
71-
<param.compatiblity.linux />
72-
<param.compatiblity.matlabonline />
73-
<param.installation.map />
74-
<param.additional.sw.names />
75-
<param.additional.sw.licenses />
76-
<param.additional.sw.win.url />
77-
<param.additional.sw.mac.url />
78-
<param.additional.sw.linux.url />
79-
</unset>
80-
<fileset.rootdir>
81-
<file>${PROJECT_ROOT}/src</file>
82-
</fileset.rootdir>
83-
<fileset.rootfiles>
84-
<file>${PROJECT_ROOT}/src/+otp</file>
85-
</fileset.rootfiles>
86-
<fileset.depfun.included />
87-
<fileset.depfun.excluded />
88-
<fileset.package />
89-
</configuration>
90-
</deployment-project>
1+
<deployment-project plugin="plugin.toolbox" plugin-version="1.0">
2+
<configuration name="ODE Test Problems" target="target.toolbox" target-name="Package Toolbox">
3+
<param.appname>ODE Test Problems</param.appname>
4+
<param.authnamewatermark>Steven Roberts, Andrey Popov, Arash Sarshar, Ardian Sandu</param.authnamewatermark>
5+
<param.email />
6+
<param.company>Computational Science Laboratory</param.company>
7+
<param.summary>A MATLAB suite of initial value problems</param.summary>
8+
<param.description />
9+
<param.screenshot />
10+
<param.version>0.0.1</param.version>
11+
<param.output>${PROJECT_ROOT}/ODE Test Problems.mltbx</param.output>
12+
<param.products.name />
13+
<param.products.id />
14+
<param.products.version />
15+
<param.platforms />
16+
<param.guid>0970ed36-a788-484f-beca-105eecd2562a</param.guid>
17+
<param.exclude.filters></param.exclude.filters>
18+
<param.exclude.pcodedmfiles>true</param.exclude.pcodedmfiles>
19+
<param.examples />
20+
<param.demosxml />
21+
<param.apps />
22+
<param.registered.apps />
23+
<param.docs />
24+
<param.getting.started.guide />
25+
<param.matlabpath.excludes />
26+
<param.javaclasspath.excludes />
27+
<param.exported.on.package>false</param.exported.on.package>
28+
<param.required.addons />
29+
<param.matlab.project.id />
30+
<param.matlab.project.name />
31+
<param.release.start />
32+
<param.release.end />
33+
<param.release.current.only>false</param.release.current.only>
34+
<param.compatiblity.windows>true</param.compatiblity.windows>
35+
<param.compatiblity.macos>true</param.compatiblity.macos>
36+
<param.compatiblity.linux>true</param.compatiblity.linux>
37+
<param.compatiblity.matlabonline>true</param.compatiblity.matlabonline>
38+
<param.installation.map />
39+
<param.additional.sw.names />
40+
<param.additional.sw.licenses />
41+
<param.additional.sw.win.url />
42+
<param.additional.sw.mac.url />
43+
<param.additional.sw.linux.url />
44+
<unset>
45+
<param.email />
46+
<param.description />
47+
<param.screenshot />
48+
<param.output />
49+
<param.products.name />
50+
<param.products.id />
51+
<param.products.version />
52+
<param.platforms />
53+
<param.exclude.pcodedmfiles />
54+
<param.examples />
55+
<param.demosxml />
56+
<param.apps />
57+
<param.registered.apps />
58+
<param.docs />
59+
<param.getting.started.guide />
60+
<param.matlabpath.excludes />
61+
<param.javaclasspath.excludes />
62+
<param.exported.on.package />
63+
<param.required.addons />
64+
<param.matlab.project.id />
65+
<param.matlab.project.name />
66+
<param.release.start />
67+
<param.release.end />
68+
<param.release.current.only />
69+
<param.compatiblity.windows />
70+
<param.compatiblity.macos />
71+
<param.compatiblity.linux />
72+
<param.compatiblity.matlabonline />
73+
<param.installation.map />
74+
<param.additional.sw.names />
75+
<param.additional.sw.licenses />
76+
<param.additional.sw.win.url />
77+
<param.additional.sw.mac.url />
78+
<param.additional.sw.linux.url />
79+
</unset>
80+
<fileset.rootdir>
81+
<file>${PROJECT_ROOT}/build</file>
82+
</fileset.rootdir>
83+
<fileset.rootfiles>
84+
<file>${PROJECT_ROOT}/build/+otp</file>
85+
</fileset.rootfiles>
86+
<fileset.depfun.included />
87+
<fileset.depfun.excluded />
88+
<fileset.package />
89+
</configuration>
90+
</deployment-project>

OTP.m

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
classdef OTP
2+
properties (Access = private, Constant)
3+
Octave = exist('OCTAVE_VERSION', 'builtin') > 0
4+
Name = 'ODE Test Problems';
5+
SrcDir = 'src';
6+
BuildDir = 'build';
7+
end
8+
9+
methods (Static)
10+
function clean()
11+
[~] = rmdir(OTP.BuildDir, 's');
12+
end
13+
14+
function build()
15+
OTP.clean();
16+
17+
if OTP.Octave
18+
OTP.processFiles(OTP.SrcDir, fullfile(OTP.BuildDir, 'inst'), ...
19+
{}, {});
20+
copyfile('DESCRIPTION', OTP.BuildDir);
21+
copyfile('LICENSE', fullfile(OTP.BuildDir, 'COPYING'));
22+
zip(OTP.packagePath(), OTP.BuildDir);
23+
else
24+
OTP.processFiles(OTP.SrcDir, OTP.BuildDir, ...
25+
'\s*%\s*MATLAB ONLY:\s*', ' ');
26+
matlab.addons.toolbox.packageToolbox( ...
27+
strcat(OTP.Name, '.prj'), OTP.packagePath());
28+
end
29+
end
30+
31+
function install()
32+
OTP.build();
33+
34+
if OTP.Octave
35+
pkg('install', OTP.packagePath());
36+
else
37+
matlab.addons.toolbox.installToolbox(OTP.packagePath());
38+
end
39+
40+
fprintf('ODE Test Problems sucessfully installed\n');
41+
end
42+
43+
function uninstall()
44+
if OTP.Octave
45+
pkg('uninstall', lower(OTP.Name));
46+
else
47+
tbxs = matlab.addons.toolbox.installedToolboxes;
48+
otp = tbxs(arrayfun(@(t) strcmp(t.Name, OTP.Name), tbxs));
49+
if ~isempty(otp)
50+
matlab.addons.toolbox.uninstallToolbox(otp);
51+
end
52+
end
53+
end
54+
end
55+
56+
methods (Static, Access = private)
57+
function processFiles(src, dest, str, replacement)
58+
list = dir(src);
59+
mkdir(dest);
60+
61+
for i = 1:length(list)
62+
item = list(i);
63+
newSrc = fullfile(src, item.name);
64+
newDest = fullfile(dest, item.name);
65+
66+
if ~item.isdir
67+
[~, ~, ext] = fileparts(item.name);
68+
if strcmp(ext, '.m')
69+
content = regexprep(fileread(newSrc), str, replacement);
70+
71+
fid = fopen(newDest, 'w');
72+
fprintf(fid, '%s', content);
73+
fclose(fid);
74+
else
75+
copyfile(newSrc, newDest);
76+
end
77+
elseif ~any(strcmp(item.name, {'.', '..'}))
78+
OTP.processFiles(newSrc, newDest, str, replacement);
79+
end
80+
end
81+
end
82+
83+
function path = packagePath()
84+
if OTP.Octave
85+
ext = '.zip';
86+
else
87+
ext = '.mltbx';
88+
end
89+
90+
path = fullfile(OTP.BuildDir, strcat(OTP.Name, ext));
91+
end
92+
end
93+
94+
methods (Access = private)
95+
function obj = OTP()
96+
end
97+
end
98+
end

README.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,38 @@
11
# ODE Test Problems
22

3-
A MATLAB suite of initial value problems
3+
ODE Test Problems (OTP) is an object-oriented MATLAB/GNU Octave package offering
4+
a broad range of ordinary differential equations, partial differential
5+
equations, and differential algebraic equations which can be used to test
6+
numerical methods such as time-steppers and data assimilation methods. It
7+
contains problems that are linear and nonlinear, autonomous and nonautonomous,
8+
scalar and high-dimensional, and stiff and nonstiff. OTP also supports
9+
partitioned systems for testing IMEX methods, multirate methods, and other
10+
partitioned schemes. Many problems come from real-world applications in fields
11+
such as chemistry, astrophysics, meteorology, and electrical engineering. OTP's
12+
interface provides a simple and standardized way to access problem parameters,
13+
the right-hand side function, the Jacobian matrix, and other properties. Each
14+
problem is equipped with functions for computing the solution, plotting the
15+
solution, and creating a movie.
16+
17+
Although OTP is currently under development, the public API is quite stable. We
18+
are currently writing full documentation in order to release version `1.0.0`.
19+
20+
If there is a test problem, additional RHS property, or new functionality you
21+
would like added to OTP, we encourage you to let us know via a
22+
[GitHub issue](https://github.com/ComputationalScienceLaboratory/ODE-Test-Problems/issues).
23+
We also accept pull requests that adhere to our
24+
[contributing guide](./docs/CONTRIBUTING.md).
425

526
## Installation
627

7-
ODE Test Problems can be installed by running the MATLAB script `install` from the root directory of the project.
28+
OTP can be installed as a local MATLAB toolbox or Octave package by running
29+
30+
```matlab
31+
OTP.install
32+
```
33+
34+
from the root directory of the project. If no longer needed, it can be
35+
uninstalled with `OTP.uninstall`.
836

937
## Example
1038

@@ -19,11 +47,11 @@ sol = problem.solve('RelTol', 1e-10);
1947
problem.plot(sol);
2048
2149
% Adjust a parameter
22-
problem.Parameters.preyDeathRate = 2;
50+
problem.Parameters.PreyDeathRate = 2;
2351
2452
% Manually use a MATLAB ODE solver to solve the problem
25-
options = odeset('Jacobian', problem.Rhs.Jacobian);
26-
[t, y] = ode15s(problem.Rhs.F, problem.TimeSpan, problem.Y0, options);
53+
options = odeset('Jacobian', problem.RHS.Jacobian);
54+
[t, y] = ode15s(problem.RHS.F, problem.TimeSpan, problem.Y0, options);
2755
2856
% Plot the phase space with a custom title
2957
problem.plotPhaseSpace(t, y, 'Title', 'The Circle of Life');

0 commit comments

Comments
 (0)