2D Sub Meshes#

class pybamm.ScikitSubMesh2D(edges, coord_sys, tabs)[source]#

2D submesh class. Contains information about the 2D finite element mesh. Note: This class only allows for the use of piecewise-linear triangular finite elements.

Parameters:
  • edges (array_like) – An array containing the points corresponding to the edges of the submesh

  • coord_sys (string) – The coordinate system of the submesh

  • tabs (dict, optional) – A dictionary that contains information about the size and location of the tabs

Extends: pybamm.meshes.meshes.SubMesh

on_boundary(y, z, tab)[source]#

A method to get the degrees of freedom corresponding to the subdomains for the tabs.

class pybamm.ScikitUniform2DSubMesh(lims, npts)[source]#

Contains information about the 2D finite element mesh with uniform grid spacing (can be different spacing in y and z). Note: This class only allows for the use of piecewise-linear triangular finite elements.

Parameters:
  • lims (dict) – A dictionary that contains the limits of each spatial variable

  • npts (dict) – A dictionary that contains the number of points to be used on each spatial variable

Extends: pybamm.meshes.scikit_fem_submeshes.ScikitSubMesh2D

class pybamm.ScikitExponential2DSubMesh(lims, npts, side='top', stretch=2.3)[source]#

Contains information about the 2D finite element mesh generated by taking the tensor product of a uniformly spaced grid in the y direction, and a unequally spaced grid in the z direction in which the points are clustered close to the top boundary using an exponential formula on the interval [a,b]. The gridpoints in the z direction are given by

\[z_{k} = (b-a) + \frac{\exp{-\alpha k / N} - 1}{\exp{-\alpha} - 1} + a,\]

for k = 1, …, N, where N is the number of nodes. Here alpha is a stretching factor. As the number of gridpoints tends to infinity, the ratio of the largest and smallest grid cells tends to exp(alpha).

Note: in the future this will be extended to allow points to be clustered near any of the boundaries.

Parameters:
  • lims (dict) – A dictionary that contains the limits of each spatial variable

  • npts (dict) – A dictionary that contains the number of points to be used on each spatial variable

  • side (str, optional) – Whether the points are clustered near to a particular boundary. At present, can only be “top”. Default is “top”.

  • stretch (float, optional) – The factor (alpha) which appears in the exponential. Default is 2.3.

Extends: pybamm.meshes.scikit_fem_submeshes.ScikitSubMesh2D

class pybamm.ScikitChebyshev2DSubMesh(lims, npts)[source]#

Contains information about the 2D finite element mesh generated by taking the tensor product of two 1D meshes which use Chebyshev nodes on the interval (a, b), given by

\[x_{k} = \frac{1}{2}(a+b) + \frac{1}{2}(b-a) \cos(\frac{2k-1}{2N}\pi),\]

for k = 1, …, N, where N is the number of nodes. Note: this mesh then appends the boundary edgess, so that the 1D mesh edges are given by

\[a < x_{1} < ... < x_{N} < b.\]

Note: This class only allows for the use of piecewise-linear triangular finite elements.

Parameters:
  • lims (dict) – A dictionary that contains the limits of each spatial variable

  • npts (dict) – A dictionary that contains the number of points to be used on each spatial variable

Extends: pybamm.meshes.scikit_fem_submeshes.ScikitSubMesh2D

class pybamm.UserSupplied2DSubMesh(lims, npts, y_edges=None, z_edges=None)[source]#

A class to generate a tensor product submesh on a 2D domain by using two user supplied vectors of edges: one for the y-direction and one for the z-direction. Note: this mesh should be created using UserSupplied2DSubMeshGenerator.

Parameters:
  • lims (dict) – A dictionary that contains the limits of the spatial variables

  • npts (dict) – A dictionary that contains the number of points to be used on each spatial variable. Note: the number of nodes (located at the cell centres) is npts, and the number of edges is npts+1.

  • y_edges (array_like) – The array of points which correspond to the edges in the y direction of the mesh.

  • z_edges (array_like) – The array of points which correspond to the edges in the z direction of the mesh.

Extends: pybamm.meshes.scikit_fem_submeshes.ScikitSubMesh2D