Skip to content

Commit

Permalink
Merge branch 'main' into jc/stability-analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
jcallaham committed Mar 20, 2024
2 parents 840d9a6 + e61a732 commit 892d844
Show file tree
Hide file tree
Showing 39 changed files with 816 additions and 576 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/black.yml

This file was deleted.

18 changes: 17 additions & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff codespell tomli
- name: Run Ruff
run: |
ruff check .
- name: Spelling check with codespell
run: |
codespell --toml pyproject.toml
23 changes: 23 additions & 0 deletions .github/workflows/yapf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Yapf Format

on: [push, pull_request]

jobs:
yapf:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install yapf toml
- name: Run Yapf
run: |
yapf --diff --recursive .
22 changes: 0 additions & 22 deletions .pre-commit-config.yaml

This file was deleted.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<a href="https://python.org/"><img alt="Language: Python" src="https://img.shields.io/badge/language-Python-orange.svg"></a>
<a href="https://spdx.org/licenses/MIT.html"><img alt="License WarpX" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
<a href="https://join.slack.com/t/hydrogym/shared_invite/zt-27u914dfn-UFq3CkaxiLs8dwZ_fDkBuA"><img alt="Slack" src="https://img.shields.io/badge/slack-hydrogym-brightgreen.svg?logo=slack"></a>
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
<a href="https://github.com/google/yapf"><img alt="Code style: yapf" src="https://img.shields.io/badge/code%20style-yapf-000000.svg"></a>
</p>


Expand All @@ -26,7 +26,7 @@ Currently these "environments" are all implemented using the [Firedrake](https:/
- High-level: `hydrogym.env.FlowEnv` classes implement the OpenAI `gym.Env` interface
- Intermediate: Typical CFD interface with `hydrogym.FlowConfig` and `hydrogym.TransientSolver` classes
- Low-level: Access to linearized operators and sparse scipy or PETSc CSR matrices
* __Modeling and anlysis tools:__ Global stability analysis (via SLEPc) and modal decompositions (via modred)
* __Modeling and analysis tools:__ Global stability analysis (via SLEPc) and modal decompositions (via modred)
* __Scalable:__ Individual environments parallelized with MPI with a **highly scalable [Ray](https://github.com/ray-project/ray) backend reinforcement learning training**.

# Installation
Expand All @@ -39,6 +39,9 @@ This means that the latest release of Hydrogym can be simply installed via [PyPI
pip install hydrogym
```

> BEWARE: The pip-package is currently behind the main repository, and we strongly urge users to build HydroGym
> directly from the source code. Once we've stabilized the package, we will update the pip package in turn.
However, the package assumes that the solver backend is available, so in order to run simulations locally you will
need to _separately_ ensure the solver backend is installed (again, currently all the environments are implemented with Firedrake).
Alternatively (and this is important for large-scale RL training), the core Hydrogym package can (or will soon be able to) launch reinforcement learning training on a Ray-cluster without an underlying Firedrake install.
Expand Down Expand Up @@ -79,7 +82,7 @@ For more detail, check out:

There are currently a number of main flow configurations, the most prominent of which are:

- Periodic cyclinder wake at Re=100
- Periodic cylinder wake at Re=100
- Chaotic pinball at Re=130
- Open cavity at Re=7500
- Backwards-facing step at Re=600
Expand Down
34 changes: 34 additions & 0 deletions docs/_templates/custom-class-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:show-inheritance:
:inherited-members:
:special-members: __call__, __add__, __mul__

{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
:nosignatures:
{% for item in methods %}
{%- if not item.startswith('_') %}
~{{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
66 changes: 66 additions & 0 deletions docs/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{ fullname | escape | underline}}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: Module attributes

.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree:
:nosignatures:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree:
:template: custom-class-template.rst
:nosignatures:
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
:toctree:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. autosummary::
:toctree:
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
6 changes: 6 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

hydrogym
7 changes: 0 additions & 7 deletions docs/api_reference/api.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/api_reference/index.rst

This file was deleted.

15 changes: 15 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Configuration file for the Sphinx documentation builder.
import os
import sys

sys.path.insert(0, os.path.abspath(".."))

# -- Project information

Expand All @@ -18,10 +22,15 @@
"sphinx.ext.autosummary",
"sphinx.ext.autosectionlabel",
"sphinx.ext.intersphinx",
"sphinx.ext.autodoc.typehints",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx.ext.mathjax",
]
autosummary_generate = True
autoclass_content = "both"
html_show_sourcelink = False
autodoc_inherit_docstrings = True

intersphinx_mapping = {
"rtd": ("https://docs.readthedocs.io/en/stable/", None),
Expand All @@ -31,6 +40,12 @@
intersphinx_disabled_domains = ["std"]

templates_path = ["_templates"]
autodoc_mock_imports = [
"firedrake",
"pyadjoint",
"ufl",
"mpi4py",
]

# -- Options for HTML output

Expand Down
6 changes: 3 additions & 3 deletions docs/dev_notes/index.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Developer Notes
===============
Developer Documentation
=======================

.. toctree::
:maxdepth: 1

docker_development
testing
distributed_backend
further_backend
further_backend
4 changes: 4 additions & 0 deletions docs/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 399fab98a0ccd21ea9e49f55b2e83d33
tags: 645f666f9bcd5a90fca523b33c5a78b7
10 changes: 5 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Core Features

* **Hierarchical:** Designed for analysis and controller design from a high-level black-box interface
to low-level operator access.
* High-level: `hydrogym.env.FlowEnv` classes implement the OpenAI `gym.env` interface.
* Intermediate-level: Provides a typical CFD interface with `hydrogym.FlowConfig`, and `hydrogym.TransientSolver`.
* Low-level: Enables access to linearized operators, and sparse scipy or PETSc CSR matrices.
* High-level: `hydrogym.env.FlowEnv` classes implement the OpenAI `gym.env` interface.
* Intermediate-level: Provides a typical CFD interface with `hydrogym.FlowConfig`, and `hydrogym.TransientSolver`.
* Low-level: Enables access to linearized operators, and sparse scipy or PETSc CSR matrices.
* **Modeling and Analysis Tools:** Provides global stability analysis (via SLEPc) and modal decomposition (via modred).
* **Scalable:** Individual environments parallelized with MPI with a **highly scalable** `Ray <https://github.com/ray-project/ray>`_ **backend reinforcement learning training.**

Expand All @@ -26,7 +26,7 @@ Core Features

.. toctree::
:hidden:
:maxdepth: 2
:maxdepth: 3

installation
quickstart
Expand All @@ -35,4 +35,4 @@ Core Features
integrations/index
glossary
dev_notes/index
api_reference/index
API Reference <_autosummary/hydrogym>
Loading

0 comments on commit 892d844

Please sign in to comment.