jf1uids.fluid_equations.fluid module#

jf1uids.fluid_equations.fluid.conserved_state_from_primitive(primitive_state: Float[Array, 'num_vars num_cells_x'] | Float[Array, 'num_vars num_cells_x num_cells_y'] | Float[Array, 'num_vars num_cells_x num_cells_y num_cells_z'], gamma: float | Float[Array, ''], config: SimulationConfig, registered_variables: RegisteredVariables) Float[Array, 'num_vars num_cells_x'] | Float[Array, 'num_vars num_cells_x num_cells_y'] | Float[Array, 'num_vars num_cells_x num_cells_y num_cells_z'][source]#

Convert the primitive state to the conserved state.

Parameters:
  • 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: Float[Array, 'num_vars num_cells_x'] | Float[Array, 'num_vars num_cells_x num_cells_y'] | Float[Array, 'num_vars num_cells_x num_cells_y num_cells_z'], config: SimulationConfig, registered_variables: RegisteredVariables) Float[Array, 'num_cells'] | Float[Array, 'num_cells_x num_cells_y'] | Float[Array, 'num_cells_x num_cells_y num_cells_z'][source]#

Get the absolute velocity of the fluid.

Parameters:
  • 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.internal_energy_from_energy(E, rho, u)[source]#

Calculate the internal energy from the total energy.

Parameters:
  • 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.

Parameters:
  • E – The total energy.

  • rho – The density.

  • u – The velocity.

  • gamma – The adiabatic index.

Returns:

The pressure.

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

Calculate the pressure from the internal energy.

Parameters:
  • e – The internal energy.

  • rho – The density.

  • gamma – The adiabatic index.

Returns:

The pressure.

jf1uids.fluid_equations.fluid.primitive_state_from_conserved(conserved_state: Float[Array, 'num_vars num_cells_x'] | Float[Array, 'num_vars num_cells_x num_cells_y'] | Float[Array, 'num_vars num_cells_x num_cells_y num_cells_z'], gamma: float | Float[Array, ''], config: SimulationConfig, registered_variables: RegisteredVariables) Float[Array, 'num_vars num_cells_x'] | Float[Array, 'num_vars num_cells_x num_cells_y'] | Float[Array, 'num_vars num_cells_x num_cells_y num_cells_z'][source]#

Convert the conserved state to the primitive state.

Parameters:
  • conserved_state – The conserved state.

  • gamma – The adiabatic index of the fluid.

Returns:

The primitive state.

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

Calculate the speed of sound.

Parameters:
  • rho – The density.

  • p – The pressure.

  • gamma – The adiabatic index.

Returns:

The speed of sound.

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

Calculate the total energy from the primitive variables.

Parameters:
  • rho – The density.

  • u – The velocity.

  • p – The pressure.

  • gamma – The adiabatic index.

Returns:

The total energy.