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

Use total pressure for 1D HLLC MHD #1756

Merged

Conversation

DanielDoehring
Copy link
Contributor

@DanielDoehring DanielDoehring commented Nov 24, 2023

Unfortunately I made a mistake in the PR https://github.com/trixi-framework/Trixi.jl/pull/1702 by not noticing the different notions of pressure $p$ (thermal in https://www.sciencedirect.com/science/article/pii/S0021999118301463 ) and total $$p = p_\mathrm{Thermal} + \frac{1}{2} \Vert \boldsymbol B \Vert^2 $$ in https://www.sciencedirect.com/science/article/pii/S0021999104003857 . This PR takes care of this.

For validation the Alfven test is performed for

flux_lax_friedrichs:

####################################################################################################
l2
rho                 rho_v1              rho_v2              rho_v3              rho_e               B1                  B2                  B3                  
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       
1.04e-05  -         6.57e-07  -         3.58e-05  -         3.58e-05  -         5.08e-06  -         1.20e-16  -         3.60e-05  -         3.60e-05  -         
1.99e-07  5.71      4.27e-09  7.26      1.87e-06  4.26      1.87e-06  4.26      9.38e-08  5.76      1.20e-16  -0.00     1.88e-06  4.26      1.88e-06  4.26      
3.23e-09  5.94      1.47e-11  8.19      1.12e-07  4.07      1.12e-07  4.07      1.41e-09  6.06      1.20e-16  0.00      1.12e-07  4.07      1.12e-07  4.07      
5.11e-11  5.98      7.38e-14  7.64      6.90e-09  4.02      6.90e-09  4.02      2.23e-11  5.98      1.20e-16  0.00      6.90e-09  4.02      6.90e-09  4.02      
8.02e-13  5.99      1.80e-14  2.04      4.30e-10  4.00      4.30e-10  4.00      3.49e-13  6.00      1.20e-16  -0.00     4.30e-10  4.00      4.30e-10  4.00      

mean      5.91      mean      6.28      mean      4.09      mean      4.09      mean      5.95      mean      0.00      mean      4.09      mean      4.09      
----------------------------------------------------------------------------------------------------
linf
rho                 rho_v1              rho_v2              rho_v3              rho_e               B1                  B2                  B3                  
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       
2.61e-05  -         9.58e-07  -         1.24e-04  -         1.24e-04  -         1.51e-05  -         2.22e-16  -         1.27e-04  -         1.27e-04  -         
5.70e-07  5.52      8.61e-09  6.80      6.41e-06  4.28      6.41e-06  4.28      2.68e-07  5.82      2.22e-16  -0.00     6.41e-06  4.30      6.41e-06  4.30      
9.45e-09  5.91      2.41e-11  8.48      2.90e-07  4.46      2.90e-07  4.46      4.20e-09  5.99      2.22e-16  -0.00     2.90e-07  4.46      2.90e-07  4.46      
1.50e-10  5.98      1.72e-13  7.13      1.40e-08  4.37      1.40e-08  4.37      6.62e-11  5.99      2.22e-16  -0.00     1.40e-08  4.37      1.40e-08  4.37      
2.36e-12  5.99      2.11e-14  3.03      7.43e-10  4.24      7.43e-10  4.24      1.04e-12  5.99      2.22e-16  -0.00     7.43e-10  4.24      7.43e-10  4.24      

mean      5.85      mean      6.36      mean      4.34      mean      4.34      mean      5.95      mean      -0.00     mean      4.34      mean      4.34      
----------------------------------------------------------------------------------------------------

flux_hll:

####################################################################################################
l2
rho                 rho_v1              rho_v2              rho_v3              rho_e               B1                  B2                  B3                  
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       
1.04e-05  -         6.57e-07  -         3.58e-05  -         3.58e-05  -         5.08e-06  -         1.20e-16  -         3.60e-05  -         3.60e-05  -         
1.99e-07  5.71      4.27e-09  7.26      1.87e-06  4.26      1.87e-06  4.26      9.38e-08  5.76      1.20e-16  -0.00     1.88e-06  4.26      1.88e-06  4.26      
3.23e-09  5.94      1.47e-11  8.19      1.12e-07  4.07      1.12e-07  4.07      1.41e-09  6.06      1.20e-16  0.00      1.12e-07  4.07      1.12e-07  4.07      
5.11e-11  5.98      7.39e-14  7.63      6.90e-09  4.02      6.90e-09  4.02      2.23e-11  5.98      1.20e-16  0.00      6.90e-09  4.02      6.90e-09  4.02      
8.02e-13  5.99      1.80e-14  2.04      4.30e-10  4.00      4.30e-10  4.00      3.49e-13  6.00      1.20e-16  -0.00     4.30e-10  4.00      4.30e-10  4.00      

mean      5.91      mean      6.28      mean      4.09      mean      4.09      mean      5.95      mean      0.00      mean      4.09      mean      4.09      
----------------------------------------------------------------------------------------------------
linf
rho                 rho_v1              rho_v2              rho_v3              rho_e               B1                  B2                  B3                  
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       
2.61e-05  -         9.58e-07  -         1.24e-04  -         1.24e-04  -         1.51e-05  -         2.22e-16  -         1.27e-04  -         1.27e-04  -         
5.70e-07  5.52      8.61e-09  6.80      6.41e-06  4.28      6.41e-06  4.28      2.68e-07  5.82      2.22e-16  -0.00     6.41e-06  4.30      6.41e-06  4.30      
9.45e-09  5.91      2.41e-11  8.48      2.90e-07  4.46      2.90e-07  4.46      4.20e-09  5.99      2.22e-16  -0.00     2.90e-07  4.46      2.90e-07  4.46      
1.50e-10  5.98      1.72e-13  7.13      1.40e-08  4.37      1.40e-08  4.37      6.62e-11  5.99      2.22e-16  -0.00     1.40e-08  4.37      1.40e-08  4.37      
2.37e-12  5.98      2.24e-14  2.94      7.43e-10  4.24      7.43e-10  4.24      1.04e-12  5.99      2.22e-16  -0.00     7.43e-10  4.24      7.43e-10  4.24      

mean      5.85      mean      6.34      mean      4.34      mean      4.34      mean      5.95      mean      -0.00     mean      4.34      mean      4.34      
----------------------------------------------------------------------------------------------------

flux_hllc:

####################################################################################################
l2
rho                 rho_v1              rho_v2              rho_v3              rho_e               B1                  B2                  B3                  
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       
1.04e-05  -         1.97e-06  -         3.59e-05  -         3.59e-05  -         5.27e-06  -         1.20e-16  -         3.60e-05  -         3.60e-05  -         
2.08e-07  5.64      3.27e-08  5.91      1.87e-06  4.26      1.87e-06  4.26      8.80e-08  5.90      1.20e-16  -0.00     1.87e-06  4.26      1.87e-06  4.26      
4.02e-09  5.69      5.72e-10  5.84      1.12e-07  4.07      1.12e-07  4.07      1.40e-09  5.97      1.20e-16  0.00      1.12e-07  4.07      1.12e-07  4.07      
9.57e-11  5.39      8.64e-12  6.05      6.90e-09  4.02      6.90e-09  4.02      2.18e-11  6.01      1.20e-16  0.00      6.90e-09  4.02      6.90e-09  4.02      
2.73e-12  5.13      1.37e-13  5.98      4.30e-10  4.00      4.30e-10  4.00      3.37e-13  6.02      1.20e-16  -0.00     4.30e-10  4.00      4.30e-10  4.00      

mean      5.46      mean      5.94      mean      4.09      mean      4.09      mean      5.97      mean      0.00      mean      4.09      mean      4.09      
----------------------------------------------------------------------------------------------------
linf
rho                 rho_v1              rho_v2              rho_v3              rho_e               B1                  B2                  B3                  
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       
2.89e-05  -         7.31e-06  -         1.24e-04  -         1.24e-04  -         1.51e-05  -         2.22e-16  -         1.26e-04  -         1.26e-04  -         
7.75e-07  5.22      1.06e-07  6.11      6.42e-06  4.27      6.42e-06  4.27      2.61e-07  5.86      2.22e-16  -0.00     6.39e-06  4.30      6.39e-06  4.30      
1.71e-08  5.50      1.56e-09  6.08      2.90e-07  4.47      2.90e-07  4.47      4.12e-09  5.98      2.22e-16  -0.00     2.90e-07  4.46      2.90e-07  4.46      
4.05e-10  5.40      2.61e-11  5.90      1.40e-08  4.37      1.40e-08  4.37      6.41e-11  6.00      2.22e-16  -0.00     1.40e-08  4.37      1.40e-08  4.37      
1.06e-11  5.26      3.93e-13  6.06      7.43e-10  4.24      7.43e-10  4.24      9.86e-13  6.02      2.22e-16  -0.00     7.43e-10  4.24      7.43e-10  4.24      

mean      5.34      mean      6.04      mean      4.34      mean      4.34      mean      5.97      mean      -0.00     mean      4.34      mean      4.34      
----------------------------------------------------------------------------------------------------

@DanielDoehring DanielDoehring added the bug Something isn't working label Nov 24, 2023
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
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! Just a small suggestion updating the new comment to avoid future confusion.

src/equations/ideal_glm_mhd_1d.jl Outdated Show resolved Hide resolved
Co-authored-by: Andrew Winters <andrew.ross.winters@liu.se>
Copy link

codecov bot commented Nov 24, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (d7e1f74) 94.31% compared to head (eb006ff) 85.21%.

Files Patch % Lines
src/equations/ideal_glm_mhd_1d.jl 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1756      +/-   ##
==========================================
- Coverage   94.31%   85.21%   -9.10%     
==========================================
  Files         431      431              
  Lines       34893    34845      -48     
==========================================
- Hits        32908    29692    -3216     
- Misses       1985     5153    +3168     
Flag Coverage Δ
unittests 85.21% <80.00%> (-9.10%) ⬇️

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 enabled auto-merge (squash) November 25, 2023 12:20
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!

@ranocha ranocha disabled auto-merge December 1, 2023 12:38
@ranocha ranocha merged commit 17d5070 into trixi-framework:main Dec 1, 2023
30 of 33 checks passed
@DanielDoehring DanielDoehring deleted the HLLC_MHD_1D_TotalPressure branch December 1, 2023 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants