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 numerical support of other real types (compressible_euler) #1947

Merged
merged 21 commits into from
Jun 14, 2024

Conversation

huiyuxie
Copy link
Member

@huiyuxie huiyuxie commented May 17, 2024

Continue #1909.

Tasks:

  • compressible_euler_multicomponent_1d, compressible_euler_multicomponent_2d
  • compressible_euler_quasi_1d
  • unit tests for above

Copy link
Contributor

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 with its PR number.

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.

@huiyuxie huiyuxie requested a review from ranocha May 17, 2024 21:35
@huiyuxie huiyuxie self-assigned this May 17, 2024
@huiyuxie huiyuxie added the enhancement New feature or request label May 17, 2024
Copy link

codecov bot commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.16%. Comparing base (c090422) to head (71b7a64).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1947      +/-   ##
==========================================
+ Coverage   96.14%   96.16%   +0.02%     
==========================================
  Files         460      460              
  Lines       36926    36950      +24     
==========================================
+ Hits        35499    35530      +31     
+ Misses       1427     1420       -7     
Flag Coverage Δ
unittests 96.16% <100.00%> (+0.02%) ⬆️

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.

@huiyuxie
Copy link
Member Author

huiyuxie commented May 17, 2024

Why do CI tests seem so vulnerable here?

CI tests could be easily passed locally https://github.com/huiyuxie/Trixi.jl/actions/runs/9135929568 and it seems like there is something wrong with the token in the upstream.

ranocha
ranocha previously approved these changes May 19, 2024
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.

LGTM so far, thanks!

@ranocha
Copy link
Member

ranocha commented May 19, 2024

Why do CI tests seem so vulnerable here?

CI tests could be easily passed locally https://github.com/huiyuxie/Trixi.jl/actions/runs/9135929568 and it seems like there is something wrong with the token in the upstream.

It's a Codecov issue for PRs from forks to open-source repositories, see #1905 and codecov/feedback#301

@huiyuxie
Copy link
Member Author

huiyuxie commented May 21, 2024

@ranocha Please check the new push in the first PR (sample test).

The small amount of test data seems odd to me or maybe we can opt for a random data generator to feed the functions? I have tested the modified parts, but should I test all the functions even if they were not touched? BTW, the formatter looks bad to me, the code looks even worse after formatting - someone has to adjust the parameters for the current formatter.

Could you please provide your benchmark results for Float64 and Float32 if available? Does this running process default to multithreading? I also want to see your running environment (i.e., basic CPU information), if you would like to share.

@huiyuxie
Copy link
Member Author

That PR has too many comments so I comment here.

@ranocha
Copy link
Member

ranocha commented May 21, 2024

It starts to become messy if we discuss stuff about another PR here, so take everything with a grain of salt since I may be confused.

The small amount of test data seems odd to me or maybe we can opt for a random data generator to feed the functions?

I would like to avoid randomness (or at least print the values that are used for randomized testing so that debugging becomes possible).

I have tested the modified parts, but should I test all the functions even if they were not touched?

At least the modified parts should be tested. You can also use a test-driven workflow and start adding new tests (@test_broken) for functions that you will fix later in other PRs.

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. This looks good so far. I think it would be good to wait until the other PR is merged to get the infrastructure for unit tests

src/equations/compressible_euler_quasi_1d.jl Show resolved Hide resolved
@ranocha
Copy link
Member

ranocha commented Jun 3, 2024

Hi @huiyuxie! Thanks for your contributions. We have merged your other PR setting up the testing infrastructure. Thus, you can go ahead and add tests in this PR as well.

Please also add your name to our list of authors in https://github.com/trixi-framework/Trixi.jl/blob/main/AUTHORS.md

@huiyuxie
Copy link
Member Author

huiyuxie commented Jun 4, 2024

Thanks for the review! Please wait as I am still busy with some other things these days ;)

@huiyuxie huiyuxie requested a review from ranocha June 5, 2024 23:39
@test eltype(@inferred cons2prim(u, equations)) == RealT
@test eltype(@inferred prim2cons(u, equations)) == RealT
# TODO: There is a bug in the `entropy` function
# @test eltype(@inferred entropy(u, equations)) == RealT
Copy link
Member Author

@huiyuxie huiyuxie Jun 5, 2024

Choose a reason for hiding this comment

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

@inline function entropy(u, equations::CompressibleEulerEquationsQuasi1D)
a_rho, a_rho_v1, a_e, a = u
q = a * entropy(SVector(a_rho, a_rho_v1, a_e) / a,
CompressibleEulerEquations1D(equations.gamma))
return SVector(q[1], q[2], q[3], a)
end

The entropy for CompressibleEulerEquations1D does not return as a vector. Who was doing the code review?Seriously this is an apparent bug :(

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. Please find below some comments

src/equations/compressible_euler_multicomponent_2d.jl Outdated Show resolved Hide resolved
test/test_type.jl Outdated Show resolved Hide resolved
src/equations/compressible_euler_multicomponent_2d.jl Outdated Show resolved Hide resolved
src/equations/compressible_euler_multicomponent_2d.jl Outdated Show resolved Hide resolved
@huiyuxie
Copy link
Member Author

Would it be good to open an issue for this #1947 (comment)? For later change it back to integer 0

@huiyuxie huiyuxie requested a review from jlchan June 11, 2024 05:09
@jlchan
Copy link
Contributor

jlchan commented Jun 11, 2024

@huiyuxie I am fairly busy this week and at a conference the next week. When do you need this review by?

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! Could you please add your name to the list of authors?

test/test_type.jl Outdated Show resolved Hide resolved
test/test_type.jl Outdated Show resolved Hide resolved
test/test_type.jl Outdated Show resolved Hide resolved
test/test_type.jl Outdated Show resolved Hide resolved
@ranocha
Copy link
Member

ranocha commented Jun 11, 2024

@huiyuxie I am fairly busy this week and at a conference the next week. When do you need this review by?

I think there is no need for you to review this PR.

@huiyuxie
Copy link
Member Author

@jlchan Good luck!

@huiyuxie
Copy link
Member Author

huiyuxie commented Jun 14, 2024

Fine, overall it is not a big issue. Moving the whole process forward is much more important to me - this PR looks like holding up other PRs for a long time. I will fix the former check issues directly in this PR.

@huiyuxie huiyuxie requested a review from ranocha June 14, 2024 07:47
@huiyuxie
Copy link
Member Author

Name added. Ready for final review and approval of merge @ranocha.

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 7b57dd5 into trixi-framework:main Jun 14, 2024
37 checks passed
@huiyuxie huiyuxie deleted the main-continue branch June 21, 2024 07:56
@huiyuxie huiyuxie changed the title Add numerical support of other real types (continue) Add numerical support of other real types (compressible_euler) Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants