Use variable name `have_nonconservative_terms` everywhere
resolves #2386
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.mdwith 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 :heart: by the Trixi.jl community.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 96.76%. Comparing base (cec533a) to head (8359093).
Additional details and impacted files
@@ Coverage Diff @@
## main #2400 +/- ##
=======================================
Coverage 96.76% 96.76%
=======================================
Files 521 521
Lines 42456 42456
=======================================
Hits 41082 41082
Misses 1374 1374
| Flag | Coverage Ξ | |
|---|---|---|
| unittests | 96.76% <100.00%> (ΓΈ) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Ok. Could you please resolve the conflicts?
Catching up on this, suggestions would be:
- leave as is (
nonconservative_terms,has_nonconservative_terms, andhave_nonconservative_terms) - use
nonconservative_termseverywhere - use
has_nonservative_termseverywhere - use
have_nonservative_termseverywhere
Catching up on this, suggestions would be:
1. leave as is (`nonconservative_terms`, `has_nonconservative_terms`, and `have_nonconservative_terms`) 2. use `nonconservative_terms` everywhere 3. use `has_nonservative_terms` everywhere 4. use `have_nonservative_terms` everywhere
What do you think would be the best option, and why?
What do you think would be the best option, and why?
4., because
- not 1 for consistency reasons
- to me
have_nonconservative_varsis a property of the equations- when called, i.e.
have_nonservative_vars(equations), I read it as a question, like "Do these equations have nonconservative variables?" - when used for dispatch, I read it as a statement, like "This function is specialized for equations that have nonconservative variables."
- when called, i.e.
- it wasn't me: https://github.com/trixi-framework/Trixi.jl/pull/2348#discussion_r2051100687 :wink:
What do you think would be the best option, and why?
4., because
* not 1 for consistency reasons * to me `have_nonconservative_vars` is a property of the equations * when called, i.e. `have_nonservative_vars(equations)`, I read it as a question, like "Do these equations _have nonconservative variables_?" * when used for dispatch, I read it as a statement, like "This function is specialized for equations that _have nonconservative variables_." * it wasn't me: [Add auxiliary variables #2348 (comment)](https://github.com/trixi-framework/Trixi.jl/pull/2348#discussion_r2051100687) π
I agree to your assessment of 1) not being an option due to its lack of consistency π
I also agree that just nonconservative_terms (without prefix) can easily (and rightfully) be construed to be referring to the actual terms (or auxiliary variables etc.), not the existence property/type trait.
I am not so sure about has_ vs have_. I know that have_ is what we currently have (no pun intended), but I don't recall why we chose it over has_ (do you, @ranocha?). To me, has_nonconservative_terms(equations) sounds less awkward, even if the object passed to the function is plural, and would be more consistent with other type traits that actually are only used in singular.
What's the take of our native speakers such as @andrewwinters5000 @jlchan @tristanmontoya on this?
What's the take of our native speakers such as @andrewwinters5000 @jlchan @tristanmontoya on this?
I think technically it depends on whether or not "equations" and "terms" are being used in a plural or singular fashion. The MHD equations have non-conservative terms, but a non-conservative linear scalar equation has a non-conservative term.
It looks like we should go ahead with option 4.
Since "equations" is plural, I thought "have" was fine. I would go with 4 as well, assuming we don't have a problem with `have_nonconservative_terms = Trixi.have_nonconservative_Terms(semi.equations)', but it seems not a big deal, since I only see it in those tests.