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 functionality for TimeSeries callback on UnstructuredMesh2D #1855

Merged

Conversation

andrewwinters5000
Copy link
Member

@andrewwinters5000 andrewwinters5000 commented Mar 1, 2024

For now this callback is only reliable on straight-sided unstructured elements. If a curved element contains a time series point then a warning is thrown to inform the user. The callback itself still works and creates data, but it may have errors.

I updated my element identification strategy such that this callback now works as expected on curvilinear elements as well. It uses the same Newton approach and reuses the existing mapping and metric functions used in the mesh creation. It took me a bit to realize that we already had all the tools necessary to invert the transfinite interpolation as well. My new strategy to identify if a point lies in a curved element is a bit brute force (it involves computing all the barycenters), so I am open to suggestions to optimize it if it allocates too much or so.

Copy link
Contributor

github-actions bot commented Mar 1, 2024

Review checklist

This checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging.

Purpose and scope

  • The PR has a single goal that is clear from the PR title and/or description.
  • All code changes represent a single set of modifications that logically belong together.
  • No more than 500 lines of code are changed or there is no obvious way to split the PR into multiple PRs.

Code quality

  • The code can be understood easily.
  • Newly introduced names for variables etc. are self-descriptive and consistent with existing naming conventions.
  • There are no redundancies that can be removed by simple modularization/refactoring.
  • There are no leftover debug statements or commented code sections.
  • The code adheres to our conventions and style guide, and to the Julia guidelines.

Documentation

  • New functions and types are documented with a docstring or top-level comment.
  • Relevant publications are referenced in docstrings (see example for formatting).
  • Inline comments are used to document longer or unusual code sections.
  • Comments describe intent ("why?") and not just functionality ("what?").
  • If the PR introduces a significant change or new feature, it is documented in NEWS.md.

Testing

  • The PR passes all tests.
  • New or modified lines of code are covered by tests.
  • New or modified tests run in less then 10 seconds.

Performance

  • There are no type instabilities or memory allocations in performance-critical parts.
  • If the PR intent is to improve performance, before/after time measurements are posted in the PR.

Verification

  • The correctness of the code was verified using appropriate tests.
  • If new equations/methods are added, a convergence test has been run and the results
    are posted in the PR.

Created with ❤️ by the Trixi.jl community.

Copy link

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 98.60140% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 87.23%. Comparing base (1ca37cf) to head (d81b79e).
Report is 1 commits behind head on main.

Files Patch % Lines
src/callbacks_step/time_series_dg2d.jl 98.20% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1855      +/-   ##
==========================================
- Coverage   89.44%   87.23%   -2.22%     
==========================================
  Files         438      439       +1     
  Lines       35593    35734     +141     
==========================================
- Hits        31836    31170     -666     
- Misses       3757     4564     +807     
Flag Coverage Δ
unittests 87.23% <98.60%> (-2.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@DanielDoehring DanielDoehring left a comment

Choose a reason for hiding this comment

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

Hey Andrew, I just took a look at this during yesterdays meeting and added some quality of life remarks :)

src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
@andrewwinters5000 andrewwinters5000 marked this pull request as ready for review March 7, 2024 18:25
Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

Thanks a lot! I didn't check the implementation in detail but I assume you have already done so.

examples/unstructured_2d_dgsem/elixir_euler_basic.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
Copy link
Contributor

@DanielDoehring DanielDoehring left a comment

Choose a reason for hiding this comment

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

LGTM, just added couple comments.

src/callbacks_step/time_series_dg2d.jl Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Show resolved Hide resolved
Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Daniel Doehring <[email protected]>
Copy link
Member

@sloede sloede left a comment

Choose a reason for hiding this comment

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

This is a great feature, thanks for tackling it!

examples/unstructured_2d_dgsem/elixir_euler_basic.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg.jl Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
@sloede
Copy link
Member

sloede commented Mar 8, 2024

I forgot to mention in my review: It would be great to update the docs as well, indicating which mesh types are supported (both in the docstring of the callback and the docs in docs/)

DanielDoehring
DanielDoehring previously approved these changes Mar 8, 2024
@andrewwinters5000
Copy link
Member Author

There are still normal use cases that fail, I need to work more and make this more robust.

@andrewwinters5000 andrewwinters5000 marked this pull request as draft March 8, 2024 09:26
@andrewwinters5000
Copy link
Member Author

forgot to mention in my review: It would be great to update the docs as well, indicating which mesh types are supported (both in the docstring of the callback and the docs in docs/)

I updated the docstring but could not find this callback mentioned anywhere else in the docs.

@sloede
Copy link
Member

sloede commented Mar 9, 2024

forgot to mention in my review: It would be great to update the docs as well, indicating which mesh types are supported (both in the docstring of the callback and the docs in docs/)

I updated the docstring but could not find this callback mentioned anywhere else in the docs.

You're right, sorry. I thought we had mentioned it there, but apparently we didn't.

@JoshuaLampert
Copy link
Member

I updated the docstring but could not find this callback mentioned anywhere else in the docs.

We have this: https://github.com/trixi-framework/Trixi.jl/blob/main/docs/src/callbacks.md#time-series.

Copy link
Contributor

@patrickersing patrickersing left a comment

Choose a reason for hiding this comment

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

Thanks for adding this functionality!
Everything looks good already. I just added a few comment suggestions and a question regarding the new strategy.

src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
examples/unstructured_2d_dgsem/elixir_euler_time_series.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Show resolved Hide resolved
@andrewwinters5000
Copy link
Member Author

I updated the docstring but could not find this callback mentioned anywhere else in the docs.

We have this: https://github.com/trixi-framework/Trixi.jl/blob/main/docs/src/callbacks.md#time-series.

Since this general discussion links to the TimeSeriesCallback docstring where we indicate the mesh support I do not think we need to update the general callback overview.

src/callbacks_step/time_series.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/time_series_dg2d.jl Outdated Show resolved Hide resolved
@andrewwinters5000
Copy link
Member Author

@sloede @ranocha Should this feature extension get mentioned in the NEWS.md?

@sloede
Copy link
Member

sloede commented Mar 13, 2024

@sloede @ranocha Should this feature extension get mentioned in the NEWS.md?

I think this is so cool that, yes, I'd mention it!

Copy link
Contributor

@patrickersing patrickersing left a comment

Choose a reason for hiding this comment

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

I just have one question about where the additional tests should live.

test/test_unit.jl Outdated Show resolved Hide resolved
Copy link
Contributor

@patrickersing patrickersing left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@ranocha ranocha merged commit bd060b6 into trixi-framework:main Mar 14, 2024
32 of 36 checks passed
@andrewwinters5000 andrewwinters5000 deleted the unstructured-time-series branch March 14, 2024 17:16
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.

6 participants