Skip to content

Commit

Permalink
Add transient to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tlroy committed Dec 8, 2023
1 parent 4f9d843 commit d72cdd9
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
7 changes: 5 additions & 2 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
API
===

EchemSolver class
-----------------
EchemSolver classes
-------------------

.. autoclass:: echemfem.EchemSolver
:members:

.. autoclass:: echemfem.TransientEchemSolver
:members:

Utility meshes
--------------
These are boundary layer meshes, which are modified versions of :func:`firedrake.utility_meshes.IntervalMesh` and :func:`firedrake.utility_meshes.RectangleMesh`.
Expand Down
2 changes: 2 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
'firedrake': ('https://firedrakeproject.org/', None),
}
Expand All @@ -36,3 +37,4 @@

# -- Options for EPUB output
epub_show_urls = 'footnote'

41 changes: 40 additions & 1 deletion docs/source/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ The first step of writing an EchemFEM script is to import the ``EchemSolver`` cl
from echemfem import EchemSolver
This is an abstract class, which we will use as the base class for a specific model.
or for a transient simulation, the ``TransientEchemSolver`` class:

.. code-block::
from echemfem import TransientEchemSolver
These are abstract classes, which we will use as the base class for a specific model.
To create a customized solver, the user should set the following inputs:

.. toctree::
Expand All @@ -20,3 +26,36 @@ To create a customized solver, the user should set the following inputs:
boundary_conditions
echem_params

Here is a barebone example of how a user might define their own solver.
Several concrete examples can be found in `echemfem/examples
<https://github.com/LLNL/echemfem/tree/main/examples>`_.

.. code-block::
class MySolver(EchemSolver): # or TransientEchemSolver
def __init__(self):
# Here define all custom parameters that may require attributes
super().__init__(...) # with appropriate arguments
def set_boundary_markers(self):
self.boundary_markers = ...
# and some other methods that need to be defined
Then, to run the simulation, create the object and run the ``solve`` method.

.. code-block::
solver = MySolver()
solver.solve()
For transient cases, a temporal grid defined as a ``list`` or
``numpy.ndarray`` must be provided. For example,

.. code-block::
import numpy as np
times = np.linspace(0, 11, 1) # 10 timesteps of size 0.1
solver.solve(times)
2 changes: 1 addition & 1 deletion echemfem/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2605,7 +2605,7 @@ def solve(self, times):
"""Solves the transient problem and outputs the solutions
Args:
times (list or numpy.array): array of the discrete temporal grid
times (list or :class:`numpy.ndarray`): array of the discrete temporal grid
"""

Expand Down

0 comments on commit d72cdd9

Please sign in to comment.