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

Always enable time-dependent maps #5878

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

nilsvu
Copy link
Member

@nilsvu nilsvu commented Mar 21, 2024

Proposed changes

This enables time-dependent maps at runtime in the binary domains also for elliptic executables (the other domains already enable time-dependent maps at runtime). We'll use this for deformations of the domain that can be updated throughout the solve.

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

tmpl::conditional_t<domain::enable_time_dependent_maps,
CurvedScalarWave::Actions::CalculateGrVars<system>,
tmpl::list<>>,
CurvedScalarWave::Actions::CalculateGrVars<system>,
Copy link
Member Author

Choose a reason for hiding this comment

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

@nikwit could you check if this change is acceptable for you? (since you added this line)

Copy link
Contributor

Choose a reason for hiding this comment

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

This will work but slow things down for non-moving meshes. Is this change just for cleaning up code?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you edit the action to check if the domain is time dependent, and if it isn't just return?

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem there is that we use the same action CalculateGrVars in the initialization_actions where it is always needed and in the step_actions where it is only needed if the domain is time dependent. This can be fixed by e.g. checking if the tags are initialized or simply splitting into two actions, InitializeGrVars and UpdateGrVars.

This actually makes me realize that the current system will not work with AMR as any change in the coordinate locations would need to re-trigger CalculateGrVars, even for time-independent domains. If the background tags were a compute tag that depends on the inertial coordinates, that would be robust to handle both time dependence and AMR. However, this would re-compute the tags also for a time independent domain whenever the time changes, as tags cannot indicate at the moment whether a mutate has actually changed them. We discussed a way to implement this about two years ago but abandoned it as far as I remember. Unless someone has a better idea, I think it would be safest to convert it into a compute tag at this point and take the performance hit for time-independent maps.

For now I think the PR can be merged; at worst it will bring a performance penalty.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok thanks for checking. I'll check if it's easy to skip the computation for time-independent blocks, or else add a comment on the performance implications. Note that the compile-time flag was only used for the binary domain; the others decide at runtime and at block-level whether or not they are time dependent, so the runtime check is better anyway.

AMR is not really a problem here. For AMR you will add projectors that handle each tag in the DataBox when the grid changes. The projector will just re-evaluate the GR background. No need to make this a compute tag for that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I can do that if you like. In that case its probably best to add a template <bool Initialize> to CalculateGrVars. If true, always evaluate, else only evaluate if domain.is_time_dependent(). Then CalculateGrVars<true> is added to the initialization actions and called by AMR and CalculateGrVars<false> is in the step actions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in a fixup. Please take a look.

Copy link
Contributor

Choose a reason for hiding this comment

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

The changes look like what I had in mind. The test of CalculateGrVars needs to be updated though and it looks like you are missing an include for the domain tag. You can squash this in.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@nilsvu nilsvu force-pushed the domain_time_dep branch 2 times, most recently from f7524e1 to 42e6342 Compare March 25, 2024 21:05
@nilsvu nilsvu force-pushed the domain_time_dep branch 3 times, most recently from 155e409 to 63cee16 Compare March 27, 2024 23:20
knelli2
knelli2 previously approved these changes Mar 28, 2024
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.

One thing. You can choose whether you believe it warrants a change. Also maybe @nikwit should weigh in because he'll be the one using it

src/Evolution/Systems/CurvedScalarWave/CalculateGrVars.hpp Outdated Show resolved Hide resolved
This enables time-dependent maps at runtime in the binary domains also for elliptic
executables (the other domains already enable time-dependent maps at runtime).
We'll use this for deformations of the domain that can be updated throughout the solve.
@nilsvu nilsvu merged commit aead616 into sxs-collaboration:develop Mar 29, 2024
22 checks passed
@nilsvu nilsvu deleted the domain_time_dep branch March 29, 2024 22:19
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