Skip to content

Commit

Permalink
test meshes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Bills committed Dec 23, 2024
1 parent 037d4b4 commit 1a606b8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/unit/test_meshes/test_meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,32 @@ def test_ghost_cells(self, submesh_types):
mesh["positive electrode"].edges[-1],
)

def test_symbolic_mesh_ghost_cells(self, submesh_types):
param = get_param()

submesh_types.update({"negative electrode": pybamm.SymbolicUniform1DSubMesh})

geometry = pybamm.battery_geometry()
param.process_geometry(geometry)

var_pts = {"x_n": 10, "x_s": 10, "x_p": 12, "r_n": 5, "r_p": 6}

# create mesh
mesh = pybamm.Mesh(geometry, submesh_types, var_pts)

lgs_submesh = mesh["negative electrode_left ghost cell"]
rgs_submesh = mesh["negative electrode_right ghost cell"]
submesh = mesh["negative electrode"]

np.testing.assert_array_equal(
lgs_submesh.edges[1] * lgs_submesh.length + lgs_submesh.min,
submesh.edges[0],
)
np.testing.assert_array_equal(
rgs_submesh.edges[0] * rgs_submesh.length + rgs_submesh.min,
submesh.edges[-1] * submesh.length + submesh.min,
)

def test_mesh_coord_sys(self, submesh_types):
param = get_param()

Expand Down

0 comments on commit 1a606b8

Please sign in to comment.