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

Add coarsening in 2D for newest vertex bisection #1018

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

aerappa
Copy link
Contributor

@aerappa aerappa commented Aug 2, 2024

@JordiManyer, @amartinhuertas :

@wangzuodong1997 and I have been working on implementing coarsening in the case of 2D refinement. Specifically, we have only implemented modifying the Topology directly without bothering with the infrastructure of rrules etc. currently implemented for refinement that (if I understand correctly) allow interpolation and projection between parent and children meshes.

Our refinement algorithm closely resembles the one here and has the attractive feature that it doesn't not require any mesh history to perform local coarsening that preserves mesh continuity. At a high level, the user selects a set of cells to coarsen, and our algorithm identifies if any of these cells contain a "good node" which can be removed with some of it's edges without generating any hanging nodes.

From your point of view, what are the next steps? Can AdaptivityGlue be reused for coarsening? It seems rather specific to refinement at the moment.

Please find a small example below demonstrating the coarsening.

Before:
before
After:
after

@aerappa aerappa marked this pull request as draft August 2, 2024 13:52
@JordiManyer
Copy link
Member

JordiManyer commented Aug 3, 2024

@aerappa Thanks for the contribution!

From your point of view, what are the next steps? Can AdaptivityGlue be reused for coarsening? It seems rather specific to refinement at the moment.

We are currently already using what we have for coarsening in GridapP4est, so nothing new needs to be added. The mixed glue should be ok for mixed refining/coarseningm (i.e the adapt function). If you only have coarsening, the refinement glue does the job just fine (since coarsening is basically refining in reverse). Simply put the coarsened model as the parent, not the child.

Straight from the documentation:

Glue containing the map between two nested triangulations. The contained datastructures will 
depend on the type of glue. There are two types of `AdaptivityGlue`: 

- `RefinementGlue` :: All cells in the new mesh are children of cells in the old mesh. I.e given 
  a new cell, it is possible to find a single old cell containing it (the new cell might be exactly
  the old cell if no refinement).
- `MixedGlue` :: Some cells in the new mesh are children of cells in the old mesh, while others are
  parents of cells in the old mesh. 

Contains: 

- `n2o_faces_map` :: Given a new face gid, returns
  - if fine, the gid of the old face containing it.
  - if coarse, the gids of its children (in child order)
- `n2o_cell_to_child_id` :: Given a new cell gid, returns 
  - if fine, the local child id within the (old) coarse cell containing it.
  - if coarse, a list of local child ids of the (old) cells containing it.
- `refinement_rules` :: Array conatining the `RefinementRule` used for each coarse cell.

@JordiManyer
Copy link
Member

Hey @aerappa @wangzuodong1997 , any updates on this? I recently merged some stuff for AMR that might also interest you guys, you could have a look at the tests I created in test/Adaptivity. Let me know if I can be of help.

@wangzuodong1997
Copy link

Hey @aerappa @wangzuodong1997 , any updates on this? I recently merged some stuff for AMR that might also interest you guys, you could have a look at the tests I created in test/Adaptivity. Let me know if I can be of help.

Hi. Yes, the added example is helpful, thanks :)
Here is some progress:

  1. I tried with @aerappa to fix the Glue issue, but we failed.
  2. Instead, we implemented the newest vertex bisection scheme and the corresponding coarsening scheme which work well. I tested these schemes with heat equation with moving singularity, everything looks fine.
  3. However, we did not store the hierarchy which makes the current schemes slow.

@aerappa can implement the hierarchy and probably merge these schemes in Gridap, how do you think? @JordiManyer

@JordiManyer
Copy link
Member

I would start by pulling from master since this branch is quite far behind at the moment. Once that is done, I can maybe have a look at the code and see how you guys can implement the glue.

@wangzuodong1997
Copy link

I would start by pulling from master since this branch is quite far behind at the moment. Once that is done, I can maybe have a look at the code and see how you guys can implement the glue.

Thanks! I did not yet push my refine/coarsen code in git. Please let me know when I can push the code :)

@JordiManyer
Copy link
Member

@wangzuodong1997 I do not follow. It's @aerappa 's fork, so its fully under his control. Pulling from master is something anyone can do as well, no need for special permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants