Skip to content

Commit

Permalink
Merge pull request #28 from jschueller/sundials5
Browse files Browse the repository at this point in the history
Sundials 5.x port
Also contains lots of updates to line endings, now everything is LF.
  • Loading branch information
modelonrobinandersson authored Nov 4, 2021
2 parents 12e8bc1 + fcd3899 commit acda42a
Show file tree
Hide file tree
Showing 76 changed files with 21,403 additions and 21,394 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--- CHANGELOG ---

--- Assimulo-3.2.8 ---
* Sundials 5.x port

--- Assimulo-3.2.7 ---
* Resolved deprecation warnings visible when using numpy 1.20.
* Resolved deprecation warnings visible when creating an ndarray from ragged nested sequences.
Expand Down
348 changes: 174 additions & 174 deletions doc/sphinx/source/markup.py

Large diffs are not rendered by default.

76 changes: 38 additions & 38 deletions doc/sphinx/source/museum.rst
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@


=============
The Museum
=============

Assimulo includes an ODE solver museum. Integrators written in FORTRAN and C
were developped at least since the mid-sixties. Many of those are hard to access
others are only available as print-outs.

``The harsch requirement that a useful numerical method must
permit an efficient, robust, and reliable implementation has
withered the beautiful flowers which bloomed on thousands of journal pages.`` [Stetter93]_


Following this motto, the Assimulo Museum aims at showing these flowers at least in an herbarium.

At the moment the Assimulo Museum includes

* DASP3 (scan)
* ODASSL

wrapping is in preperation for

* METAN1
* EULEX
* DIFFSUB
* MEXAX

.. note::

Codes marked by (scan) are reconstructed from a scan and an OCR process. They are tested but
still they might include bugs due to the reconstruction process.

All other codes are original and untouched.

.. [Stetter93] Hans Stetter In: Mathematics of Computation 1943-1993: A half-century
of computational mathematics: Mathematics of Computations 50th Aniversary Symposium. August 9-13, 1993. Vancouver, Britisch-Columbia, CA.)


=============
The Museum
=============

Assimulo includes an ODE solver museum. Integrators written in FORTRAN and C
were developped at least since the mid-sixties. Many of those are hard to access
others are only available as print-outs.

``The harsch requirement that a useful numerical method must
permit an efficient, robust, and reliable implementation has
withered the beautiful flowers which bloomed on thousands of journal pages.`` [Stetter93]_


Following this motto, the Assimulo Museum aims at showing these flowers at least in an herbarium.

At the moment the Assimulo Museum includes

* DASP3 (scan)
* ODASSL

wrapping is in preperation for

* METAN1
* EULEX
* DIFFSUB
* MEXAX

.. note::

Codes marked by (scan) are reconstructed from a scan and an OCR process. They are tested but
still they might include bugs due to the reconstruction process.

All other codes are original and untouched.

.. [Stetter93] Hans Stetter In: Mathematics of Computation 1943-1993: A half-century
of computational mathematics: Mathematics of Computations 50th Aniversary Symposium. August 9-13, 1993. Vancouver, Britisch-Columbia, CA.)
140 changes: 70 additions & 70 deletions examples/cvode_basic_backward.py
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (C) 2010 Modelon AB
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import numpy as N
import nose
from assimulo.solvers import CVode
from assimulo.problem import Explicit_Problem

def run_example(with_plots=True):
"""
The same as example :doc:`EXAMPLE_cvode_basic` but now integrated backwards in time.
on return:
- :dfn:`exp_mod` problem instance
- :dfn:`exp_sim` solver instance
"""
#Define the rhs
def f(t,y):
ydot = -y[0]
return N.array([ydot])

#Define an Assimulo problem
exp_mod = Explicit_Problem(f,t0=5, y0=0.02695, name = r'CVode Test Example (reverse time): $\dot y = - y$ ')

#Define an explicit solver
exp_sim = CVode(exp_mod) #Create a CVode solver

#Sets the parameters
exp_sim.iter = 'Newton' #Default 'FixedPoint'
exp_sim.discr = 'BDF' #Default 'Adams'
exp_sim.atol = [1e-8] #Default 1e-6
exp_sim.rtol = 1e-8 #Default 1e-6
exp_sim.backward = True

#Simulate
t, y = exp_sim.simulate(0) #Simulate 5 seconds (t0=5 -> tf=0)

#Plot
if with_plots:
import pylab as P
P.plot(t, y, color="b")
P.title(exp_mod.name)
P.ylabel('y')
P.xlabel('Time')
P.show()

#Basic test
nose.tools.assert_almost_equal(float(y[-1]), 4.00000000, 3)

return exp_mod, exp_sim

if __name__=='__main__':
mod,sim = run_example()
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (C) 2010 Modelon AB
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import numpy as N
import nose
from assimulo.solvers import CVode
from assimulo.problem import Explicit_Problem

def run_example(with_plots=True):
"""
The same as example :doc:`EXAMPLE_cvode_basic` but now integrated backwards in time.
on return:
- :dfn:`exp_mod` problem instance
- :dfn:`exp_sim` solver instance
"""
#Define the rhs
def f(t,y):
ydot = -y[0]
return N.array([ydot])

#Define an Assimulo problem
exp_mod = Explicit_Problem(f,t0=5, y0=0.02695, name = r'CVode Test Example (reverse time): $\dot y = - y$ ')

#Define an explicit solver
exp_sim = CVode(exp_mod) #Create a CVode solver

#Sets the parameters
exp_sim.iter = 'Newton' #Default 'FixedPoint'
exp_sim.discr = 'BDF' #Default 'Adams'
exp_sim.atol = [1e-8] #Default 1e-6
exp_sim.rtol = 1e-8 #Default 1e-6
exp_sim.backward = True

#Simulate
t, y = exp_sim.simulate(0) #Simulate 5 seconds (t0=5 -> tf=0)

#Plot
if with_plots:
import pylab as P
P.plot(t, y, color="b")
P.title(exp_mod.name)
P.ylabel('y')
P.xlabel('Time')
P.show()

#Basic test
nose.tools.assert_almost_equal(float(y[-1]), 4.00000000, 3)

return exp_mod, exp_sim

if __name__=='__main__':
mod,sim = run_example()
Loading

0 comments on commit acda42a

Please sign in to comment.