Skip to content
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

Added support for 3D adaptivity #13

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion ngsPETSc/utils/firedrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,28 @@ def refineMarkedElements(self, mark):
self.netgen_mesh.Refine(adaptive=True)
return fd.Mesh(self.netgen_mesh)
return fd.Mesh(netgen.libngpy._meshing.Mesh(2))

elif self.geometric_dimension() == 3:
with mark.dat.vec as marked:
marked0 = marked
getIdx = self._cell_numbering.getOffset
if self.sfBCInv is not None:
getIdx = lambda x: x
_, marked0 = self.topology_dm.distributeField(self.sfBCInv,
self._cell_numbering,
marked)
if self.comm.Get_rank() == 0:
mark = marked0.getArray()
for i, el in enumerate(self.netgen_mesh.Elements3D()):
if mark[getIdx(i)]:
el.refine = True
else:
el.refine = False
self.netgen_mesh.Refine(adaptive=True)
return fd.Mesh(self.netgen_mesh)
return fd.Mesh(netgen.libngpy._meshing.Mesh(3))
else:
raise NotImplementedError("No implementation for dimension other than 2.")
raise NotImplementedError("No implementation for dimension other than 2 and 3.")

def curveField(self, order):
'''
Expand Down