-
-
Notifications
You must be signed in to change notification settings - Fork 738
Remove unused cylindrical battery geometry support #4875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
a15b8c4
f118e4d
d492de4
53f959e
ef3b104
4c9b3e6
931323b
ee63932
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,6 @@ | |
| get_mesh_for_testing, | ||
| get_p2d_mesh_for_testing, | ||
| get_1p1d_mesh_for_testing, | ||
| get_cylindrical_mesh_for_testing, | ||
| get_mesh_for_testing_symbolic, | ||
| get_spherical_mesh_for_testing_symbolic, | ||
| get_cylindrical_mesh_for_testing_symbolic, | ||
|
|
@@ -74,67 +73,6 @@ def test_grad_div_shapes_Dirichlet_bcs(self): | |
| atol=1e-6, | ||
| ) | ||
|
|
||
| def test_cylindrical_grad_div_shapes_Dirichlet_bcs(self): | ||
|
||
| """ | ||
| Test grad and div with Dirichlet boundary conditions in cylindrical polar | ||
| coordinates | ||
| """ | ||
| # Create discretisation | ||
| mesh = get_cylindrical_mesh_for_testing() | ||
| spatial_methods = {"current collector": pybamm.FiniteVolume()} | ||
| disc = pybamm.Discretisation(mesh, spatial_methods) | ||
| submesh = mesh["current collector"] | ||
| npts = submesh.npts | ||
| npts_edges = submesh.npts + 1 | ||
|
|
||
| # Test gradient of a constant is zero | ||
| # grad(1) = 0 | ||
| constant_y = np.ones((npts, 1)) | ||
| var = pybamm.Variable( | ||
| "var", | ||
| domain=["current collector"], | ||
| ) | ||
| grad_eqn = pybamm.grad(var) | ||
| boundary_conditions = { | ||
| var: { | ||
| "left": (pybamm.Scalar(1), "Dirichlet"), | ||
| "right": (pybamm.Scalar(1), "Dirichlet"), | ||
| } | ||
| } | ||
| disc.bcs = boundary_conditions | ||
| disc.set_variable_slices([var]) | ||
| grad_eqn_disc = disc.process_symbol(grad_eqn) | ||
| np.testing.assert_array_equal( | ||
| grad_eqn_disc.evaluate(None, constant_y), np.zeros((npts_edges, 1)) | ||
| ) | ||
|
|
||
| # Test operations on linear and quadratic in r | ||
| N = pybamm.grad(var) | ||
| div_eqn = pybamm.div(N) | ||
| boundary_conditions = { | ||
| var: { | ||
| "left": (pybamm.Scalar(submesh.edges[0]), "Dirichlet"), | ||
| "right": (pybamm.Scalar(1), "Dirichlet"), | ||
| } | ||
| } | ||
| disc.bcs = boundary_conditions | ||
| # grad(r) == 1 | ||
| y_linear = submesh.nodes | ||
| grad_eqn_disc = disc.process_symbol(grad_eqn) | ||
| np.testing.assert_allclose( | ||
| grad_eqn_disc.evaluate(None, y_linear), | ||
| np.ones((npts_edges, 1)), | ||
| rtol=1e-7, | ||
| atol=1e-6, | ||
| ) | ||
| # div(grad r^2) = 4 | ||
| y_squared = submesh.nodes**2 | ||
| div_eqn_disc = disc.process_symbol(div_eqn) | ||
| div_eval = div_eqn_disc.evaluate(None, y_squared) | ||
| np.testing.assert_allclose( | ||
| div_eval[1:-1], 4 * np.ones((npts - 2, 1)), rtol=1e-7, atol=1e-6 | ||
| ) | ||
|
|
||
| def test_spherical_grad_div_shapes_Dirichlet_bcs(self): | ||
| """ | ||
| Test grad and div with Dirichlet boundary conditions in spherical polar | ||
|
|
@@ -388,74 +326,6 @@ def test_grad_div_shapes_Dirichlet_and_Neumann_bcs(self): | |
| atol=1e-6, | ||
| ) | ||
|
|
||
| def test_cylindrical_grad_div_shapes_Neumann_bcs(self): | ||
|
||
| """ | ||
| Test grad and div with Neumann boundary conditions in cylindrical polar | ||
| coordinates | ||
| """ | ||
| # Create discretisation | ||
| mesh = get_cylindrical_mesh_for_testing() | ||
| spatial_methods = {"current collector": pybamm.FiniteVolume()} | ||
| disc = pybamm.Discretisation(mesh, spatial_methods) | ||
| submesh = mesh["current collector"] | ||
| npts = submesh.npts | ||
| npts_edges = submesh.npts + 1 | ||
|
|
||
| # Test gradient | ||
| var = pybamm.Variable("var", domain="current collector") | ||
| grad_eqn = pybamm.grad(var) | ||
| # grad(1) = 0 | ||
| constant_y = np.ones((npts, 1)) | ||
| boundary_conditions = { | ||
| var: { | ||
| "left": (pybamm.Scalar(0), "Neumann"), | ||
| "right": (pybamm.Scalar(0), "Neumann"), | ||
| } | ||
| } | ||
| disc.bcs = boundary_conditions | ||
| disc.set_variable_slices([var]) | ||
| grad_eqn_disc = disc.process_symbol(grad_eqn) | ||
| np.testing.assert_array_equal( | ||
| grad_eqn_disc.evaluate(None, constant_y), np.zeros((npts_edges, 1)) | ||
| ) | ||
| # grad(r) = 1 | ||
| y_linear = submesh.nodes | ||
| boundary_conditions = { | ||
| var: { | ||
| "left": (pybamm.Scalar(1), "Neumann"), | ||
| "right": (pybamm.Scalar(1), "Neumann"), | ||
| } | ||
| } | ||
| disc.bcs = boundary_conditions | ||
| disc.set_variable_slices([var]) | ||
| grad_eqn_disc = disc.process_symbol(grad_eqn) | ||
| np.testing.assert_allclose( | ||
| grad_eqn_disc.evaluate(None, y_linear), | ||
| np.ones((npts_edges, 1)), | ||
| rtol=1e-7, | ||
| atol=1e-6, | ||
| ) | ||
|
|
||
| # Test divergence | ||
| # div(grad(r^2)) = 4 , N_left = 2*r_inner, N_right = 2 | ||
| y_squared = submesh.nodes**2 | ||
| N = pybamm.grad(var) | ||
| div_eqn = pybamm.div(N) | ||
| boundary_conditions = { | ||
| var: { | ||
| "left": (pybamm.Scalar(2 * submesh.edges[0]), "Neumann"), | ||
| "right": (pybamm.Scalar(2), "Neumann"), | ||
| } | ||
| } | ||
| disc.bcs = boundary_conditions | ||
| div_eqn_disc = disc.process_symbol(div_eqn) | ||
| np.testing.assert_allclose( | ||
| div_eqn_disc.evaluate(None, y_squared), | ||
| 4 * np.ones((npts, 1)), | ||
| rtol=1e-7, | ||
| atol=1e-6, | ||
| ) | ||
|
|
||
| def test_cylindrical_grad_div_shapes_Neumann_bcs_symbolic(self): | ||
| mesh = get_cylindrical_mesh_for_testing_symbolic() | ||
| spatial_methods = {"cylindrical domain": pybamm.FiniteVolume()} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test is not related to the main change in this PR, it should not be removed