Skip to content

Commit

Permalink
work with new mesh class
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdark committed Jan 11, 2024
1 parent dac16c5 commit cf75296
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion festim/hydrogen_transport_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,25 @@ def define_meshtags_and_measures(self):
surface_subdomains=self.surface_subdomains,
volume_subdomains=self.volume_subdomains,
)
elif isinstance(self.mesh, F.Mesh):

elif isinstance(self.mesh, F.CustomFenicsMesh):
self.facet_meshtags = self.mesh.surface_meshtags
self.volume_meshtags = self.mesh.volume_meshtags

elif isinstance(self.mesh, F.Mesh):
facet_indices = np.array([], dtype=np.int32)
facet_tags = np.array([], dtype=np.int32)
self.facet_meshtags = meshtags(
self.mesh.mesh, self.mesh.fdim, facet_indices, facet_tags
)

num_cells = self.mesh.mesh.topology.index_map(self.mesh.vdim).size_local
mesh_cell_indices = np.arange(num_cells, dtype=np.int32)
tags_volumes = np.full(num_cells, 1, dtype=np.int32)
self.volume_meshtags = meshtags(
self.mesh.mesh, self.mesh.vdim, mesh_cell_indices, tags_volumes
)

# check volume ids are unique
vol_ids = [vol.id for vol in self.volume_subdomains]
if len(vol_ids) != len(np.unique(vol_ids)):
Expand Down

0 comments on commit cf75296

Please sign in to comment.