Skip to content

HugoMVale/daskr

Repository files navigation

daskr

Modernized version of DASKR, a differential-algebraic system solver with rootfinding.

Test codecov Language

Solution of food web problem

Note

This is a work in progress. I've modernized the examples and the preconditioners, and I'm now working on the library code itself.

Description

daskr is a library for solving systems of differential-algebraic equations of the form:

$$ G(t, y, \dot{y}) = 0 $$ $$ y(t_0) = y_0 $$ $$ \dot{y}(t_0) = \dot{y}_0 $$

where $G$, $y$, and $\dot{y}$ are $N$-dimensional vectors. The linear systems which arise at each time step can be solved with dense or banded direct methods (Gaussian elimination with partial pivoting) or with iterative Krylov methods (preconditioned GMRES). Additionally, it includes the ability to find the roots of a given set of functions while carrying out the integration.

History

The first version of the library, named DASSL 1, solved the linear systems arising from the implicit time integration methods at each time step using direct methods. DASPK 23 extended the capabilities of DASSL to include iterative methods, which can be significantly more efficient, especially for large-scale problems. Furthermore, DASPK added the ability to initialize $\dot{y}_0$ in case it is not known. Lastly, DASKR 4 included the ability to find the roots of a given set of functions while integrating the DAE system.

Version Date written Last update Direct solver Iterative solver Root finding Standard
daskr 2025 -- Fortran 2018
DASKR 2002 2011 FORTRAN 77
DASPK 1989 2000 FORTRAN 77
DASSL 1983 2000 FORTRAN 77

daskr is a modernization of the DASKR code [4], intended to make the library easier to use and maintain. The main changes include:

  • Conversion from fixed-form (.f) to free-form (.f90).
  • Conversion from upper case to lower case.
  • Modularization.
  • Removal of DATA statements, labeled do loops, and (most) gotos.
  • Addition of intent(in/out) to all procedures.
  • Addition of explicit interfaces to BLAS routines.
  • Implementation of a C API.
  • Automatic code documentation with FORD.

Build instructions

With fpm

The easiest way to build/test the code and run the examples is by means of fpm.

To build the library, do:

fpm build --profile release

To run the tests, do:

fpm test --profile release

To run the provided examples, do:

fpm run --example "example_name" --profile release

With meson

First, setup the build:

meson setup builddir -Dbuild_tests=true

To build the libraries, do:

meson compile -C builddir

To run the tests, do:

meson test -C builddir

Licence

  • The original daskr code is covered by this license.
  • Modifications introduced in this project are covered under the MIT license.

References

Footnotes

  1. L. Petzold, "A Description of DASSL: A Differential/Algebraic System Solver, 1982.

  2. Brown, Peter N., Alan C. Hindmarsh, and Linda R. Petzold. "Using Krylov methods in the solution of large-scale differential-algebraic systems." SIAM Journal on Scientific Computing 15.6 (1994): 1467-1488. https://doi.org/10.1137/0915088

  3. Brown, Peter N., Alan C. Hindmarsh, and Linda R. Petzold. "Consistent initial condition calculation for differential-algebraic systems." SIAM Journal on Scientific Computing 19.5 (1998): 1495-1512. https://doi.org/10.1137/S1064827595289996

  4. Original source code from Netlib.

About

Modernized version of DASKR, a differential-algebraic system solver with rootfinding.

Topics

Resources

License

Stars

Watchers

Forks