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

Draft: Implement the multi-ion MHD system of Toth #1427

Draft
wants to merge 138 commits into
base: main
Choose a base branch
from

Conversation

amrueda
Copy link
Contributor

@amrueda amrueda commented May 5, 2023

This PR implements the non-conservative multi-ion MHD system of Toth. The multi-ion MHD system describes the motion of multi-species plasmas, where each ion species has its own heat capacity ratio and charge, which leads to independent mass, momentum, and energy equations for each ion species. See, e.g.,

Toth, G., Glocer, A., Ma, Y., Najib, D., & Gombosi, T. (2010, September). Multi-ion magnetohydrodynamics. In Numerical Modeling of Space Plasma Flows, Astronum-2009 (Vol. 429, p. 213).

In this PR, we include entropy consistent discretizations in 1D and 2D. We neglect the electron pressure for the moment, and do not consider collision or reaction source terms. No divergence-cleaning technique is added.

image

@amrueda amrueda marked this pull request as draft May 5, 2023 15:05
@amrueda amrueda requested a review from sloede May 5, 2023 15:06
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.

My first impression is that there are a lot of type instabilities in lower-level functions due to the approach to multiple components. Some ways to resolve them are

  • use MVectors not crossing function borders
  • use ntuple with Val{ncomponents(equations)}()
  • use StrideArrays.jl as we do in our manual SIMD optimizations
  • use Base.Cartesian
  • last resort: @generated code

src/Trixi.jl Outdated
@@ -174,14 +175,14 @@ export boundary_condition_do_nothing,
boundary_condition_wall,
BoundaryConditionNavierStokesWall, NoSlip, Adiabatic, Isothermal

export initial_condition_convergence_test, source_terms_convergence_test
export initial_condition_convergence_test, source_terms_convergence_test, source_terms_standard
Copy link
Member

Choose a reason for hiding this comment

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

This is a very general name that can lead to a lot of confusion

@ranocha
Copy link
Member

ranocha commented May 5, 2023

It would be great to see some timer output to verify whether that's the case

@codecov
Copy link

codecov bot commented May 5, 2023

Codecov Report

Attention: Patch coverage is 97.35099% with 24 lines in your changes missing coverage. Please review.

Project coverage is 96.39%. Comparing base (f09a707) to head (423af9f).

Files with missing lines Patch % Lines
src/equations/ideal_glm_mhd_multiion.jl 0.00% 17 Missing ⚠️
src/equations/numerical_fluxes.jl 0.00% 3 Missing ⚠️
src/equations/ideal_glm_mhd_multiion_3d.jl 99.65% 2 Missing ⚠️
src/equations/ideal_mhd_multiion_1d.jl 99.35% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1427      +/-   ##
==========================================
+ Coverage   96.37%   96.39%   +0.02%     
==========================================
  Files         486      488       +2     
  Lines       39186    40090     +904     
==========================================
+ Hits        37764    38644     +880     
- Misses       1422     1446      +24     
Flag Coverage Δ
unittests 96.39% <97.35%> (+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.

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.

I had only a very cursory look at the equations, since there are probably more changes incoming from the performance PR, but at least this is a start

src/callbacks_step/analysis_dg2d.jl Outdated Show resolved Hide resolved
src/equations/equations.jl Outdated Show resolved Hide resolved
examples/tree_2d_dgsem/elixir_mhdmultiion_ec.jl Outdated Show resolved Hide resolved
examples/tree_2d_dgsem/elixir_mhdmultiion_ec.jl Outdated Show resolved Hide resolved
examples/tree_2d_dgsem/elixir_mhdmultiion_rotor.jl Outdated Show resolved Hide resolved
src/equations/ideal_mhd_multiion_2d.jl Outdated Show resolved Hide resolved
src/equations/ideal_mhd_multiion_2d.jl Outdated Show resolved Hide resolved

cons = ("B1", "B2", "B3")
for i in eachcomponent(equations)
cons = (cons..., tuple("rho_" * string(i),"rho_v1_" * string(i), "rho_v2_" * string(i), "rho_v3_" * string(i), "rho_e_" * string(i))...)
Copy link
Member

Choose a reason for hiding this comment

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

This is probably not type stable, thus I wonder if this needs to be fixed. It would probably be safer to do so.


prim = ("B1", "B2", "B3")
for i in eachcomponent(equations)
prim = (prim..., tuple("rho_" * string(i),"v1_" * string(i), "v2_" * string(i), "v3_" * string(i), "p_" * string(i))...)
Copy link
Member

Choose a reason for hiding this comment

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

As above

src/equations/ideal_mhd_multiion_2d.jl Outdated Show resolved Hide resolved
amrueda and others added 30 commits December 11, 2024 13:30
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.

3 participants