From fd42b9a4adf65b6851451f94a411a4788af80122 Mon Sep 17 00:00:00 2001 From: benSepanski Date: Thu, 14 Jan 2021 16:21:44 -0600 Subject: [PATCH 1/6] tried to fix unmarked edges bug --- meshmode/interop/firedrake/mesh.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meshmode/interop/firedrake/mesh.py b/meshmode/interop/firedrake/mesh.py index f5d5f97f..93cfdafa 100644 --- a/meshmode/interop/firedrake/mesh.py +++ b/meshmode/interop/firedrake/mesh.py @@ -250,9 +250,10 @@ def _get_firedrake_facial_adjacency_groups(fdrake_mesh_topology, top, tag_induced_boundary=cells_to_use is not None) boundary_tag_to_index = {bdy_tag: i for i, bdy_tag in enumerate(bdy_tags)} marker_to_neighbor_value = {} + from firedrake.mesh import unmarked as fd_unmarked from meshmode.mesh import _boundary_tag_bit # None for no marker - marker_to_neighbor_value[None] = \ + marker_to_neighbor_value[fd_unmarked] = \ -(_boundary_tag_bit(bdy_tags, boundary_tag_to_index, BTAG_REALLY_ALL) | _boundary_tag_bit(bdy_tags, boundary_tag_to_index, BTAG_ALL)) for marker in top.exterior_facets.unique_markers: -- GitLab From 359aad9299255e88439a830cb0dae76a043f67b6 Mon Sep 17 00:00:00 2001 From: benSepanski Date: Thu, 14 Jan 2021 16:47:06 -0600 Subject: [PATCH 2/6] Made sure to account for missing cells when tagtgging --- meshmode/interop/firedrake/mesh.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/meshmode/interop/firedrake/mesh.py b/meshmode/interop/firedrake/mesh.py index 93cfdafa..44cc068f 100644 --- a/meshmode/interop/firedrake/mesh.py +++ b/meshmode/interop/firedrake/mesh.py @@ -250,12 +250,17 @@ def _get_firedrake_facial_adjacency_groups(fdrake_mesh_topology, top, tag_induced_boundary=cells_to_use is not None) boundary_tag_to_index = {bdy_tag: i for i, bdy_tag in enumerate(bdy_tags)} marker_to_neighbor_value = {} - from firedrake.mesh import unmarked as fd_unmarked from meshmode.mesh import _boundary_tag_bit - # None for no marker - marker_to_neighbor_value[fd_unmarked] = \ + # for convenience, + # None maps to the boundary tag for a boundary facet with no marker + marker_to_neighbor_value[None] = \ -(_boundary_tag_bit(bdy_tags, boundary_tag_to_index, BTAG_REALLY_ALL) | _boundary_tag_bit(bdy_tags, boundary_tag_to_index, BTAG_ALL)) + # firedrake exterior facets with no marker are assigned the + # a dummy marker + from firedrake.mesh import unmarked as fd_unmarked + marker_to_neighbor_value[fd_unmarked] = marker_to_neighbor_value[None] + # Now figure out the appropriate tags for each firedrake markers for marker in top.exterior_facets.unique_markers: marker_to_neighbor_value[marker] = \ -(_boundary_tag_bit(bdy_tags, boundary_tag_to_index, marker) @@ -349,18 +354,20 @@ def _get_firedrake_facial_adjacency_groups(fdrake_mesh_topology, dtype=Mesh.face_id_dtype) # If only using some of the cells, throw away unused cells and # move to new cell index + exterior_facet_markers = top.exterior_facets.markers if cells_to_use is not None: to_keep = np.isin(ext_elements, cells_to_use) ext_elements = np.vectorize(cells_to_use_inv.__getitem__)( ext_elements[to_keep]) ext_element_faces = ext_element_faces[to_keep] ext_neighbor_faces = ext_neighbor_faces[to_keep] + exterior_facet_markers = exterior_facet_markers[to_keep] # tag the boundary, making sure to record custom tags # (firedrake "markers") if present if top.exterior_facets.markers is not None: ext_neighbors = np.zeros(ext_elements.shape, dtype=IntType) - for ifac, marker in enumerate(top.exterior_facets.markers): + for ifac, marker in enumerate(exterior_facet_markers): ext_neighbors[ifac] = marker_to_neighbor_value[marker] else: ext_neighbors = np.full(ext_elements.shape, -- GitLab From 174018345412afb5d3de72866aac63ce9539913d Mon Sep 17 00:00:00 2001 From: Ben Sepanski Date: Fri, 15 Jan 2021 12:39:11 -0600 Subject: [PATCH 3/6] improved error message --- meshmode/interop/firedrake/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshmode/interop/firedrake/connection.py b/meshmode/interop/firedrake/connection.py index 6786bd16..b8244603 100644 --- a/meshmode/interop/firedrake/connection.py +++ b/meshmode/interop/firedrake/connection.py @@ -288,7 +288,7 @@ class FiredrakeConnection: if ufl_elt.family() != self._ufl_element.family(): raise ValueError(f"'{function_name}.function_space().ufl_element()" f".family()' must be {self._ufl_element.family()}" - f", not '{type(ufl_elt.family())}'") + f", not '{ufl_elt.family()}'") if ufl_elt.degree() != self._ufl_element.degree(): raise ValueError(f"'{function_name}.function_space().ufl_element()" f".degree()' must be {self._ufl_element.degree()}" -- GitLab From 31d5cd826d41a7a5309e2bf89a3c2563a7192dbd Mon Sep 17 00:00:00 2001 From: benSepanski Date: Sun, 17 Jan 2021 12:20:32 -0600 Subject: [PATCH 4/6] Make sure to include conversion functions in docs for interop --- meshmode/interop/firedrake/connection.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meshmode/interop/firedrake/connection.py b/meshmode/interop/firedrake/connection.py index b8244603..244329f1 100644 --- a/meshmode/interop/firedrake/connection.py +++ b/meshmode/interop/firedrake/connection.py @@ -129,6 +129,8 @@ class FiredrakeConnection: obtain firedrake unit dofs on the meshmode reference cell) .. automethod:: __init__ + .. automethod:: from_meshmode + .. automethod:: from_firedrake """ def __init__(self, discr, fdrake_fspace, mm2fd_node_mapping, group_nr=None): """ -- GitLab From 6299e50fa92ad14d76133c1a40bb97a0a7b16167 Mon Sep 17 00:00:00 2001 From: benSepanski Date: Sun, 17 Jan 2021 14:18:36 -0600 Subject: [PATCH 5/6] Make sure not to subscript into None --- meshmode/interop/firedrake/mesh.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meshmode/interop/firedrake/mesh.py b/meshmode/interop/firedrake/mesh.py index 44cc068f..bbc9e762 100644 --- a/meshmode/interop/firedrake/mesh.py +++ b/meshmode/interop/firedrake/mesh.py @@ -361,7 +361,8 @@ def _get_firedrake_facial_adjacency_groups(fdrake_mesh_topology, ext_elements[to_keep]) ext_element_faces = ext_element_faces[to_keep] ext_neighbor_faces = ext_neighbor_faces[to_keep] - exterior_facet_markers = exterior_facet_markers[to_keep] + if exterior_facet_markers is not None: + exterior_facet_markers = exterior_facet_markers[to_keep] # tag the boundary, making sure to record custom tags # (firedrake "markers") if present -- GitLab From bfa7394835859b4bab68854fd55cb6b833593439 Mon Sep 17 00:00:00 2001 From: benSepanski Date: Sun, 17 Jan 2021 14:29:00 -0600 Subject: [PATCH 6/6] Fixed intersphinx reference --- meshmode/interop/firedrake/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshmode/interop/firedrake/connection.py b/meshmode/interop/firedrake/connection.py index 244329f1..84e3739a 100644 --- a/meshmode/interop/firedrake/connection.py +++ b/meshmode/interop/firedrake/connection.py @@ -482,7 +482,7 @@ class FiredrakeConnection: representing a field of shape *mm_field.shape* on :attr:`discr` - See :class:`~meshmode.dof.DOFArray` for further requirements. + See :class:`~meshmode.dof_array.DOFArray` for further requirements. The :attr:`group_nr` entry of each :class:`~meshmode.dof_array.DOFArray` must be of shape *(nelements, nunit_dofs)* and -- GitLab