-
Notifications
You must be signed in to change notification settings - Fork 177
Adaptive Multigrid #4726
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
base: main
Are you sure you want to change the base?
Adaptive Multigrid #4726
Conversation
b1a3ac2 to
cc7d814
Compare
cc7d814 to
ff94938
Compare
| """ | ||
|
|
||
| def __init__(self, mesh, refinements_per_level=1, nested=True): | ||
| self.meshes = tuple(mesh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does it make two independent tuples of mesh?
| Then computes the coarse_to_fine and fine_to_coarse mappings. | ||
| Constructs intermediate submesh hierarchies with this. | ||
| """ | ||
| if mesh.topological_dimension <= 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these bounds empirically determined, or are they guaranteed by theory?
| (coarse_splits, fine_splits, num_children) = split_to_submesh( | ||
| mesh, coarse_mesh, c2f, f2c | ||
| ) | ||
| for i in range(1, max_children + 1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment for what this is doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More generally some comments for all the steps below would be useful, I don't have the big picture of what they are trying to do.
| markers = Function(W) | ||
|
|
||
| with eta.dat.vec_ro as eta_: | ||
| eta_max = eta_.max()[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this taking the max over all processes (global communication), or just over the local part of eta?
|
|
||
| def adapt(self, eta, theta): | ||
| """ | ||
| Implement Dorfler marking, refines mesh from error estimator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is correct, Dörfler marking involves sorting all of the elements by decreasing error estimator and taking the minimal set that exceeds some fixed fraction of the total error. What this code implements is the simpler variant that doesn't have a proof of convergence (as far as I know) but works as well in practice.
|
|
||
| def recombine(self, split_funcs, f, child=True): | ||
| """ | ||
| Recombines functions on submeshes back full mesh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix comment
| __all__ = ("AdaptiveTransferManager",) | ||
|
|
||
|
|
||
| class AdaptiveTransferManager(TransferManager): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I wanted to use a custom transfer operator (for e.g. some complicated multigrid thing), does this class compose with that?
| @@ -0,0 +1,365 @@ | |||
| """ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests look persuasive.
Do we have any profiled runs of using AdaptiveMeshHierarchy (where all elements are refined) vs MeshHierarchy to see how much the overhead is, and where that overhead is spent?
dham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs a manual section and docstrings need to document where netgen meshes are required.
Description