Exemplo n.º 1
0
 def test_geometry_keys(self):
     geometry = pybamm.Geometry1p1DMicro()
     for prim_sec_vars in geometry.values():
         for spatial_vars in prim_sec_vars.values():
             all(
                 self.assertIsInstance(spatial_var, pybamm.SpatialVariable)
                 for spatial_var in spatial_vars.keys())
Exemplo n.º 2
0
    def test_init_failure(self):
        geometry = pybamm.Geometry1DMacro()
        submesh_types = {
            "negative electrode":
            pybamm.MeshGenerator(pybamm.Uniform1DSubMesh),
            "separator": pybamm.MeshGenerator(pybamm.Uniform1DSubMesh),
            "positive electrode":
            pybamm.MeshGenerator(pybamm.Uniform1DSubMesh),
            "negative particle": pybamm.MeshGenerator(pybamm.Uniform1DSubMesh),
            "positive particle": pybamm.MeshGenerator(pybamm.Uniform1DSubMesh),
            "current collector": pybamm.MeshGenerator(pybamm.SubMesh0D),
        }
        with self.assertRaisesRegex(KeyError, "Points not given"):
            pybamm.Mesh(geometry, submesh_types, {})

        var = pybamm.standard_spatial_vars
        var_pts = {var.x_n: 10, var.x_s: 10, var.x_p: 12}
        geometry = pybamm.Geometry1p1DMicro()
        with self.assertRaisesRegex(KeyError, "Points not given"):
            pybamm.Mesh(geometry, submesh_types, var_pts)