diff --git a/examples/to_firedrake.py b/examples/to_firedrake.py index fb1a6bef55ff401d81b88d3f55759f83f156b90e..30e86bcb376c0cacd2b227a912a919afdc7f2309 100644 --- a/examples/to_firedrake.py +++ b/examples/to_firedrake.py @@ -103,11 +103,11 @@ def main(): sol = Function(cfd_fspace) a = inner(grad(u), grad(v)) * dx - L = Constant(0.0) * v * dx + rhs = Constant(0.0) * v * dx bc_value = project(fd_candidate_sol, cfd_fspace) bc = DirichletBC(cfd_fspace, bc_value, 'on_boundary') params = {'ksp_monitor': None} - solve(a == L, sol, bcs=[bc], solver_parameters=params) + solve(a == rhs, sol, bcs=[bc], solver_parameters=params) # project back into our "DG" space sol = project(sol, fd_fspace) diff --git a/test/test_firedrake_interop.py b/test/test_firedrake_interop.py index 446d6eee4e5fa5e944881f4d3a53ba8dd90d851a..d2b526f066c8d2afc3c1421c135b9bd641c6dff6 100644 --- a/test/test_firedrake_interop.py +++ b/test/test_firedrake_interop.py @@ -36,7 +36,9 @@ from meshmode.discretization.poly_element import ( from meshmode.dof_array import DOFArray -from meshmode.mesh import BTAG_ALL, BTAG_REALLY_ALL, check_bc_coverage +from meshmode.mesh import ( + BTAG_ALL, BTAG_REALLY_ALL, BTAG_NO_BOUNDARY, check_bc_coverage + ) from meshmode.interop.firedrake import ( build_connection_from_firedrake, build_connection_to_firedrake, @@ -325,6 +327,17 @@ def test_bdy_tags(square_or_cube_mesh, bdy_ids, coord_indices, coord_values, ext_grp = mm_mesh.facial_adjacency_groups[0][None] for iel, ifac, bdy_flags in zip( ext_grp.elements, ext_grp.element_faces, ext_grp.neighbors): + # try: if mm_mesh has boundaries flagged as not boundaries we need to + # skip them + # catch: if mm_mesh does not use BTAG_NO_BOUNDARY flag we get a + # ValueError + try: + # If this facet is flagged as not really a boundary, skip it + if mm_mesh.boundary_tag_bit(BTAG_NO_BOUNDARY) & -bdy_flags: + continue + except ValueError: + pass + el_vert_indices = mm_mesh.groups[0].vertex_indices[iel] # numpy nb: have to have comma to use advanced indexing face_vert_indices = el_vert_indices[face_vertex_indices[ifac], ]