Skip to content

Commit

Permalink
k
Browse files Browse the repository at this point in the history
  • Loading branch information
ksagiyam committed Dec 5, 2024
1 parent eb38668 commit 9df277c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion firedrake/bcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def __init__(self, V, g, sub_domain, method=None):
warnings.warn("Selecting a bcs method is deprecated. Only topological association is supported",
DeprecationWarning)
if len(V.boundary_set) and sub_domain not in V.boundary_set:
raise ValueError(f"Sub-domain {sub_domain} not in the boundary set of the restricted space.")
raise ValueError(f"Sub-domain {sub_domain} not in the boundary set of the restricted space {V.boundary_set}.")
super().__init__(V, sub_domain)
if len(V) > 1:
raise ValueError("Cannot apply boundary conditions on mixed spaces directly.\n"
Expand Down
13 changes: 13 additions & 0 deletions tests/firedrake/regression/test_restricted_function_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,16 @@ def test_restricted_function_space_extrusion():
assert np.allclose(v.getArray(), local_array[:n][local_global_filter])
v *= 2.
assert np.allclose(f.dat.data_ro_with_halos[:n][local_global_filter], 2. * local_array[:n][local_global_filter])
# Solve Poisson problem.
x, y = SpatialCoordinate(extm)
normal = FacetNormal(extm)
exact = Function(V_res).interpolate(x**2 * y**2)
exact_grad = as_vector([2 * x * y**2, 2 * x**2 * y])
u = TrialFunction(V_res)
v = TestFunction(V_res)
a = inner(grad(u), grad(v)) * dx
L = inner(-2 * (x**2 + y**2), v) * dx + inner(dot(exact_grad, normal), v) * ds_v(2) + inner(dot(exact_grad, normal), v) * ds_t
bc = DirichletBC(V_res, 0., "bottom")
sol = Function(V_res)
solve(a == L, sol, bcs=[bc])
assert assemble(inner(sol - exact, sol - exact) * dx) ** 0.5 < 1.e-14

0 comments on commit 9df277c

Please sign in to comment.