python_api.rst.txt - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
HTML git clone git://src.adamsgaard.dk/sphere
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
python_api.rst.txt (1227B)
---
1 Python API
2 ==========
3 The Python module ``sphere`` is intended as the main interface to the ``sphere``
4 application. It is recommended to use this module for simulation setup,
5 simulation execution, and analysis of the simulation output data.
6
7 Using the module
8 ----------------
9
10 The package lives in ``python/sphere/``. Use it from the repository root with
11 ``PYTHONPATH=python``.
12
13 .. code-block:: sh
14
15 PYTHONPATH=python python3 experiments/collision.py
16
17 Most workflows follow this pattern: create :class:`sphere.sim`, initialize
18 particles and parameters, call :meth:`sphere.sim.writebin`, run the compiled
19 binary with :meth:`sphere.sim.run` or ``./sphere``, then read outputs with
20 :meth:`sphere.sim.readlast` or related helpers.
21
22 Sample usage
23 ------------
24 Below is a simple, annotated example of how to setup, execute, and post-process
25 a ``sphere`` simulation. The example is also found in the ``experiments/``
26 folder as ``collision.py``.
27
28 .. literalinclude:: ../../experiments/collision.py
29 :language: python
30 :linenos:
31
32 The full documentation of the ``sphere`` Python API can be found below.
33
34
35 The ``sphere`` module
36 ---------------------
37 .. automodule:: sphere
38 :members:
39 :imported-members:
40 :inherited-members:
41