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

Sutherlands Law for temperature dependent viscosity #1808

Merged
merged 45 commits into from
Mar 27, 2024

Conversation

DanielDoehring
Copy link
Contributor

Closes #1195

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.

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 Jan 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.07%. Comparing base (909abb4) to head (042b18e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1808      +/-   ##
==========================================
- Coverage   96.30%   93.07%   -3.23%     
==========================================
  Files         440      441       +1     
  Lines       35793    35798       +5     
==========================================
- Hits        34470    33317    -1153     
- Misses       1323     2481    +1158     
Flag Coverage Δ
unittests 93.07% <100.00%> (-3.23%) ⬇️

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.

@DanielDoehring DanielDoehring added the enhancement New feature or request label Jan 23, 2024
@DanielDoehring
Copy link
Contributor Author

Hey @sloede and @jlchan since you brought this up in #1195 can you take a brief look at this whether the fundamental choices (implementing this as a new set of equations) and form of temperature-dependent viscosity seem meaningful to you?

@jlchan
Copy link
Contributor

jlchan commented Mar 2, 2024

This looks good to me - I am only familiar with Sutherlands law though and not anything else more complex.

@sloede
Copy link
Member

sloede commented Mar 2, 2024

Thanks for working on this! I haven't looked at your changes in detail yet, but I'm wondering if really a second set of equations is required or desirable. Would it also be possible to implement this as a equation-of-state-like property of the original NSE implementation? That is, make the viscosity type a type parameter of the NSE struct, or even just allow passing different viscosity_dynamic functions to the constructor of the NSE, allowing to either use a constant function, Sutherland's law, or something fancier?

I am worried about code duplication what I perceive (maybe wrongly) as an implementation detail in many other NSE codes I've seen. Maybe @andrewwinters5000 has a different take on this?

@DanielDoehring
Copy link
Contributor Author

I haven't looked at your changes in detail yet, but I'm wondering if really a second set of equations is required or desirable. Would it also be possible to implement this as a equation-of-state-like property of the original NSE implementation? That is, make the viscosity type a type parameter of the NSE struct, or even just allow passing different viscosity_dynamic functions to the constructor of the NSE, allowing to either use a constant function, Sutherland's law, or something fancier?

That is a good idea, I will think about this. In principle, it should not be to difficult to pass in a function mu() that is then being called with teperature. This way, one could also use more complex models.
Question is whether this can be done without (significant) performance loss for the constant viscosity case.

@sloede
Copy link
Member

sloede commented Mar 2, 2024

In principle, it should not be to difficult to pass in a function mu() that is then being called with teperature.

I would just pass the entire state such that the user can freely decide what to do with it.

Question is whether this can be done without (significant) performance loss for the constant viscosity case.

If a function is defined that ignores it's input and just returns a constant value, it should in virtually all cases just be optimized away.

A question remains though as to whether we can efficiently provide a convenience layer that auto-generates the constant function for a given numerical value of mu, such that a user may just pass the constant value and does not have to always wrap it in a function.

jlchan
jlchan previously approved these changes Mar 19, 2024
Copy link
Member

@andrewwinters5000 andrewwinters5000 left a comment

Choose a reason for hiding this comment

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

LGTM! This is a nice extension to the Navier-Stokes capabilities.

@DanielDoehring DanielDoehring enabled auto-merge (squash) March 19, 2024 22:04
@DanielDoehring DanielDoehring removed the request for review from sloede March 21, 2024 08:08
@DanielDoehring DanielDoehring dismissed stale reviews from andrewwinters5000 and jlchan via 03c7c88 March 22, 2024 08:05
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.

Minor formatting change, then LGTM!

src/equations/compressible_navier_stokes.jl Outdated Show resolved Hide resolved
sloede
sloede previously approved these changes Mar 22, 2024
@DanielDoehring
Copy link
Contributor Author

It would be really nice if this gets merged sometime soon as I am currently working on the computation of drag & lift due to viscous terms (following up on #1812) for which the viscosity mu is needed.

@jlchan
Copy link
Contributor

jlchan commented Mar 27, 2024

@andrewwinters5000 OK to merge?

@DanielDoehring I only checked a few of the CI failures - they look spurious. Did you see any actual failing tests?

@DanielDoehring
Copy link
Contributor Author

@jlchan No, not except for codecov to fail.

Copy link
Member

@andrewwinters5000 andrewwinters5000 left a comment

Choose a reason for hiding this comment

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

@jlchan Yes, everything looks good to me.

@jlchan
Copy link
Contributor

jlchan commented Mar 27, 2024

Great, then unless someone objects, I'm ok with force merging this.

Do I need to disable auto-merge to do so?

@andrewwinters5000
Copy link
Member

Yes, you need to disable auto-merge. Then there will be an override option

@jlchan jlchan disabled auto-merge March 27, 2024 14:55
@jlchan jlchan merged commit 73da92c into trixi-framework:main Mar 27, 2024
29 of 35 checks passed
@DanielDoehring
Copy link
Contributor Author

Thanks @jlchan !

@DanielDoehring DanielDoehring deleted the SutherlandsLaw branch March 27, 2024 15:19
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.

Add Sutherland's law to compressible Navier-Stokes
5 participants