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 reduction action for AMR diagnostics #4759

Merged
merged 2 commits into from Feb 23, 2023

Conversation

kidder
Copy link
Member

@kidder kidder commented Feb 20, 2023

Proposed changes

This allows (among other things):

  • Sanity check that the new Domain is fully covered by the new Elements
  • Printing out statistics about the new Domain

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

using return_tags =
tmpl::list<amr::Tags::Flags<Dim>, amr::Tags::NeighborFlags<Dim>>;
/// Tags for constant items added to the GlobalCache. These items are
/// initialized from input file options.
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't (have to) add these explanations to every initialization mutator. How about adding a protocol that defines these aliases?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no objection to someone else doing that...

Copy link
Member

Choose a reason for hiding this comment

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

In this PR it would be enough to (1) delete these comments that we shouldn't (have to) duplicate in every initializer, and (2) link to InitializeItems in the docs (that's super important, else it's unclear what all these aliases even mean and why they're there). I opened #4761 for the rest.

Not sure what you mean with "no objections to someone else doing that". In my opinion we can't expect others to resolve issues like this. Happy to discuss in a call if you like.

template <size_t Dim>
struct Domain {
/// Tags for constant items added to the GlobalCache. These items are
/// initialized from input file options.
Copy link
Member

Choose a reason for hiding this comment

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

Same here. This verbosity / boilerplate code seems excessive. We can't document what each of these aliases mean in every initializer. It also distracts from the actual implementation in this file. A protocol would solve this I think.

std::array{Parallel::Phase::Initialization, Parallel::Phase::CheckDomain,
Parallel::Phase::Exit};

/// The parallel components used in the executable
Copy link
Member

Choose a reason for hiding this comment

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

wrong comment I think

/// - The average refinement level by logical dimension (i.e. not by the
/// physical dimensions)
/// - The average number of grid points by logical dimension
struct UseAmrDiagnostics {
Copy link
Member

Choose a reason for hiding this comment

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

CheckAmrDiagnostics? Not sure what "use" means.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what I had named it when it just checked the Block volume. But then I didn't think that was best after I started doing additional things. And I can easily imagine more things being done as we start to use AMR. @nilsdeppe @wthrowe thoughts on the name?

Copy link
Member

Choose a reason for hiding this comment

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

What about RunAmrDiagnostics?

@@ -0,0 +1,93 @@
// Distributed under the MIT License.
Copy link
Member

Choose a reason for hiding this comment

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

Should this executable go in tests/?

Copy link
Member Author

Choose a reason for hiding this comment

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

It could, but I thought it could be a good example of a parallel executable that can easily be run on multiple nodes and cores, and used in a tutorial. This is not the final state of the executable, it will do full h-refinement. I just added it now to test the reduction action.

Copy link
Member

Choose a reason for hiding this comment

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

ok, I'm not sure if Examples/ or tests/ is the right place. Either seems fine I think. @wthrowe @nilsdeppe any opinions?

Copy link
Member

@nilsvu nilsvu left a comment

Choose a reason for hiding this comment

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

you can squash directly

///
/// \note This only initializes the Element and the Mesh on each element of
/// an array component. This is all that is needed about the Domain in order to
/// test the mechanics of of 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.

delete one "of"

::domain::Tags::InitialRefinementLevels<Dim>,
evolution::dg::Tags::Quadrature>;

using default_initialized_simple_tags = tmpl::list<>;
Copy link
Member

Choose a reason for hiding this comment

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

I don't see this being used anywhere, and I don't think it is part of some generic interface (or is it?). This confusion is what I think we must fix (#4761). For the purpose of this PR just delete this line?

@@ -0,0 +1,93 @@
// Distributed under the MIT License.
Copy link
Member

Choose a reason for hiding this comment

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

ok, I'm not sure if Examples/ or tests/ is the right place. Either seems fine I think. @wthrowe @nilsdeppe any opinions?

using mutable_global_cache_tags = tmpl::list<>;
using simple_tags_from_options = tmpl::list<>;
using default_initialized_simple_tags =
tmpl::list<amr::Tags::NeighborFlags<Dim>>;
Copy link
Member

Choose a reason for hiding this comment

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

just inline this in simple_tags below? As noted above, I think this isn't part of a generic interface.

Copy link
Member Author

Choose a reason for hiding this comment

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

where do you want it documented that this adds a default initialized tag into the DataBox?

Copy link
Member

Choose a reason for hiding this comment

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

that's part of the simple_tags interface, isn't it? That should be documented somewhere. I find the overlap between the InitializeItems interface and the simple_tags / compute_tags interface a bit confusing here, but nothing to fix in this PR.

Change from the type aliases expected by
Initialization::Actions::AddSimpleTags to those expected by
Initialization::Actions::InitializeItems.
As this action is a reduction action, also add the executable
RandomAmr that uses it.  After more AMR actions are added RandomAmr
can be used as a integration test of AMR actions and components.
@nilsvu nilsvu disabled auto-merge February 23, 2023 21:03
@nilsvu nilsvu merged commit ea8e72f into sxs-collaboration:develop Feb 23, 2023
@kidder kidder deleted the amr_diagnostics branch March 27, 2023 15:22
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.

None yet

3 participants