astronomix._fluid_equations._equations_mhd#

Equations for 3D adiabatic ideal magnetohydrodynamics (MHD).

Provides conversions between primitive and conserved states (ideal-gas and isothermal variants) and the MHD thermodynamic relations (thermal pressure, total energy and total pressure).

Module Contents#

Functions#

thermal_pressure_from_energy_mhd

Calculate the pressure from the total energy in MHD.

total_energy_from_primitives_mhd

Calculate the total energy from the primitive variables in MHD.

conserved_state_from_primitive_mhd

Convert the primitive state to the conserved state for ideal-gas MHD.

primitive_state_from_conserved_mhd

Convert the conserved state to the primitive state for ideal-gas MHD.

primitive_state_from_conserved_isothermal

Convert the conserved state to the primitive state for the isothermal case.

conserved_state_from_primitive_isothermal

Convert the primitive state to the conserved state for the isothermal case.

total_pressure_from_conserved_mhd

Calculate the total pressure (thermal + magnetic) from a conserved state.

API#

astronomix._fluid_equations._equations_mhd.thermal_pressure_from_energy_mhd(E, rho, u_squared, b_squared, gamma)[source]#

Calculate the pressure from the total energy in MHD.

Args:

E: The total energy. rho: The density. u_squared: The squared velocity. b_squared: The squared magnetic field. gamma: The adiabatic index.

Returns:

The pressure.

astronomix._fluid_equations._equations_mhd.total_energy_from_primitives_mhd(rho, u_squared, p, b_squared, gamma)[source]#

Calculate the total energy from the primitive variables in MHD.

Args:

rho: The density. u_squared: The squared velocity. p: The thermal pressure. b_squared: The squared magnetic field. gamma: The adiabatic index.

Returns:

The total energy (internal + kinetic + magnetic).

astronomix._fluid_equations._equations_mhd.conserved_state_from_primitive_mhd(primitive_state: astronomix.option_classes.simulation_config.STATE_TYPE, gamma: Union[float, jaxtyping.Float[jaxtyping.Array]], registered_variables: astronomix.variable_registry.registered_variables.RegisteredVariables) astronomix.option_classes.simulation_config.STATE_TYPE[source]#

Convert the primitive state to the conserved state for ideal-gas MHD.

Currently only the 3D case is supported.

Args:

primitive_state: The primitive MHD state. gamma: The adiabatic index of the fluid. registered_variables: The registered variables.

Returns:

The conserved MHD state.

astronomix._fluid_equations._equations_mhd.primitive_state_from_conserved_mhd(conserved_state: astronomix.option_classes.simulation_config.STATE_TYPE, rhomin: Union[float, jaxtyping.Float[jaxtyping.Array]], pgmin: Union[float, jaxtyping.Float[jaxtyping.Array]], gamma: Union[float, jaxtyping.Float[jaxtyping.Array]], config: astronomix.option_classes.simulation_config.SimulationConfig, registered_variables: astronomix.variable_registry.registered_variables.RegisteredVariables) astronomix.option_classes.simulation_config.STATE_TYPE[source]#

Convert the conserved state to the primitive state for ideal-gas MHD.

Currently only the 3D case is supported.

Args:

conserved_state: The conserved MHD state. rhomin: The density floor (applied when clamp_in_estimates is set). pgmin: The pressure floor (applied when clamp_in_estimates is set). gamma: The adiabatic index of the fluid. config: The simulation configuration. registered_variables: The registered variables.

Returns:

The primitive MHD state.

astronomix._fluid_equations._equations_mhd.primitive_state_from_conserved_isothermal(conserved_state: astronomix.option_classes.simulation_config.STATE_TYPE, minimum_density: Union[float, jaxtyping.Float[jaxtyping.Array]], config: astronomix.option_classes.simulation_config.SimulationConfig, registered_variables: astronomix.variable_registry.registered_variables.RegisteredVariables) astronomix.option_classes.simulation_config.STATE_TYPE[source]#

Convert the conserved state to the primitive state for the isothermal case.

astronomix._fluid_equations._equations_mhd.conserved_state_from_primitive_isothermal(primitive_state: astronomix.option_classes.simulation_config.STATE_TYPE, config: astronomix.option_classes.simulation_config.SimulationConfig, registered_variables: astronomix.variable_registry.registered_variables.RegisteredVariables) astronomix.option_classes.simulation_config.STATE_TYPE[source]#

Convert the primitive state to the conserved state for the isothermal case.

astronomix._fluid_equations._equations_mhd.total_pressure_from_conserved_mhd(conserved_state: astronomix.option_classes.simulation_config.STATE_TYPE, gamma: Union[float, jaxtyping.Float[jaxtyping.Array]], registered_variables: astronomix.variable_registry.registered_variables.RegisteredVariables) astronomix.option_classes.simulation_config.FIELD_TYPE[source]#

Calculate the total pressure (thermal + magnetic) from a conserved state.

Currently only the 3D case is supported.

Args:

conserved_state: The conserved MHD state. gamma: The adiabatic index of the fluid. registered_variables: The registered variables.

Returns:

The total pressure, i.e. thermal pressure plus magnetic pressure.