jaxfluids.materials package

Submodules

jaxfluids.materials.ideal_gas module

class jaxfluids.materials.ideal_gas.IdealGas(unit_handler: UnitHandler, dynamic_viscosity: float | str | function, sutherland_parameters: List, bulk_viscosity: float, thermal_conductivity: float | str | function, prandtl_number: float, specific_heat_ratio: float, specific_gas_constant: float, **kwargs)[source]

Bases: Material

Implements the ideal gas law.

get_energy(p: Array, rho: Array) Array[source]

See base class.

get_grueneisen(rho: Array) Array[source]

See base class.

get_pressure(e: Array, rho: Array) Array[source]

See base class.

get_psi(p: Array, rho: Array) Array[source]

See base class.

get_speed_of_sound(p: Array, rho: Array) Array[source]

See base class.

get_temperature(p: Array, rho: Array) Array[source]

See base class.

get_total_energy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

See base class.

get_total_enthalpy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

See base class.

jaxfluids.materials.material module

class jaxfluids.materials.material.Material(unit_handler: UnitHandler, dynamic_viscosity: float | str | function, sutherland_parameters: List, bulk_viscosity: float, thermal_conductivity: float | str | function, prandtl_number: float, **kwargs)[source]

Bases: ABC

The Material class implements an abstract class for a material, i.e., the computation of the dynamic viscosity, bulk viscosity and the thermal conductivity. The equation of states are implemented in the corresonding child classes.

eps = 2.220446049250313e-16
abstract get_energy(p: Array, rho: Array) Array[source]

Computes specific internal energy e = e(p, rho)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Specific internal energy buffer

Return type:

jnp.ndarray

abstract get_grueneisen(rho: Array) Array[source]

Computes the Grueneisen coefficient from density. Gamma = p_e / rho; p_e is partial derivative of pressure wrt internal specific energy.

Parameters:

rho (jnp.ndarray) – Density buffer

Returns:

Grueneisen

Return type:

jnp.ndarray

abstract get_pressure(e: Array, rho: Array) Array[source]

Computes pressure from internal energy and density. p = p(e, rho)

Parameters:
  • e (jnp.ndarray) – Specific internal energy buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Pressue buffer

Return type:

jnp.ndarray

abstract get_psi(p: Array, rho: Array) Array[source]

Computes psi from pressure and density. psi = p_rho; p_rho is partial derivative of pressure wrt density.

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Psi

Return type:

jnp.ndarray

abstract get_speed_of_sound(p: Array, rho: Array) Array[source]

Computes speed of sound from pressure and density. c = c(p, rho)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Speed of sound buffer

Return type:

jnp.ndarray

abstract get_temperature(p: Array, rho: Array) Array[source]

Computes temperature from pressure and density. T = T(p, rho)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Temperature buffer

Return type:

jnp.ndarray

abstract get_total_energy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

Computes total energy per unit volume from pressure, density, and velocities. E = E(p, rho, velX, velY, velZ)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

  • u (jnp.ndarray) – Velocity in x direction

  • v (jnp.ndarray) – Velocity in y direction

  • w (jnp.ndarray) – Velocity in z direction

Returns:

Total energy per unit volume

Return type:

jnp.ndarray

abstract get_total_enthalpy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

Computes total specific enthalpy from pressure, density, and velocities. H = H(p, rho, velX, velY, velZ)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

  • u (jnp.ndarray) – Velocity in x direction

  • v (jnp.ndarray) – Velocity in y direction

  • w (jnp.ndarray) – Velocity in z direction

Returns:

Total specific enthalpy buffer

Return type:

jnp.ndarray

jaxfluids.materials.material_manager module

class jaxfluids.materials.material_manager.MaterialManager(unit_handler: UnitHandler, material_properties: Dict, levelset_type: str)[source]

Bases: object

The MaterialManager class is a wrapper class that holds the materials. The main purpose of this class is to enable the computation of material parameters for two-phase flows, i.e., the presence of two (different) materials.

eps = 2.220446049250313e-16
get_dynamic_viscosity(T: Array)[source]
get_energy(p: Array, rho: Array) Array[source]
get_grueneisen(rho: Array) Array[source]
get_pressure(e: Array, rho: Array) Array[source]
get_psi(p: Array, rho: Array) Array[source]
get_speed_of_sound(p: Array, rho: Array) Array[source]
get_temperature(p: Array, rho: Array) Array[source]
get_thermal_conductivity(T: Array)[source]
get_total_energy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]
get_total_enthalpy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

jaxfluids.materials.safe_ideal_gas module

class jaxfluids.materials.safe_ideal_gas.SafeIdealGas(unit_handler: UnitHandler, dynamic_viscosity: float | str | function, sutherland_parameters: List, bulk_viscosity: float, thermal_conductivity: float | str | function, prandtl_number: float, specific_heat_ratio: float, specific_gas_constant: float, **kwargs)[source]

Bases: Material

Implements the safe ideal gas law, i.e., prevents division by zero and negative square roots

get_energy(p: Array, rho: Array) Array[source]

See base class.

get_grueneisen(rho)[source]

See base class.

get_pressure(e: Array, rho: Array) Array[source]

See base class.

get_psi(p, rho)[source]

See base class.

get_speed_of_sound(p: Array, rho: Array) Array[source]

See base class.

get_temperature(p: Array, rho: Array) Array[source]

See base class.

get_total_energy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

See base class.

get_total_enthalpy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

See base class.

jaxfluids.materials.stiffened_gas module

class jaxfluids.materials.stiffened_gas.StiffenedGas(unit_handler: UnitHandler, dynamic_viscosity: float | str | function, sutherland_parameters: List, bulk_viscosity: float, thermal_conductivity: float | str | function, prandtl_number: float, specific_heat_ratio: float, specific_gas_constant: float, background_pressure: float, **kwargs)[source]

Bases: Material

Implements the stiffened gas equation of state.

get_energy(p: Array, rho: Array) Array[source]

Computes specific internal energy e = e(p, rho)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Specific internal energy buffer

Return type:

jnp.ndarray

get_grueneisen(rho: Array) Array[source]

Computes the Grueneisen coefficient from density. Gamma = p_e / rho; p_e is partial derivative of pressure wrt internal specific energy.

Parameters:

rho (jnp.ndarray) – Density buffer

Returns:

Grueneisen

Return type:

jnp.ndarray

get_pressure(e: Array, rho: Array) Array[source]

Computes pressure from internal energy and density. p = p(e, rho)

Parameters:
  • e (jnp.ndarray) – Specific internal energy buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Pressue buffer

Return type:

jnp.ndarray

get_psi(p: Array, rho: Array) Array[source]

Computes psi from pressure and density. psi = p_rho; p_rho is partial derivative of pressure wrt density.

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Psi

Return type:

jnp.ndarray

get_speed_of_sound(p: Array, rho: Array) Array[source]

Computes speed of sound from pressure and density. c = c(p, rho)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Speed of sound buffer

Return type:

jnp.ndarray

get_temperature(p: Array, rho: Array) Array[source]

Computes temperature from pressure and density. T = T(p, rho)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Temperature buffer

Return type:

jnp.ndarray

get_total_energy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

Computes total energy per unit volume from pressure, density, and velocities. E = E(p, rho, velX, velY, velZ)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

  • u (jnp.ndarray) – Velocity in x direction

  • v (jnp.ndarray) – Velocity in y direction

  • w (jnp.ndarray) – Velocity in z direction

Returns:

Total energy per unit volume

Return type:

jnp.ndarray

get_total_enthalpy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

Computes total specific enthalpy from pressure, density, and velocities. H = H(p, rho, velX, velY, velZ)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

  • u (jnp.ndarray) – Velocity in x direction

  • v (jnp.ndarray) – Velocity in y direction

  • w (jnp.ndarray) – Velocity in z direction

Returns:

Total specific enthalpy buffer

Return type:

jnp.ndarray

jaxfluids.materials.tait module

class jaxfluids.materials.tait.Tait(unit_handler: UnitHandler, dynamic_viscosity: float | str | function, sutherland_parameters: List, bulk_viscosity: float, thermal_conductivity: float | str | function, prandtl_number: float, specific_gas_constant: float, specific_heat_ratio: float = 7.15, A_param: float = 100000.0, B_param: float = 331000000.0, rho_0: float = 1000.0, **kwargs)[source]

Bases: Material

Implements the tait equation of state.

get_energy(p: Array, rho: Array) Array[source]

Computes specific internal energy e = e(p, rho)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Specific internal energy buffer

Return type:

jnp.ndarray

get_grueneisen(rho: Array) Array[source]

Computes the Grueneisen coefficient from density. Gamma = p_e / rho; p_e is partial derivative of pressure wrt internal specific energy.

Parameters:

rho (jnp.ndarray) – Density buffer

Returns:

Grueneisen

Return type:

jnp.ndarray

get_pressure(e: Array, rho: Array) Array[source]

Computes pressure from internal energy and density. p = p(e, rho)

Parameters:
  • e (jnp.ndarray) – Specific internal energy buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Pressue buffer

Return type:

jnp.ndarray

get_psi(p: Array, rho: Array) Array[source]

Computes psi from pressure and density. psi = p_rho; p_rho is partial derivative of pressure wrt density.

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Psi

Return type:

jnp.ndarray

get_speed_of_sound(p: Array, rho: Array) Array[source]

Computes speed of sound from pressure and density. c = c(p, rho)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Speed of sound buffer

Return type:

jnp.ndarray

get_temperature(p: Array, rho: Array) Array[source]

Computes temperature from pressure and density. T = T(p, rho)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

Returns:

Temperature buffer

Return type:

jnp.ndarray

get_total_energy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

Computes total energy per unit volume from pressure, density, and velocities. E = E(p, rho, velX, velY, velZ)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

  • u (jnp.ndarray) – Velocity in x direction

  • v (jnp.ndarray) – Velocity in y direction

  • w (jnp.ndarray) – Velocity in z direction

Returns:

Total energy per unit volume

Return type:

jnp.ndarray

get_total_enthalpy(p: Array, rho: Array, u: Array, v: Array, w: Array) Array[source]

Computes total specific enthalpy from pressure, density, and velocities. H = H(p, rho, velX, velY, velZ)

Parameters:
  • p (jnp.ndarray) – Pressure buffer

  • rho (jnp.ndarray) – Density buffer

  • u (jnp.ndarray) – Velocity in x direction

  • v (jnp.ndarray) – Velocity in y direction

  • w (jnp.ndarray) – Velocity in z direction

Returns:

Total specific enthalpy buffer

Return type:

jnp.ndarray

Module contents