1D Sub Meshes#
- class pybamm.SubMesh1D(edges, coord_sys, tabs=None)[source]#
1D submesh class. Contains the position of the nodes, the number of mesh points, and (optionally) information about the tab locations.
- 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
- class pybamm.Uniform1DSubMesh(lims, npts)[source]#
A class to generate a uniform submesh on a 1D domain
- Parameters:
- class pybamm.Exponential1DSubMesh(lims, npts, side='symmetric', stretch=None)[source]#
A class to generate a submesh on a 1D domain in which the points are clustered close to one or both of boundaries using an exponential formula on the interval [a,b].
If side is “left”, the gridpoints are given by
\[x_{k} = (b-a) + \frac{\mathrm{e}^{\alpha k / N} - 1}{\mathrm{e}^{\alpha} - 1} + a,\]for k = 1, …, N, where N is the number of nodes.
Is side is “right”, the gridpoints are given by
\[x_{k} = (b-a) + \frac{\mathrm{e}^{-\alpha k / N} - 1}{\mathrm{e}^{-\alpha} - 1} + a,\]for k = 1, …, N.
If side is “symmetric”, the first half of the interval is meshed using the gridpoints
\[x_{k} = (b/2-a) + \frac{\mathrm{e}^{\alpha k / N} - 1}{\mathrm{e}^{\alpha} - 1} + a,\]for k = 1, …, N. The grid spacing is then reflected to contruct the grid on the full interval [a,b].
In the above, 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).
- 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.
side (str, optional) – Whether the points are clustered near to the left or right boundary, or both boundaries. Can be “left”, “right” or “symmetric”. Default is “symmetric”
stretch (float, optional) – The factor (alpha) which appears in the exponential. If side is “symmetric” then the default stretch is 1.15. If side is “left” or “right” then the default stretch is 2.3.
- class pybamm.Chebyshev1DSubMesh(lims, npts, tabs=None)[source]#
A class to generate a submesh on a 1D domain using 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 edges, so that the mesh edges are given by
\[a < x_{1} < ... < x_{N} < b.\]- 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.
tabs (dict, optional) – A dictionary that contains information about the size and location of the tabs
- class pybamm.UserSupplied1DSubMesh(lims, npts, edges=None)[source]#
A class to generate a submesh on a 1D domain from a user supplied array of edges.
- 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.
edges (array_like) – The array of points which correspond to the edges of the mesh.