jaxfluids.solvers package

Subpackages

Submodules

jaxfluids.solvers.flux_splitting_scheme module

class jaxfluids.solvers.flux_splitting_scheme.FluxSplittingScheme(material_manager: MaterialManager, domain_information: DomainInformation, flux_splitting: str, reconstruction_stencil: SpatialReconstruction)[source]

Bases: object

Base class for the Flux-Splitting Scheme. The flux-splitting schemes transforms conservative variables and physical fluxes into the characteristic space, performs a flux-splitting in characteristic space, and transforms the final flux back to physical space.

The eigenvalues - which are used according to the user-specified flux-splitting - determine the numerical flux.

Details are given in Bezgin, Buhendwa, Adams - 2022 - JAX-FLUIDS.

compute_fluxes_xi(primes: Array, cons: Array, axis: int, **kwargs) Array[source]

Computes the numerical flux in axis direction.

Parameters:
  • primes (jnp.ndarray) – Buffer of primitive variables

  • cons (jnp.ndarray) – Buffer of primitive variables

  • axis (int) – Spatial direction along which flux is calculated.

Returns:

Numerical flux in axis direction.

Return type:

jnp.ndarray

jaxfluids.solvers.high_order_godunov module

class jaxfluids.solvers.high_order_godunov.HighOrderGodunov(material_manager: MaterialManager, domain_information: DomainInformation, riemann_solver: RiemannSolver, reconstruction_stencil: SpatialReconstruction, reconstruction_var: str, is_safe_reconstruction: str)[source]

Bases: object

The HighOrderGodunov class implements the flux calculation according to the high-order Godunov approach in the finite volume framework.

The calculation of the fluxes consists of three steps: 1) RECONSTRUCT STATE ON CELL FACE 2) CONVERT PRIMITIVES TO CONSERVATIVES AND VICE VERSA 3) SOLVE RIEMANN PROBLEM

The reconstruction step can be done on primitive or conservative variables in either physical or characteristic space. The safe reconstruction guards against reconstruction of inadmissible states (e.g., negative pressure or density) by resorting to first-order upwind reconstruction in problematic cells.

compute_fluxes_xi(primes: Array, cons: Array, axis: int, ml_parameters_dict: Dict | None = None, ml_networks_dict: Dict | None = None) Array[source]

Computes the numerical flux in a specified spatial direction.

Parameters:
  • primes (jnp.ndarray) – Buffer of primitive variables.

  • cons (jnp.ndarray) – Buffer of conservative variables.

  • axis (int) – Spatial direction along which flux is calculated.

Returns:

Numerical flux in axis direction.

Return type:

jnp.ndarray

jaxfluids.solvers.source_term_solver module

class jaxfluids.solvers.source_term_solver.SourceTermSolver(material_manager: MaterialManager, gravity: Array, domain_information: DomainInformation, derivative_stencil_center: SpatialDerivative, derivative_stencil_face: SpatialDerivative, reconstruct_stencil_duidxi: SpatialReconstruction, reconstruct_stencil_ui: SpatialReconstruction, levelset_type: str)[source]

Bases: object

The SourceTermSolver class manages source term contributions on the right-hand-side of NSE. Contributions have to be activated in the active_physics section in the numerical setup file.

This includes amongst others: 1) Gravitational force 2) Heat flux 3) Viscous flux

compute_gravity_forces(cons: Array) Array[source]

Computes flux due to gravitational force.

Parameters:

cons (jnp.ndarray) – Buffer of conservative variables.

Returns:

Buffer with gravitational forces.

Return type:

jnp.ndarray

compute_heat_flux_xi(temperature: Array, axis: int) Array[source]

Computes the heat flux in axis direction.

Parameters:
  • temperature (jnp.ndarray) – Buffer with temperature.

  • axis (int) – Spatial direction along which the heat flux is calculated.

Returns:

Heat flux in axis direction.

Return type:

jnp.ndarray

compute_tau(vel_grad: Array, dynamic_viscosity: Array, bulk_viscosity: Array, axis: int) Array[source]

Computes the stress tensor at a cell face in axis direction. tau_axis = [tau_axis0, tau_axis1, tau_axis2]

Parameters:
  • vel_grad (jnp.ndarray) – Buffer of velocity gradient. Shape is 3 x 3 (x 2) x Nx x Ny x Nz

  • dynamic_viscosity (jnp.ndarray) – Buffer of dynamic viscosity.

  • bulk_viscosity (jnp.ndarray) – Buffer of bulk viscosity.

  • axis (int) – Cell face direction at which viscous stresses are calculated.

Returns:

Buffer of viscous stresses.

Return type:

jnp.ndarray

compute_viscous_flux_xi(vels: Array, temperature: Array, axis: int) Array[source]

Computes viscous flux in one spatial direction

vel_grad = [

du/dx du/dy du/dz dv/dx dv/dy dv/dz dw/dx dw/dy dw/dz

]

Parameters:
  • vels (jnp.ndarray) – Buffer of velocities.

  • temperature (jnp.ndarray) – Buffer of temperature.

  • axis (int) – Axis along which the viscous flux is computed.

Returns:

Viscous flux along axis direction.

Return type:

jnp.ndarray

compute_xi_derivatives_at_xj(prime: Array, axis_i: int, axis_j: int) Array[source]

Computes the spatial derivative in axis_i direction at the cell face in axis_j direction.

Parameters:
  • prime (jnp.ndarray) – Buffer of primitive variables.

  • axis_i (int) – Spatiald direction wrt which the derivative is taken.

  • axis_j (int) – Spatial direction along which derivative is evaluated.

Returns:

Derivative wrt axis_i direction at cell face in axis_j direction.

Return type:

jnp.ndarray

Module contents