Skip to content

Feature/gifs #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d2da41d
added base for gif generation
elswit May 30, 2023
149a514
added gui boxes for movie generation
elswit Jun 2, 2023
bcf85cb
removed junk files
elswit Jun 2, 2023
97d87a3
fixed movie size bug
elswit Jun 2, 2023
bf1e840
fine tunning the script
elswit Jun 4, 2023
9abff9b
up animations script, adding a test webm
elswit Jun 26, 2023
50227b3
testing webm embedding
elswit Jun 26, 2023
50dd4e0
testin animation embeddings
elswit Jun 26, 2023
bc32cb5
testing gif embeddings
elswit Jun 26, 2023
05e1aca
testing animations
elswit Jun 26, 2023
f1702c6
added nbody animation
elswit Jun 26, 2023
aaa84f1
added nbody animation
elswit Jun 26, 2023
86eec50
added more animations
elswit Jun 26, 2023
65f4059
added more animations
elswit Jun 26, 2023
910fe86
Update README.md
elswit Jun 26, 2023
6a43fdb
rebased gifs branch from master
elswit Jun 26, 2023
ea0b2b0
Update README.md
elswit Jun 26, 2023
06467c3
Update README.md
elswit Jun 26, 2023
362de7e
Update README.md
elswit Jun 27, 2023
3c5ec81
added loop to all gifs
elswit Jun 27, 2023
545eb45
up script
elswit Jun 27, 2023
b1e4754
Update README.md
elswit Jun 28, 2023
fd10495
Update README.md
elswit Jun 28, 2023
a4a02ab
added QG gif
elswit Jun 29, 2023
6723354
Merge branch 'feature/gifs' of https://github.com/ComputationalScienc…
elswit Jun 29, 2023
f06b3db
removed large gif
elswit Jun 29, 2023
336dae9
Update README.md
elswit Jul 7, 2023
fc46d7f
Update README.md
elswit Jul 7, 2023
23365e1
Update README.md
elswit Jul 7, 2023
c52ce9d
Merge branch 'feature/gifs' of https://github.com/ComputationalScienc…
elswit Jul 8, 2023
a09c087
moved animations to sub dir in images
elswit Jul 8, 2023
9b20b25
moved animations to sub dir in images
elswit Jul 8, 2023
956e640
Update README.md
elswit Jul 12, 2023
737cfee
up movie script
elswit Oct 25, 2023
9135d66
added webm files
elswit Oct 25, 2023
8e68ff5
Update README.md
elswit Oct 25, 2023
d84aba7
Merge branch 'master' into feature/gifs
elswit Sep 23, 2024
e2d1c5f
Update README.md
elswit Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@
<img width="30%" src="images/logo.png" alt="ODE Test Problems" title="ODE Test Problems">
</p>


ODE Test Problems (<code>OTP</code>) is an object-oriented Matlab/Octave package offering a broad range of initial value problems in the form of ordinary and differential-algebraic equations that can be used to test numerical methods such as time integration or data assimilation. It includes problems that are linear and nonlinear, homogeneous and nonhomogeneous, autonomous and nonautonomous, scalar and high-dimensional, stiff and nonstiff, and chaotic and nonchaotic. Many are real-world problems in chemistry, astrophysics, meteorology, and electrical engineering. <code>OTP</code> also supports partitioned ODEs for testing split, multirate, and other multimethods. Functions for plotting solutions and creating movies are available for all problems, and exact solutions are included when available. <code>OTP</code> is designed for ease of use &#8212;meaning that working with and modifying problems is simple and intuitive. <code>OTP</code> is actively under development. We are currently writing full documentation in order to release version <code>1.0.0</code>. </p>


[![Version](https://img.shields.io/github/v/release/ComputationalScienceLaboratory/ODE-Test-Problems?label=Version)](https://github.com/ComputationalScienceLaboratory/ODE-Test-Problems/releases)
[![License](https://img.shields.io/github/license/ComputationalScienceLaboratory/ODE-Test-Problems?label=License)](https://github.com/ComputationalScienceLaboratory/ODE-Test-Problems/blob/master/license.txt)
[![Tests](https://github.com/ComputationalScienceLaboratory/ODE-Test-Problems/actions/workflows/tests.yml/badge.svg)](https://github.com/ComputationalScienceLaboratory/ODE-Test-Problems/actions/workflows/tests.yml)
[![Documentation](https://github.com/ComputationalScienceLaboratory/ODE-Test-Problems/actions/workflows/documentation.yml/badge.svg)](https://computationalsciencelaboratory.github.io/ODE-Test-Problems/)

ODE Test Problems (OTP) is an object-oriented MATLAB/Octave package offering a broad range of initial value problems in
the form of ordinary and differential-algebraic equations that can be used to test numerical methods such as time
integration or data assimilation. It includes problems that are linear and nonlinear, homogeneous and nonhomogeneous,
autonomous and nonautonomous, scalar and high-dimensional, stiff and nonstiff, and chaotic and nonchaotic. Many are
real-world problems in fields such as chemistry, astrophysics, meteorology, and electrical engineering. OTP also
supports partitioned ODEs for testing split, multirate, and other multimethods. Functions for plotting solutions and
creating movies are available for all problems, and exact solutions are included when available. OTP is designed for
ease of use meaning that working with and modifying problems is simple and intuitive.

OTP is actively under development. We are currently writing full documentation in order to release version 1.0.0
https://github.com/ComputationalScienceLaboratory/ODE-Test-Problems/assets/5168326/e5496fee-46c0-4fb0-a42b-eb2e98374b4c


## Installation

Expand Down Expand Up @@ -76,3 +73,13 @@ problem.plotPhaseSpace(t, y, 'Title', 'The Circle of Life');
% Create a movie
mov = problem.movie(t, y);
```


## Further Reading

`ODE Test Problems` documentation is maintained on [this page](https://computationalsciencelaboratory.github.io/ODE-Test-Problems). New feature requests and bug reports can be made through
[GitHub issues](https://github.com/ComputationalScienceLaboratory/ODE-Test-Problems/issues).
We also accept pull requests that adhere to our
[contributing guide](docs/contrib.rst). An interactive tutorial on the main features of `OTP` is available in a Jupyter notebook [in the repository](/notebooks).


Binary file not shown.
Binary file added images/animations/lorenz63-Canonical.webm
Binary file not shown.
Binary file added images/animations/nbody-OuterSolarSystem.webm
Binary file not shown.
Binary file added images/animations/pendulum-Canonical.webm
Binary file not shown.
154 changes: 154 additions & 0 deletions images/makeMovie.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
function makeMovie()

%% Set animation settings

set(0,'DefaultAxesXMinorTick','on','DefaultAxesYMinorTick','on')
set(0,'DefaultAxesLineWidth', 2,'DefaultAxesFontName','Times',...
'DefaultAxesFontSize',18,'DefaultAxesBox','on')

ffmpegPath = {'/opt/homebrew/bin/ffmpeg'};

outputFormat = 'webm';
targetTime = 20;
size = [300,300];
mkdir('animations')

%% KPR Animation

problemName = 'bouncingball';
presetName = 'RandomTerrain';

filename = strcat('animations/', problemName,'-', presetName);

string = strcat(['otp.', problemName,'.presets.', presetName] );
problem = eval(string);
problem.TimeSpan = [0,30];

sol = problem.solve('RelTol', 1e-8);
mov = problem.movie(sol, 'Save', filename, ...
'TargetDuration',targetTime, ...
'Size', size, ...
'FrameRate', 15, ...
'view', [0,90]);

args = get_ffmpeg_args(outputFormat, filename);

command = strjoin(strcat([ffmpegPath,' ' , args]));
system(command);


% Nbody animation


problemName = 'nbody';
presetName = 'OuterSolarSystem';

filename = strcat('animations/', problemName,'-', presetName);

string = strcat(['otp.', problemName,'.presets.', presetName] );
problem = eval(string);

sol = problem.solve('RelTol', 1e-4);
mov = problem.movie(sol, 'Save', filename, ...
'TargetDuration',targetTime, ...
'Size', size, ...
'FrameRate', 15, ...
'view', [60,30]);

args = get_ffmpeg_args(outputFormat, filename);

command = strjoin(strcat([ffmpegPath,' ' , args]));
system(command);


%% Pendulum animation


problemName = 'pendulum';
presetName = 'Canonical';



filename = strcat('animations/', problemName,'-', presetName);
problem = otp.pendulum.presets.Canonical(4);
problem.Y0(1:4) = pi/3;
problem.Parameters.Masses = [1,1,3,3]';


sol = problem.solve('RelTol', 1e-9);
mov = problem.movie(sol, 'Save', filename, ...
'TargetDuration',targetTime, ...
'Size', size, ...
'FrameRate', 15, ...
'view', [0,90]);

args = get_ffmpeg_args(outputFormat, filename);

command = strjoin(strcat([ffmpegPath,' ' , args]));
system(command);

%% Lorenz63 animation


problemName = 'lorenz63';
presetName = 'Canonical';



filename = strcat('animations/', problemName,'-', presetName);
string = strcat(['otp.', problemName,'.presets.', presetName] );
problem = eval(string);


sol = problem.solve('RelTol', 1e-9);
problem.Y0 = sol.y(:,500);
problem.TimeSpan = [0,30];
sol = problem.solve('RelTol', 1e-9);
mov = problem.movie(sol, 'Save', filename, ...
'TargetDuration',targetTime, ...
'Size', size, ...
'FrameRate', 15, ...
'view', [60,30]);


args = get_ffmpeg_args(outputFormat, filename);

command = strjoin(strcat([ffmpegPath,' ' , args]));
system(command);
end


function [args] = get_ffmpeg_args(outputFormat, filename)

% convert vido format if neccessary
switch outputFormat
case 'avi'

case 'gif'

args = strcat(['-i ' ...
filename,'.avi ' ...
' -vf "fps=15,scale=500:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0' ...
' '...
filename,'.gif']);

case 'webm'

args = strcat(['-i ' ...
filename,'.avi ' ...
'-c:v libvpx -quality best -crf 5 -b:v 1M -c:a libvorbis '...
filename,'.webm']);

end
end











Loading