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

Enable p-refinement via an Event #6320

Merged
merged 10 commits into from
Oct 17, 2024

Conversation

kidder
Copy link
Member

@kidder kidder commented Oct 2, 2024

Proposed changes

This PR will allow p-refinement to be done as an Event.
This requires the DG scheme to reactively check if the communicated mortar data is on the correct Mesh.

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

Copy link
Member

@wthrowe wthrowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy errors are not in our code and probably wrong, so nothing to do for those.

@@ -20,6 +20,7 @@ namespace evolution::dg {
* 1. the volume mesh of the element.
* 2. the volume mesh corresponding to the ghost cell data. This allows eliding
* projection when all neighboring elements are doing DG.
* 3. the mortar mesh of the data on the mortar
* 3. the mesh of the neighboring element's face (not the mortar mesh!)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renumber the later entries. (The numbering being wrong actually confuses doxygen, which surprises me.)

@@ -44,6 +44,7 @@ namespace evolution::dg::Tags {
* 1. the volume mesh of the element.
* 2. the volume mesh corresponding to the ghost cell data. This allows eliding
* projection when all neighboring elements are doing DG.
* 3. the mortar mesh of the data on the mortar
* 3. the mesh of the neighboring element's face (not the mortar mesh!)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, fix numbering.

face_mesh2.basis(i) == Spectral::Basis::Legendre,
"Only Legendre basis meshes are supported for element faces so far, "
"but "
"face_mesh1 is "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[optional] formatting


/// \ingroup AmrGroup
namespace amr {
/// \brief %Eventss for adaptive mesh refinement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sspelling.

boundary_data_history->at(mortar_id).local().for_each(
project_boundary_mortar_data);
boundary_data_history->at(mortar_id).remote().for_each(
project_boundary_mortar_data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call boundary_data_history->at(mortar_id).clear_coupling_cache().

if (mortar_mesh !=
received_mortar_data->second.boundary_correction_mesh) {
boundary_data_history->at(mortar_id).remote().for_each(
project_boundary_mortar_data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, clear the cache, unless this is only modifying the entry that was just inserted, in which case add a comment that you don't have to clear the cache.

<< "\n mortar_mesh: " << mortar_mesh << "\n");
ASSERT(local_data_on_mortar.number_of_grid_points() ==
neighbor_data_on_mortar.number_of_grid_points(),
"RIP\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better message? Probably print out the values.

/// \brief %Eventss for adaptive mesh refinement
namespace Events {}
} // namespace amr
namespace amr::Events {} // namespace amr::Events
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move reformatting to the commit where it was added. Also remove the same-line closing comment.

{flux_data},
{neighbor_next_time_step_id},
decision};
const evolution::dg::BoundaryData<Dim> data{mesh,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to appropriate commit.

Copy link
Contributor

@knelli2 knelli2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to wait for my approval

Comment on lines 96 to +97
const std::unordered_map<ElementId<Dim>, amr::Info<Dim>>& neighbor_info,
const ::dg::MortarMap<Dim, Mesh<Dim>>& neighbor_mesh,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these changes go in a different commit?

nilsdeppe
nilsdeppe previously approved these changes Oct 5, 2024
Copy link
Member

@nilsdeppe nilsdeppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My requests have been addressed. I don't need to look at this again before it's merged.

@wthrowe
Copy link
Member

wthrowe commented Oct 7, 2024

Still missing the LTS cache management. Have you tested this in an LTS evolution?

This is the mesh corresponding to boundary_correction_data.  It needs
to be communicated in case the mortar needs to be reprojected after
AMR increases resolution.
This is what will be used by reactive p-refinement for DG.
In order to reactively adapt to p-refinement done as an Event, the mortar
data may need to be projected to a new mortar mesh.
This is the appropriate slice (which can be obtained from the
mortar_id) of the volume_mesh
@wthrowe
Copy link
Member

wthrowe commented Oct 16, 2024

We discussed some methods of testing this elsewhere. I assume you've done some of those?

@wthrowe
Copy link
Member

wthrowe commented Oct 17, 2024

Discussed elsewhere. The tests have been done.

@wthrowe wthrowe merged commit a8efe75 into sxs-collaboration:develop Oct 17, 2024
21 of 23 checks passed
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.

4 participants