def mass_matrix(self, symbol, boundary_conditions):
    '\n        Calculates the mass matrix for a spatial method.\n\n        Parameters\n        ----------\n        symbol: :class:`pybamm.Variable`\n            The variable corresponding to the equation for which we are\n            calculating the mass matrix.\n        boundary_conditions : dict\n            The boundary conditions of the model\n            ({symbol.id: {"left": left bc, "right": right bc}})\n\n        Returns\n        -------\n        :class:`pybamm.Matrix`\n            The (sparse) mass matrix for the spatial method.\n        '
    submesh = self.mesh.combine_submeshes(*symbol.domain)
    n = submesh[0].npts
    prim_mass = eye(n)
    sec_pts = len(submesh)
    mass = csr_matrix(kron(eye(sec_pts), prim_mass))
    return pybamm.Matrix(mass)
Calculates the mass matrix for a spatial method.

Parameters
----------
symbol: :class:`pybamm.Variable`
    The variable corresponding to the equation for which we are
    calculating the mass matrix.
boundary_conditions : dict
    The boundary conditions of the model
    ({symbol.id: {"left": left bc, "right": right bc}})

Returns
-------
:class:`pybamm.Matrix`
    The (sparse) mass matrix for the spatial method.
def mass_matrix(self, symbol, boundary_conditions):
    '\n        Calculates the mass matrix for a spatial method.\n\n        Parameters\n        ----------\n        symbol: :class:`pybamm.Variable`\n            The variable corresponding to the equation for which we are\n            calculating the mass matrix.\n        boundary_conditions : dict\n            The boundary conditions of the model\n            ({symbol.id: {"left": left bc, "right": right bc}})\n\n        Returns\n        -------\n        :class:`pybamm.Matrix`\n            The (sparse) mass matrix for the spatial method.\n        '
    submesh = self.mesh.combine_submeshes(*symbol.domain)
    n = submesh[0].npts
    prim_mass = eye(n)
    sec_pts = len(submesh)
    mass = csr_matrix(kron(eye(sec_pts), prim_mass))
    return pybamm.Matrix(mass)