Skip to content

Commit

Permalink
#617 fix 2D SubMesh docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
rtimms committed Oct 15, 2019
1 parent 8bc32b7 commit 0c8ab93
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pybamm/meshes/scikit_fem_submeshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ScikitUniform2DSubMesh(ScikitSubMesh2D):
A dictionary that contains information about the size and location of
the tabs
**Extends:"": :class:`pybamm.SubMesh2D`
**Extends:"": :class:`pybamm.ScikitSubMesh2D`
"""

def __init__(self, lims, npts, tabs):
Expand Down Expand Up @@ -209,11 +209,17 @@ class ScikitExponential2DSubMesh(ScikitSubMesh2D):
stretch : float, optional
The factor (alpha) which appears in the exponential. Default is 2.3.
**Extends:"": :class:`pybamm.SubMesh2D`
**Extends:"": :class:`pybamm.ScikitSubMesh2D`
"""

def __init__(self, lims, npts, tabs, side="top", stretch=2.3):

# check side is top
if side != "top":
raise pybamm.GeometryError(
"At present, side can only be 'top', but is set to ".format(side)
)

# check that two variables have been passed in
if len(lims) != 2:
raise pybamm.GeometryError(
Expand Down Expand Up @@ -246,14 +252,12 @@ def __init__(self, lims, npts, tabs, side="top", stretch=2.3):
lims[var]["min"], lims[var]["max"], npts[var.id]
)
elif var.name == "z":
# Strech factor. TODO: allow parameters to be passed to mesh
alpha = 2.3
ii = np.array(range(0, npts[var.id]))
a = lims[var]["min"]
b = lims[var]["max"]
edges[var.name] = (b - a) * (
np.exp(-alpha * ii / (npts[var.id] - 1)) - 1
) / (np.exp(-alpha) - 1) + a
np.exp(-stretch * ii / (npts[var.id] - 1)) - 1
) / (np.exp(-stretch) - 1) + a

super().__init__(edges, coord_sys, tabs)

Expand Down Expand Up @@ -288,7 +292,7 @@ class ScikitChebyshev2DSubMesh(ScikitSubMesh2D):
A dictionary that contains information about the size and location of
the tabs
**Extends:"": :class:`pybamm.SubMesh2D`
**Extends:"": :class:`pybamm.ScikitSubMesh2D`
"""

def __init__(self, lims, npts, tabs):
Expand Down Expand Up @@ -361,7 +365,7 @@ class UserSupplied2DSubMesh(ScikitSubMesh2D):
The array of points which correspond to the edges in the z direction
of the mesh.
**Extends:"": :class:`pybamm.SubMesh2D`
**Extends:"": :class:`pybamm.ScikitSubMesh2D`
"""

def __init__(self, lims, npts, tabs, y_edges=None, z_edges=None):
Expand Down

0 comments on commit 0c8ab93

Please sign in to comment.