astronomix._modules._cosmic_rays.cr_fluid_equations#
Two-fluid (gas + cosmic-ray) equation-of-state helpers.
These routines convert between primitive and conserved quantities for a fluid
that carries a cosmic-ray component alongside the thermal gas. The cosmic rays
are tracked through n_cr = P_cr ** (1 / gamma_cr) (an advected scalar), so
the cosmic-ray pressure is recovered as P_cr = n_cr ** gamma_cr. The total
pressure stored in pressure_index is the sum of the gas and cosmic-ray
pressures.
Module Contents#
Functions#
Calculates the total energy density from primitive variables in a system with cosmic rays. |
|
Calculates the gas pressure from the primitive state when cosmic rays are considered in the simulation. |
|
Calculates the total pressure from the conserved state when cosmic rays are considered in the simulation. |
|
Calculates the speed of sound from the primitive state when cosmic rays are considered in the simulation, where c_s = sqrt((gamma_gas * P_gas + gamma_cr * P_CR) / rho) |
Data#
API#
- astronomix._modules._cosmic_rays.cr_fluid_equations.gamma_gas = None#
- astronomix._modules._cosmic_rays.cr_fluid_equations.gamma_cr = None#
- astronomix._modules._cosmic_rays.cr_fluid_equations.total_energy_from_primitives_with_crs(primitive_state: jaxtyping.Float[jaxtyping.Array, num_vars num_cells], registered_variables: astronomix.variable_registry.registered_variables.RegisteredVariables) jaxtyping.Float[jaxtyping.Array, num_cells][source]#
Calculates the total energy density from primitive variables in a system with cosmic rays.
- Args:
primitive_state: Array of primitive variables registered_variables: Object containing indices for accessing different physical quantities
- Returns:
Total energy density array
- astronomix._modules._cosmic_rays.cr_fluid_equations.gas_pressure_from_primitives_with_crs(primitive_state: jaxtyping.Float[jaxtyping.Array, num_vars num_cells], registered_variables: astronomix.variable_registry.registered_variables.RegisteredVariables) jaxtyping.Float[jaxtyping.Array, num_cells][source]#
Calculates the gas pressure from the primitive state when cosmic rays are considered in the simulation.
- Args:
primitive_state: Array of primitive variables registered_variables: Object containing indices for accessing different physical quantities
- Returns:
gas pressure
- astronomix._modules._cosmic_rays.cr_fluid_equations.total_pressure_from_conserved_with_crs(conserved_state: jaxtyping.Float[jaxtyping.Array, num_vars num_cells], registered_variables: astronomix.variable_registry.registered_variables.RegisteredVariables) jaxtyping.Float[jaxtyping.Array, num_cells][source]#
Calculates the total pressure from the conserved state when cosmic rays are considered in the simulation.
- Args:
primitive_state: Array of primitive variables registered_variables: Object containing indices for accessing different physical quantities
- Returns:
total pressure
- astronomix._modules._cosmic_rays.cr_fluid_equations.speed_of_sound_crs(primitive_state: jaxtyping.Float[jaxtyping.Array, num_vars num_cells], registered_variables: astronomix.variable_registry.registered_variables.RegisteredVariables) jaxtyping.Float[jaxtyping.Array, num_cells][source]#
Calculates the speed of sound from the primitive state when cosmic rays are considered in the simulation, where c_s = sqrt((gamma_gas * P_gas + gamma_cr * P_CR) / rho)
- Args:
primitive_state: Array of primitive variables registered_variables: Object containing indices for accessing different physical quantities
- Returns:
sound speed