jf1uids.fluid_equations.fluid#

Module Contents#

Functions#

construct_primitive_state

Stack the primitive variables into the state array.

construct_primitive_state3D

Stack the primitive variables into the state array.

primitive_state_from_conserved

Convert the conserved state to the primitive state.

conserved_state_from_primitive

Convert the primitive state to the conserved state.

get_absolute_velocity

Get the absolute velocity of the fluid.

pressure_from_internal_energy

Calculate the pressure from the internal energy.

internal_energy_from_energy

Calculate the internal energy from the total energy.

pressure_from_energy

Calculate the pressure from the total energy.

total_energy_from_primitives

Calculate the total energy from the primitive variables.

speed_of_sound

Calculate the speed of sound.

API#

jf1uids.fluid_equations.fluid.construct_primitive_state(config: jf1uids.option_classes.simulation_config.SimulationConfig, registered_variables: jf1uids.fluid_equations.registered_variables.RegisteredVariables, density: jf1uids.option_classes.simulation_config.FIELD_TYPE, velocity_x: Union[jf1uids.option_classes.simulation_config.FIELD_TYPE, types.NoneType] = None, velocity_y: Union[jf1uids.option_classes.simulation_config.FIELD_TYPE, types.NoneType] = None, velocity_z: Union[jf1uids.option_classes.simulation_config.FIELD_TYPE, types.NoneType] = None, magnetic_field_x: Union[jf1uids.option_classes.simulation_config.FIELD_TYPE, types.NoneType] = None, magnetic_field_y: Union[jf1uids.option_classes.simulation_config.FIELD_TYPE, types.NoneType] = None, magnetic_field_z: Union[jf1uids.option_classes.simulation_config.FIELD_TYPE, types.NoneType] = None, gas_pressure: Union[jf1uids.option_classes.simulation_config.FIELD_TYPE, types.NoneType] = None, cosmic_ray_pressure: Union[jf1uids.option_classes.simulation_config.FIELD_TYPE, types.NoneType] = None) jf1uids.option_classes.simulation_config.STATE_TYPE[source]#

Stack the primitive variables into the state array.

IN 1D SET ONLY THE XCOMPONENTS, in 2D SET X AND Y COMPONENTS, in 3D SET X, Y AND Z COMPONENTS

Args:

rho: The density of the fluid. u: The velocity of the fluid. p: The pressure of the fluid. registered_variables: The indices of the variables in the state array.

Returns:

The state array.

jf1uids.fluid_equations.fluid.construct_primitive_state3D(rho: jaxtyping.Float[jaxtyping.Array, num_cells num_cells num_cells], u_x: jaxtyping.Float[jaxtyping.Array, num_cells num_cells num_cells], u_y: jaxtyping.Float[jaxtyping.Array, num_cells num_cells num_cells], u_z: jaxtyping.Float[jaxtyping.Array, num_cells num_cells num_cells], p: jaxtyping.Float[jaxtyping.Array, num_cells num_cells num_cells], registered_variables: jf1uids.fluid_equations.registered_variables.RegisteredVariables) jaxtyping.Float[jaxtyping.Array, num_vars num_cells num_cells num_cells][source]#

Stack the primitive variables into the state array.

Args:

rho: The density of the fluid. u: The velocity of the fluid. p: The pressure of the fluid. registered_variables: The indices of the variables in the state array.

Returns:

The state array.

jf1uids.fluid_equations.fluid.primitive_state_from_conserved(conserved_state: jf1uids.option_classes.simulation_config.STATE_TYPE, gamma: Union[float, jaxtyping.Float[jaxtyping.Array]], config: jf1uids.option_classes.simulation_config.SimulationConfig, registered_variables: jf1uids.fluid_equations.registered_variables.RegisteredVariables) jf1uids.option_classes.simulation_config.STATE_TYPE[source]#

Convert the conserved state to the primitive state.

Args:

conserved_state: The conserved state. gamma: The adiabatic index of the fluid.

Returns:

The primitive state.

jf1uids.fluid_equations.fluid.conserved_state_from_primitive(primitive_state: jf1uids.option_classes.simulation_config.STATE_TYPE, gamma: Union[float, jaxtyping.Float[jaxtyping.Array]], config: jf1uids.option_classes.simulation_config.SimulationConfig, registered_variables: jf1uids.fluid_equations.registered_variables.RegisteredVariables) jf1uids.option_classes.simulation_config.STATE_TYPE[source]#

Convert the primitive state to the conserved state.

Args:

primitive_state: The primitive state. gamma: The adiabatic index of the fluid.

Returns:

The conserved state.

jf1uids.fluid_equations.fluid.get_absolute_velocity(primitive_state: jf1uids.option_classes.simulation_config.STATE_TYPE, config: jf1uids.option_classes.simulation_config.SimulationConfig, registered_variables: jf1uids.fluid_equations.registered_variables.RegisteredVariables) Union[jaxtyping.Float[jaxtyping.Array, num_cells], jaxtyping.Float[jaxtyping.Array, num_cells_x num_cells_y], jaxtyping.Float[jaxtyping.Array, num_cells_x num_cells_y num_cells_z]][source]#

Get the absolute velocity of the fluid.

Args:

primitive_state: The primitive state of the fluid. config: The simulation configuration. registered_variables: The registered variables.

Returns:

The absolute velocity.

jf1uids.fluid_equations.fluid.pressure_from_internal_energy(e, rho, gamma)[source]#

Calculate the pressure from the internal energy.

Args:

e: The internal energy. rho: The density. gamma: The adiabatic index.

Returns:

The pressure.

jf1uids.fluid_equations.fluid.internal_energy_from_energy(E, rho, u)[source]#

Calculate the internal energy from the total energy.

Args:

E: The total energy. rho: The density. u: The velocity.

Returns:

The internal energy.

jf1uids.fluid_equations.fluid.pressure_from_energy(E, rho, u, gamma)[source]#

Calculate the pressure from the total energy.

Args:

E: The total energy. rho: The density. u: The velocity. gamma: The adiabatic index.

Returns:

The pressure.

jf1uids.fluid_equations.fluid.total_energy_from_primitives(rho, u, p, gamma)[source]#

Calculate the total energy from the primitive variables.

Args:

rho: The density. u: The velocity. p: The pressure. gamma: The adiabatic index.

Returns:

The total energy.

jf1uids.fluid_equations.fluid.speed_of_sound(rho, p, gamma)[source]#

Calculate the speed of sound.

Args:

rho: The density. p: The pressure. gamma: The adiabatic index.

Returns:

The speed of sound.