Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexfikl/pyshocks

Automatic Differentiation + Adjoint + Shocks Experiments
https://github.com/alexfikl/pyshocks

adjoint-method automatic-differentiation jax shocks weno

Last synced: 2 months ago
JSON representation

Automatic Differentiation + Adjoint + Shocks Experiments

Awesome Lists containing this project

README

        

.. image:: https://github.com/alexfikl/pyshocks/workflows/CI/badge.svg
:alt: Build Status
:target: https://github.com/alexfikl/pyshocks/actions?query=branch%3Amain+workflow%3ACI

.. image:: https://readthedocs.org/projects/pyshocks/badge/?version=latest
:alt: Documentation
:target: https://pyshocks.readthedocs.io/en/latest/?badge=latest

About
=====

This repository contains some preliminary experiments on performing adjoint-based
optimization of systems with shocks by using automatic differentiation. The
main goal is to get it working for the one-dimensional unsteady Euler equations
with common WENO schemes.

It is currently quite far from that goal, so this is **very experimental**.

**Caution**: As you might be able to tell, development on this has pretty much
stopped at this point. The code is still updated for newer versions of things
(``jax`` and ``numpy``), but no new features are added.

Requirements
============

The project currently supports Python 3.8 and later. The (full) requirements are
listed in ``pyproject.toml``.

* ``jax`` and ``jaxlib``: base numeric and automatic differentiation package
used throughout. See
`JAX support policy `__
for details on supported versions.
* ``rich``: recommended for nicer logging.
* ``matplotlib`` and ``SciencePlots``: recommended for nicer plotting.

For development, it is recommended to run

.. code:: bash

python -m pip install -e '.[dev,vis]'

A pinned version of all the requirements is kept in ``requirements.txt``.
For a quick install with the versions that are currently being tested on the CI

.. code:: bash

python -m pip install -r requirements.txt -e .

or use ``requirements-dev.txt`` to also install development packages
(e.g. ``ruff``).

Documentation
=============

Documentation can be generated using `Sphinx `__.
For example, to generate a nice HTML-based variant go

.. code:: bash

cd docs && make html
xdg-open _build/html/index.html

Sphinx ca can also generate LaTeX documentation with

.. code:: bash

make latex && cd _build/latex && make
xdg-open pyshocks.pdf

The documentation is also hosted on
`readthedocs `__.