Skip to content

MHD res/hyper_res should default from eta/nu #1292

Description

@nicolasaunai

Why

res and hyper_res aren't just runtime toggles, they pick which compile-time Equations template gets built (Equations::resistivity/hyperResistivity in godunov_utils.hpp, gated by if constexpr). So if you set eta=0.001 but forget res=True, the simulation silently runs with no resistive term compiled in at all — no warning, nothing. Same for nu/hyper_res. Hybrid doesn't have this problem since resistivity/hyper_resistivity are just values there, no separate switch.

What

Default res/hyper_res from eta/nu in check_mhd_terms (pyphare/pharein/simulation.py) when not explicitly given, so setting a nonzero coefficient is enough to turn the term on. Keep them settable manually for the rare case someone wants the term compiled in with a zero coefficient.

Ideas on how (optional)

res = kwargs.get("res", kwargs.get("eta", 0.0) > 0.0)
hyper_res = kwargs.get("hyper_res", kwargs.get("nu", 0.0) > 0.0)

Alternatives considered

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions