Skip to content

Reactor net visualization #1624

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

Merged
merged 27 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
04f3e23
Make reactor net connections available in Python.
Naikless Jul 26, 2023
4f9d878
added draw attributes to objects in reactor.pyx
Naikless Sep 28, 2023
de48090
implement reactor network visualization with python-graphviz
Naikless Sep 28, 2023
bc3aa03
add draw methods to Reactor, ReactorNet, FlowDevice and WallBase
Naikless Sep 28, 2023
3e0d3e5
let direct `draw` edge_attr overwrite for single connection
Naikless Sep 29, 2023
72e6b80
add unittests for drawing methods
Naikless Oct 11, 2023
f80e695
add optional graphviz dependency to build pipelines
Naikless Oct 6, 2023
a6fe15f
Include ReactorSurface
Naikless Oct 12, 2023
36993f0
include wall movement
Naikless Oct 16, 2023
c91f8bc
Clean up imports and apply suggested changes in drawnetwork.py
Naikless Oct 12, 2023
f3094ea
Change new rw properties into public members of extention classes
Naikless Oct 12, 2023
9fb2e11
Ensure that drawing nodes are always given a unique name
Naikless Oct 16, 2023
1c379cc
Use graphviz' `cluster` feature to allow for grouping of reactors
Naikless Oct 16, 2023
0182637
Make keyword arguments explicit and adjust docstrings
Naikless Oct 16, 2023
3b8cffb
add `species_units` keyword to `draw_reactor`
Naikless Oct 19, 2023
a4b117e
Check for unique names, remove wrapper functions
Naikless Oct 25, 2023
6521780
adjust wall velocity representation
Naikless Nov 17, 2023
e86561e
Change `graphviz` package name in setup.cfg.in
Naikless Nov 22, 2023
4c7204a
add version tag to methods, functions and properties
Naikless Nov 22, 2023
4ad2b09
add docstrings to public cdef attributes
Naikless Nov 22, 2023
a3a47ba
rename `dot` to `graph` and `groupname` to `group_name`
Naikless Dec 13, 2023
32e87ff
split logic for walls and flow controller, reworked keywords
Naikless Dec 14, 2023
3d40049
updated tests
Naikless Dec 14, 2023
8396980
simplify attribute initiation
Naikless Dec 14, 2023
64d4370
Use pytest features in ReactorNet drawing tests
speth Jan 5, 2024
647dd90
Fix some documentation for ReactorNet drawing
speth Jan 5, 2024
acfa842
Update AUTHORS
speth Jan 5, 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
20 changes: 10 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
- name: Install Python dependencies
run: |
python3 -m pip install ruamel.yaml scons==3.1.2 numpy cython pandas pytest \
pytest-github-actions-annotate-failures pint
pytest-github-actions-annotate-failures pint graphviz
- name: Build Cantera
run: |
python3 `which scons` build env_vars=all -j2 debug=n --debug=time \
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
run: python3 -m pip install -U pip setuptools wheel
- name: Install Python dependencies
run: |
python3 -m pip install ruamel.yaml scons numpy cython pandas pytest pytest-github-actions-annotate-failures pint
python3 -m pip install ruamel.yaml scons numpy cython pandas pytest pytest-github-actions-annotate-failures pint graphviz
- name: Build Cantera
run: python3 `which scons` build env_vars=all
CXX=clang++-14 CC=clang-14 f90_interface=n extra_lib_dirs=/usr/lib/llvm/lib
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
run: $PYTHON_CMD -m pip install -U pip setuptools wheel
- name: Install Python dependencies
run: |
$PYTHON_CMD -m pip install ruamel.yaml numpy cython pandas pytest pytest-github-actions-annotate-failures pint
$PYTHON_CMD -m pip install ruamel.yaml numpy cython pandas pytest pytest-github-actions-annotate-failures pint graphviz
- name: Install Python dependencies for GH Python
if: matrix.python-version == '3.11'
run:
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
- name: Install Python dependencies
run: |
python3 -m pip install ruamel.yaml scons numpy cython pandas scipy pytest \
pytest-github-actions-annotate-failures pytest-cov gcovr pint
pytest-github-actions-annotate-failures pytest-cov gcovr pint graphviz
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v2
with:
Expand Down Expand Up @@ -412,7 +412,7 @@ jobs:
run: python3 -m pip install -U pip setuptools wheel
- name: Install Python dependencies
run: |
python3 -m pip install numpy ruamel.yaml pandas matplotlib scipy pint
python3 -m pip install numpy ruamel.yaml pandas matplotlib scipy pint graphviz
python3 -m pip install --pre --no-index --find-links dist cantera
- name: Run the examples
# See https://unix.stackexchange.com/a/392973 for an explanation of the -exec part
Expand Down Expand Up @@ -476,7 +476,7 @@ jobs:
run: |
conda install -q sundials=${{ matrix.sundials-ver }} scons numpy ruamel.yaml \
cython boost-cpp fmt=${{ matrix.fmt-ver }} eigen yaml-cpp pandas \
libgomp openblas pytest highfive
libgomp openblas pytest highfive python-graphviz
- name: Build Cantera
run: |
scons build system_fmt=y system_eigen=y system_yamlcpp=y system_sundials=y \
Expand Down Expand Up @@ -545,7 +545,7 @@ jobs:
# use boost-cpp rather than boost from conda-forge
# Install SCons >=4.4.0 to make sure that MSVC_TOOLSET_VERSION variable is present
run: |
mamba install -q '"scons>=4.4.0"' numpy cython ruamel.yaml boost-cpp eigen yaml-cpp pandas pytest highfive pint fmt=${{ matrix.fmt-ver }}
mamba install -q '"scons>=4.4.0"' numpy cython ruamel.yaml boost-cpp eigen yaml-cpp pandas pytest highfive pint python-graphviz fmt=${{ matrix.fmt-ver }}
shell: pwsh
- name: Build Cantera
run: scons build system_eigen=y system_yamlcpp=y system_highfive=y logging=debug
Expand Down Expand Up @@ -610,7 +610,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install '"scons<4.4.0"' pypiwin32 numpy ruamel.yaml cython pandas pytest pytest-github-actions-annotate-failures
python -m pip install '"scons<4.4.0"' pypiwin32 numpy ruamel.yaml cython pandas graphviz pytest pytest-github-actions-annotate-failures
- name: Restore Boost cache
uses: actions/cache@v3
id: cache-boost
Expand Down Expand Up @@ -674,7 +674,7 @@ jobs:
- name: Install Python dependencies
run: |
python3 -m pip install ruamel.yaml scons numpy cython pandas pytest \
pytest-github-actions-annotate-failures pint
pytest-github-actions-annotate-failures pint graphviz
- name: Setup Intel oneAPI environment
run: |
source /opt/intel/oneapi/setvars.sh
Expand Down Expand Up @@ -707,7 +707,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install scons pypiwin32 numpy ruamel.yaml cython h5py pandas pytest pytest-github-actions-annotate-failures pint
python -m pip install scons pypiwin32 numpy ruamel.yaml cython h5py pandas pytest pytest-github-actions-annotate-failures pint graphviz
- name: Restore Boost cache
uses: actions/cache@v3
id: cache-boost
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/post-merge-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Install Python dependencies
run: |
python3 -m pip install ruamel.yaml scons numpy pandas pytest pint \
pytest-github-actions-annotate-failures
pytest-github-actions-annotate-failures graphviz
python3 -m pip install --pre cython
- name: Build Cantera
run: python3 `which scons` build env_vars=all
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
libboost-dev gfortran libopenmpi-dev libpython3-dev \
libblas-dev liblapack-dev libhdf5-dev libfmt-dev libyaml-cpp-dev \
libgtest-dev libgmock-dev libeigen3-dev libsundials-dev \
cython3 python3-numpy python3-pandas python3-pint \
cython3 python3-numpy python3-pandas python3-pint python3-graphviz \
python3-ruamel.yaml python3-setuptools python3-wheel python3-pytest
gcc --version
- name: Install Python dependencies
Expand Down Expand Up @@ -122,7 +122,8 @@ jobs:
gcc-fortran gmock-devel gtest-devel python3 python3-cython \
python3-devel python3-numpy python3-pandas python3-pint python3-pip \
python3-pytest python3-ruamel-yaml python3-scipy python3-scons \
python3-wheel sundials-devel yaml-cpp-devel hdf5-devel highfive-devel
python3-wheel sundials-devel yaml-cpp-devel hdf5-devel highfive-devel \
python3-graphviz
- name: Build Cantera
run: |
scons build -j2 debug=n --debug=time python_package=full f90_interface=y \
Expand Down Expand Up @@ -169,7 +170,7 @@ jobs:
- name: Install Python dependencies
run: |
python3 -m pip install ruamel.yaml scons numpy cython pandas pytest \
pytest-github-actions-annotate-failures pint
pytest-github-actions-annotate-failures pint graphviz
- name: Build Cantera
run: |
python3 `which scons` build env_vars=all -j2 debug=n --debug=time \
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Thomas Fiala (@thomasfiala), Technische Universität München
David Fronczek
Mark E. Fuller (@mefuller), Technion
Sammo Gabay (@Burkenyo)
Niclas Garan (@Naikless), Technische Universität Berlin
Matteo Giani (@MarcDuQuesne)
Dave Goodwin, California Institute of Technology
China Hagström (@chinahg), Massachusetts Institute of Technology
Expand Down
51 changes: 33 additions & 18 deletions doc/sphinx/python/zerodim.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,78 +40,78 @@ Reservoir

Reactor
^^^^^^^
.. autoclass:: Reactor
.. autoclass:: Reactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

MoleReactor
^^^^^^^^^^^
.. autoclass:: MoleReactor(contents=None, *, name=None, energy='on')
.. autoclass:: MoleReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

IdealGasReactor
^^^^^^^^^^^^^^^
.. autoclass:: IdealGasReactor(contents=None, *, name=None, energy='on')
.. autoclass:: IdealGasReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

IdealGasMoleReactor
^^^^^^^^^^^^^^^^^^^
.. autoclass:: IdealGasMoleReactor(contents=None, *, name=None, energy='on')
.. autoclass:: IdealGasMoleReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

ConstPressureReactor
^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ConstPressureReactor(contents=None, *, name=None, energy='on')
.. autoclass:: ConstPressureReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

ConstPressureMoleReactor
^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ConstPressureMoleReactor(contents=None, *, name=None, energy='on')
.. autoclass:: ConstPressureMoleReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

IdealGasConstPressureReactor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: IdealGasConstPressureReactor(contents=None, *, name=None, energy='on')
.. autoclass:: IdealGasConstPressureReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

IdealGasConstPressureMoleReactor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: IdealGasConstPressureMoleReactor(contents=None, *, name=None, energy='on')
.. autoclass:: IdealGasConstPressureMoleReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

FlowReactor
^^^^^^^^^^^
.. autoclass:: FlowReactor(contents=None, *, name=None, energy='on')
.. autoclass:: FlowReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

ExtensibleReactor
^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleReactor(contents=None, *, name=None, energy='on')
.. autoclass:: ExtensibleReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

ExtensibleIdealGasReactor
^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleIdealGasReactor(contents=None, *, name=None, energy='on')
.. autoclass:: ExtensibleIdealGasReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

ExtensibleConstPressureReactor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleConstPressureReactor(contents=None, *, name=None, energy='on')
.. autoclass:: ExtensibleConstPressureReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

ExtensibleIdealGasConstPressureReactor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleIdealGasConstPressureReactor(contents=None, *, name=None, energy='on')
.. autoclass:: ExtensibleIdealGasConstPressureReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

ExtensibleMoleReactor
^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleMoleReactor(contents=None, *, name=None, energy='on')
.. autoclass:: ExtensibleMoleReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

ExtensibleIdealGasMoleReactor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleIdealGasMoleReactor(contents=None, *, name=None, energy='on')
.. autoclass:: ExtensibleIdealGasMoleReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

ExtensibleConstPressureMoleReactor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleConstPressureMoleReactor(contents=None, *, name=None, energy='on')
.. autoclass:: ExtensibleConstPressureMoleReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

ExtensibleIdealGasConstPressureMoleReactor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: ExtensibleIdealGasConstPressureMoleReactor(contents=None, *, name=None, energy='on')
.. autoclass:: ExtensibleIdealGasConstPressureMoleReactor(contents=None, *, name=None, energy='on', node_attr=None, group_name="")

Walls
-----

Wall
^^^^
.. autoclass:: Wall(left, right, *, name=None, A=None, K=None, U=None, Q=None, velocity=None)
.. autoclass:: Wall(left, right, *, name=None, A=None, K=None, U=None, Q=None, velocity=None, edge_attr=None)
:inherited-members:

Surfaces
Expand Down Expand Up @@ -145,3 +145,18 @@ Preconditioners
AdaptivePreconditioner
^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: AdaptivePreconditioner

Drawing Reactor Networks
------------------------
These functions provide the implementation behind the ``draw`` methods of the
corresponding classes.

.. autofunction:: cantera.drawnetwork.draw_reactor

.. autofunction:: cantera.drawnetwork.draw_reactor_net

.. autofunction:: cantera.drawnetwork.draw_surface

.. autofunction:: cantera.drawnetwork.draw_flow_controllers

.. autofunction:: cantera.drawnetwork.draw_walls
Loading