jaxfluids.solvers.riemann_solvers package
Submodules
jaxfluids.solvers.riemann_solvers.AUSMP module
- class jaxfluids.solvers.riemann_solvers.AUSMP.AUSMP(material_manager: MaterialManager, signal_speed: Callable)[source]
Bases:
RiemannSolverAUSM+ Scheme - M Liou - 1996 Advetion-Upstream Method Plus according to Liou.
- get_phi(primes: Array, cons: Array) Array[source]
Computes the phi vector from primitive and conservative variables in which energy is replaced by enthalpy. phi = [rho, rho * velX, rho * velY, rho * velZ, H]
- Parameters:
primes (jnp.ndarray) – Buffer of primitive variables.
cons (jnp.ndarray) – Buffer of conservative variables.
- Returns:
Buffer of phi variable.
- Return type:
jnp.ndarray
- solve_riemann_problem_xi(primes_L: Array, primes_R: Array, cons_L: Array, cons_R: Array, axis: int, **kwargs) Array[source]
Solves one-dimensional Riemann problem in the direction as specified by the axis argument.
- Parameters:
primes_L (jnp.ndarray) – primtive variable buffer left of cell face
primes_R (jnp.ndarray) – primtive variable buffer right of cell face
cons_L (jnp.ndarray) – conservative variable buffer left of cell face
cons_R (jnp.ndarray) – conservative variable buffer right of cell face
axis (int) – Spatial direction along which Riemann problem is solved.
- Returns:
buffer of fluxes in xi direction
- Return type:
jnp.ndarray
jaxfluids.solvers.riemann_solvers.HLL module
- class jaxfluids.solvers.riemann_solvers.HLL.HLL(material_manager: MaterialManager, signal_speed: Callable)[source]
Bases:
RiemannSolverHLL Riemann Solver by Harten, Lax and van Leer Harten et al. 1983
- solve_riemann_problem_xi(primes_L: Array, primes_R: Array, cons_L: Array, cons_R: Array, axis: int, **kwargs) Array[source]
Solves one-dimensional Riemann problem in the direction as specified by the axis argument.
- Parameters:
primes_L (jnp.ndarray) – primtive variable buffer left of cell face
primes_R (jnp.ndarray) – primtive variable buffer right of cell face
cons_L (jnp.ndarray) – conservative variable buffer left of cell face
cons_R (jnp.ndarray) – conservative variable buffer right of cell face
axis (int) – Spatial direction along which Riemann problem is solved.
- Returns:
buffer of fluxes in xi direction
- Return type:
jnp.ndarray
jaxfluids.solvers.riemann_solvers.HLLC module
- class jaxfluids.solvers.riemann_solvers.HLLC.HLLC(material_manager: MaterialManager, signal_speed: Callable)[source]
Bases:
RiemannSolverHLLC Riemann Solver Toro et al. 1994
- solve_riemann_problem_xi(primes_L: Array, primes_R: Array, cons_L: Array, cons_R: Array, axis: int, **kwargs) Array[source]
Solves one-dimensional Riemann problem in the direction as specified by the axis argument.
- Parameters:
primes_L (jnp.ndarray) – primtive variable buffer left of cell face
primes_R (jnp.ndarray) – primtive variable buffer right of cell face
cons_L (jnp.ndarray) – conservative variable buffer left of cell face
cons_R (jnp.ndarray) – conservative variable buffer right of cell face
axis (int) – Spatial direction along which Riemann problem is solved.
- Returns:
buffer of fluxes in xi direction
- Return type:
jnp.ndarray
jaxfluids.solvers.riemann_solvers.HLLCLM module
- class jaxfluids.solvers.riemann_solvers.HLLCLM.HLLCLM(material_manager: MaterialManager, signal_speed: Callable)[source]
Bases:
RiemannSolverHLLCLM Riemann Solver Fleischmann et al. 2020
- solve_riemann_problem_xi(cell_state_L: Array, cell_state_R: Array, conservative_L: Array, conservative_R: Array, axis: int, **kwargs) Array[source]
Solves one-dimensional Riemann problem in the direction as specified by the axis argument.
- Parameters:
primes_L (jnp.ndarray) – primtive variable buffer left of cell face
primes_R (jnp.ndarray) – primtive variable buffer right of cell face
cons_L (jnp.ndarray) – conservative variable buffer left of cell face
cons_R (jnp.ndarray) – conservative variable buffer right of cell face
axis (int) – Spatial direction along which Riemann problem is solved.
- Returns:
buffer of fluxes in xi direction
- Return type:
jnp.ndarray
jaxfluids.solvers.riemann_solvers.LaxFriedrichs module
- class jaxfluids.solvers.riemann_solvers.LaxFriedrichs.LaxFriedrichs(material_manager: MaterialManager, signal_speed)[source]
Bases:
RiemannSolver- solve_riemann_problem_xi(primes_L: Array, primes_R: Array, cons_L: Array, cons_R: Array, axis: int, **kwargs) Array[source]
Solves one-dimensional Riemann problem in the direction as specified by the axis argument.
- Parameters:
primes_L (jnp.ndarray) – primtive variable buffer left of cell face
primes_R (jnp.ndarray) – primtive variable buffer right of cell face
cons_L (jnp.ndarray) – conservative variable buffer left of cell face
cons_R (jnp.ndarray) – conservative variable buffer right of cell face
axis (int) – Spatial direction along which Riemann problem is solved.
- Returns:
buffer of fluxes in xi direction
- Return type:
jnp.ndarray
jaxfluids.solvers.riemann_solvers.RiemannNN module
- class jaxfluids.solvers.riemann_solvers.RiemannNN.RiemannNN(material_manager: MaterialManager, signal_speed: Callable)[source]
Bases:
RiemannSolver- solve_riemann_problem_xi(primes_L: Array, primes_R: Array, cons_L: Array, cons_R: Array, axis: int, ml_params_dict: Dict, ml_networks_dict: Dict, **kwargs) Array[source]
Solves one-dimensional Riemann problem in the direction as specified by the axis argument.
- Parameters:
primes_L (jnp.ndarray) – primtive variable buffer left of cell face
primes_R (jnp.ndarray) – primtive variable buffer right of cell face
cons_L (jnp.ndarray) – conservative variable buffer left of cell face
cons_R (jnp.ndarray) – conservative variable buffer right of cell face
axis (int) – Spatial direction along which Riemann problem is solved.
- Returns:
buffer of fluxes in xi direction
- Return type:
jnp.ndarray
jaxfluids.solvers.riemann_solvers.Rusanov module
- class jaxfluids.solvers.riemann_solvers.Rusanov.Rusanov(material_manager: MaterialManager, signal_speed: Callable)[source]
Bases:
RiemannSolverRusanov (Local Lax-Friedrichs) Riemann Solver
- solve_riemann_problem_xi(primes_L: Array, primes_R: Array, cons_L: Array, cons_R: Array, axis: int, **kwargs) Array[source]
Solves one-dimensional Riemann problem in the direction as specified by the axis argument.
- Parameters:
primes_L (jnp.ndarray) – primtive variable buffer left of cell face
primes_R (jnp.ndarray) – primtive variable buffer right of cell face
cons_L (jnp.ndarray) – conservative variable buffer left of cell face
cons_R (jnp.ndarray) – conservative variable buffer right of cell face
axis (int) – Spatial direction along which Riemann problem is solved.
- Returns:
buffer of fluxes in xi direction
- Return type:
jnp.ndarray
jaxfluids.solvers.riemann_solvers.RusanovNN module
- class jaxfluids.solvers.riemann_solvers.RusanovNN.RusanovNN(material_manager: MaterialManager, signal_speed: Callable)[source]
Bases:
RiemannSolverRusanovNN Riemann Solver which is optimied in the JAX-FLUIDS paper. The dissipation is calculated by a neural network. See details in Bezgin et al. 2022.
- solve_riemann_problem_xi(primes_L: Array, primes_R: Array, cons_L: Array, cons_R: Array, axis: int, ml_parameters_dict: Dict, ml_networks_dict: Dict, **kwargs) Array[source]
Solves one-dimensional Riemann problem in the direction as specified by the axis argument.
- Parameters:
primes_L (jnp.ndarray) – primtive variable buffer left of cell face
primes_R (jnp.ndarray) – primtive variable buffer right of cell face
cons_L (jnp.ndarray) – conservative variable buffer left of cell face
cons_R (jnp.ndarray) – conservative variable buffer right of cell face
axis (int) – Spatial direction along which Riemann problem is solved.
- Returns:
buffer of fluxes in xi direction
- Return type:
jnp.ndarray
jaxfluids.solvers.riemann_solvers.eigendecomposition module
- class jaxfluids.solvers.riemann_solvers.eigendecomposition.Eigendecomposition(material_manager: MaterialManager, stencil_size: int, domain_information: DomainInformation, flux_splitting: str | None = None)[source]
Bases:
objectThe Eigendecomposition class implements functionality for eigendecomposition of the Jacobian matrix. Eigendecomposition can be done based on primitive or conservative variables. The frozen state can be calculated from arithmetic or Roe averages.
eigendecomp_prim only returns left and right eigenvectors, while eigendecomp_cons additionally returns eigenvalues according to a user-specified flux-splitting.
- compute_roe_cons(prime_L: Array, prime_R: Array) Array[source]
Computes the Roe averaged conservative state.
- Parameters:
prime_L (jnp.ndarray) – Buffer of primitive variables left of a cell face.
prime_R (jnp.ndarray) – Buffer of primitive variables right of a cell face.
- Returns:
Buffer of Roe averaged quantities at the cell face.
- Return type:
jnp.ndarray
- eigendecomp_cons(primes: Array, axis: int) Tuple[Array, Array] | Tuple[Array, Array, Array][source]
Computes eigendecomposition of the Jacobian matrix for conservative variables. Formulation for a general equation of state. Implementation according to Fedkiv et al.
- Parameters:
primes (jnp.ndarray) – Buffer of primitive variables.
axis (int) – Direction of the cell face at which the eigendecomposition is to be performed.
- Returns:
Buffer of left, right eigenvectors and the eigenvalues.
- Return type:
Union[Tuple[jnp.ndarray, jnp.ndarray], Tuple[jnp.ndarray, jnp.ndarray, jnp.ndarray]]
- eigendecomp_prim(primes: Array, axis: int) Tuple[Array, Array][source]
Computes the eigendecomposition of the Jacobian matrix wrt primitive variables.
- Parameters:
primes (jnp.ndarray) – Buffer of primitive variables.
axis (int) – Direction of the cell face at which the eigendecomposition is to be performed.
- Returns:
Buffer of left and right eigenvectors.
- Return type:
Tuple[jnp.ndarray, jnp.ndarray]
- eps = 2.220446049250313e-16
- transformtochar(stencil: Array, left_eig: Array, axis: int) Array[source]
Transforms the stencil from physical to characteristic space.
- Parameters:
stencil (jnp.ndarray) – Buffer with variables in physical space.
left_eig (jnp.ndarray) – Buffer of left eigenvalues.
axis (int) – Spatial direction along which transformation has to be performed.
- Returns:
Buffer with variables in characteristic space.
- Return type:
jnp.ndarray
- transformtophysical(stencil: Array, right_eig: Array) Array[source]
Transforms the stencil from characteristic to physical space.
- Parameters:
stencil (jnp.ndarray) – Buffer with variables in characteristic space.
right_eig (jnp.ndarray) – Buffer of right eigenvalues.
- Returns:
Buffer with variables in physical space.
- Return type:
jnp.ndarray
jaxfluids.solvers.riemann_solvers.riemann_solver module
- class jaxfluids.solvers.riemann_solvers.riemann_solver.RiemannSolver(material_manager: MaterialManager, signal_speed: Callable)[source]
Bases:
ABCAbstract base class for Riemann solvers.
RiemannSolver has two fundamental attributes: a material manager and a signal speed. The solve_riemann_problem_xi method solves the one-dimensional Riemann problem.
- eps = 2.220446049250313e-16
- abstract solve_riemann_problem_xi(primes_L: Array, primes_R: Array, cons_L: Array, cons_R: Array, axis: int, **kwargs) Array[source]
Solves one-dimensional Riemann problem in the direction as specified by the axis argument.
- Parameters:
primes_L (jnp.ndarray) – primtive variable buffer left of cell face
primes_R (jnp.ndarray) – primtive variable buffer right of cell face
cons_L (jnp.ndarray) – conservative variable buffer left of cell face
cons_R (jnp.ndarray) – conservative variable buffer right of cell face
axis (int) – Spatial direction along which Riemann problem is solved.
- Returns:
buffer of fluxes in xi direction
- Return type:
jnp.ndarray
jaxfluids.solvers.riemann_solvers.signal_speeds module
- jaxfluids.solvers.riemann_solvers.signal_speeds.compute_sstar(u_L: Array, u_R: Array, p_L: Array, p_R: Array, rho_L: Array, rho_R: Array, S_L: Array, S_R: Array) Array[source]
Computes the speed of the intermediate wave in a Riemann problem.
See Toro Eq. (10.70)
- Parameters:
u_L (jnp.ndarray) – Buffer with normal velocity in left neighboring cell.
u_R (jnp.ndarray) – Buffer with normal velocity in right neighboring cell.
p_L (jnp.ndarray) – Pressure of left neighboring cell.
p_R (jnp.ndarray) – Pressure of right neighboring cells.
rho_L (jnp.ndarray) – Density of left neighboring cell.
rho_R (jnp.ndarray) – Density of right neighboring cell.
S_L (jnp.ndarray) – Wave speed estimate left-going wave.
S_R (jnp.ndarray) – Wave speed estimate right-going wave.
- Returns:
Speed of the intermediate wave in the Riemann problem.
- Return type:
jnp.ndarray
- jaxfluids.solvers.riemann_solvers.signal_speeds.estimate_pressure(u_L: Array, u_R: Array, a_L: Array, a_R: Array, rho_L: Array, rho_R: Array, p_L: Array, p_R: Array) Array[source]
Estimates the pressure in the star region based on a linearised solution in terms of primitive variables.
See Toro Eq. (9.28) or (10.67)
- Parameters:
u_L (jnp.ndarray) – Buffer with normal velocity in left neighboring cell.
u_R (jnp.ndarray) – Buffer with normal velocity in right neighboring cell.
a_L (jnp.ndarray) – Buffer with speed of sound in left neighboring cell.
a_R (jnp.ndarray) – Buffer with speed of sound in right neighboring cell.
rho_L (jnp.ndarray) – Densities of left neighboring cells.
rho_R (jnp.ndarray) – Densities of right neighboring cells.
p_L (jnp.ndarray) – Pressure of left neighboring cell.
p_R (jnp.ndarray) – Pressure of right neighboring cells.
- Returns:
Pressure in the star region.
- Return type:
jnp.ndarray
- jaxfluids.solvers.riemann_solvers.signal_speeds.signal_speed_Arithmetic(u_L: Array, u_R: Array, a_L: Array, a_R: Array, *args, **kwargs) Tuple[Array, Array][source]
Arithmetic signal speed estimate
- Parameters:
u_L (jnp.ndarray) – Buffer with normal velocity in left neighboring cell.
u_R (jnp.ndarray) – Buffer with normal velocity in right neighboring cell.
a_L (jnp.ndarray) – Buffer with speed of sound in left neighboring cell.
a_R (jnp.ndarray) – Buffer with speed of sound in right neighboring cell.
- Returns:
Buffers of left and right going wave speed estimates.
- Return type:
Tuple[jnp.ndarray, jnp.ndarray]
- jaxfluids.solvers.riemann_solvers.signal_speeds.signal_speed_Davis(u_L: Array, u_R: Array, a_L: Array, a_R: Array, *args, **kwargs) Tuple[Array, Array][source]
Davis signal speed estimate See Toro Eq. (10.48)
- Parameters:
u_L (jnp.ndarray) – Buffer with normal velocity in left neighboring cell.
u_R (jnp.ndarray) – Buffer with normal velocity in right neighboring cell.
a_L (jnp.ndarray) – Buffer with speed of sound in left neighboring cell.
a_R (jnp.ndarray) – Buffer with speed of sound in right neighboring cell.
- Returns:
Buffers of left and right going wave speed estimates.
- Return type:
Tuple[jnp.ndarray, jnp.ndarray]
- jaxfluids.solvers.riemann_solvers.signal_speeds.signal_speed_Davis_2(u_L: Array, u_R: Array, a_L: Array, a_R: Array, rho_L: Array, rho_R: Array, H_L: Array, H_R: Array, gamma: float, *args, **kwargs) Tuple[Array, Array][source]
Signal speed estimate according to Davis.
- Parameters:
u_L (jnp.ndarray) – Buffer with normal velocity in left neighboring cell.
u_R (jnp.ndarray) – Buffer with normal velocity in right neighboring cell.
a_L (jnp.ndarray) – Buffer with speed of sound in left neighboring cell.
a_R (jnp.ndarray) – Buffer with speed of sound in right neighboring cell.
rho_L (jnp.ndarray) – Buffer with densitites in left neighboring cell.
rho_R (jnp.ndarray) – Buffer with densitites in right neighboring cell.
H_L (jnp.ndarray) – Buffer with total enthalpies in left neighboring cell.
H_R (jnp.ndarray) – Buffer with enthalpies in right neighboring cell.
gamma (float) – Ratio of specific heats.
- Returns:
Buffers of left and right going wave speed estimates.
- Return type:
Tuple[jnp.ndarray, jnp.ndarray]
- jaxfluids.solvers.riemann_solvers.signal_speeds.signal_speed_Einfeldt(u_L: Array, u_R: Array, a_L: Array, a_R: Array, rho_L: Array, rho_R: Array, *args, **kwargs) Tuple[Array, Array][source]
Einfeldt signal speed estimate See Toro Eqs. (10.52) - (10.54)
- Parameters:
u_L (jnp.ndarray) – Buffer with normal velocity in left neighboring cell.
u_R (jnp.ndarray) – Buffer with normal velocity in right neighboring cell.
a_L (jnp.ndarray) – Buffer with speed of sound in left neighboring cell.
a_R (jnp.ndarray) – Buffer with speed of sound in right neighboring cell.
- Returns:
Buffers of left and right going wave speed estimates.
- Return type:
Tuple[jnp.ndarray, jnp.ndarray]
- jaxfluids.solvers.riemann_solvers.signal_speeds.signal_speed_Rusanov(u_L: Array, u_R: Array, a_L: Array, a_R: Array, *args, **kwargs) Tuple[Array, Array][source]
Rusanov type signal speed estimate
- Parameters:
u_L (jnp.ndarray) – Buffer with normal velocity in left neighboring cell.
u_R (jnp.ndarray) – Buffer with normal velocity in right neighboring cell.
a_L (jnp.ndarray) – Buffer with speed of sound in left neighboring cell.
a_R (jnp.ndarray) – Buffer with speed of sound in right neighboring cell.
- Returns:
Buffers of left and right going wave speed estimates.
- Return type:
Tuple[jnp.ndarray, jnp.ndarray]
- jaxfluids.solvers.riemann_solvers.signal_speeds.signal_speed_Toro(u_L: Array, u_R: Array, a_L: Array, a_R: Array, rho_L: Array, rho_R: Array, p_L: Array, p_R: Array, gamma: float, *args, **kwargs) Tuple[Array, Array][source]
Toro signal speed estimate See Toro Eqs. (10.59) - (10.60)
- Parameters:
u_L (jnp.ndarray) – Buffer with normal velocity in left neighboring cell.
u_R (jnp.ndarray) – Buffer with normal velocity in right neighboring cell.
a_L (jnp.ndarray) – Buffer with speed of sound in left neighboring cell.
a_R (jnp.ndarray) – Buffer with speed of sound in right neighboring cell.
- Return type:
Tuple[jnp.ndarray, jnp.ndarray]