Solver

SPH Solver

Weakly compressible SPH solver.

jax_sph.solver.rho_evol_fn(rho, mass, u, grad_w_dist, i_s, j_s, dt, N, **kwargs)[source]

Density evolution according to Adami et al. 2013.

jax_sph.solver.rho_evol_fn_delta_wrapper(delta, support, c_ref, kernel_fn)[source]

Density evolution according to Marrone et al. 2011.

jax_sph.solver.rho_evol_riemann_fn_wrapper(kernel_fn, eos, c_ref)[source]

Density evolution according to Zhang et al. 2017.

jax_sph.solver.rho_renorm_fn(rho, mass, i_s, j_s, w_dist, N)[source]

Renormalization of density according to Zhang et al. 2017.

jax_sph.solver.rho_summation_fn(mass, i_s, w_dist, N)[source]

Density summation.

jax_sph.solver.wall_phi_vec_wrapper(kernel_fn)[source]

Compute the wall phi vector according to Zhang et al. 2017.

jax_sph.solver.acceleration_tvf_fn_wrapper(kernel_fn)[source]

Transport velocity formulation acceleration according to Adami et al. 2013.

jax_sph.solver.tvf_stress_fn(rho: float, u, v)[source]

Transport velocity stress tensor. See ‘A’ under (Eq. 4) in Adami et al. 2013.

jax_sph.solver.acceleration_standard_fn_wrapper(kernel_fn)[source]

Standard SPH acceleration according to Adami et al. 2012.

jax_sph.solver.acceleration_delta_fn_wrapper(kernel_fn, alpha, support, c_ref, rho_ref)[source]

Standard SPH acceleration according to Adami et al. 2012., and Delta SPH relaxation according to Marrone et al. 2011.

jax_sph.solver.acceleration_riemann_fn_wrapper(kernel_fn, eos, beta_fn, eta_limiter)[source]

Riemann solver acceleration according to Zhang et al. 2017.

jax_sph.solver.artificial_viscosity_fn_wrapper(dx, artificial_alpha, u_ref=1.0)[source]

Artificial viscosity according to Adami et al. 2012.

jax_sph.solver.gwbc_fn_wrapper(is_free_slip, is_heat_conduction, eos)[source]

Enforce wall boundary conditions by treating boundary particles in a special way.

If solid walls -> apply BC tricks

Update dummy particles before acceleration computation (if appl.).

Steps for boundary particles:

  • sum pressure over fluid with sheparding

  • inverse EoS for density

  • sum velocity over fluid with sheparding and * (-1)

  • if free-slip: project velocity onto normal vector

  • subtract that from 2 * u_wall - keeps lid intact

Based on: “A generalized wall boundary condition for smoothed particle hydrodynamics”, Adami, Hu, Adams, 2012

jax_sph.solver.gwbc_fn_riemann_wrapper(is_free_slip, is_heat_conduction)[source]

Riemann solver boundary condition for wall particles.

jax_sph.solver.limiter_fn_wrapper(eta_limiter, c_ref)[source]

if eta_limiter != -1, introduce dissipation limiter eq. (11), Zhang (2017).

jax_sph.solver.temperature_derivative_wrapper(kernel_fn)[source]

Temperature derivative according to Cleary 1998.

class jax_sph.solver.WCSPH(displacement_fn: Callable, eos: TaitEoS | RIEMANNEoS, g_ext_fn: Callable, dx: float, dim: int, dt: float, c_ref: float, eta_limiter: float = 3, diff_delta: float = 0.02, diff_alpha: float = 0.1, solver: str = 'SPH', kernel: str = 'QSK', h_fac: float = 1.0, is_bc_trick: bool = False, is_rho_evol: bool = False, artificial_alpha: float = 0.0, is_free_slip: bool = False, is_rho_renorm: bool = False, is_heat_conduction: bool = False)[source]

Weakly compressible SPH solver with transport velocity formulation.

forward_wrapper()[source]

Wrapper of update step of SPH.

Equation of State

Equation of state.

class jax_sph.eos.BaseEoS[source]

Base class for SPH equation of state.

abstract p_fn(rho: float)[source]

Compute pressure from density.

abstract rho_fn(p: float)[source]

Compute density from pressure.

class jax_sph.eos.TaitEoS(p_ref, rho_ref, p_background, gamma)[source]

Tait equation of state.

From: “A generalized wall boundary condition for smoothed particle hydrodynamics”, Adami et al 2012

p_fn(rho)[source]

Compute pressure from density.

rho_fn(p)[source]

Compute density from pressure.

class jax_sph.eos.RIEMANNEoS(rho_ref, p_background, u_ref)[source]

Riemann SPH equation of state.

From: “A weakly compressible SPH method based on a low-dissipation Riemann solver”, Zhang, Hu, Adams, 2017

p_fn(rho)[source]

Compute pressure from density.

rho_fn(p)[source]

Compute density from pressure.

Kernels

SPH interpolation kernels.

class jax_sph.kernel.BaseKernel(h: float)[source]

Base class for SPH interpolation kernels.

abstract w(r)[source]

Evaluates the kernel at the radial distance r.

grad_w(r)[source]

Evaluates the 1D kernel gradient at the radial distance r.

class jax_sph.kernel.CubicKernel(h, dim=3)[source]

The cubic kernel function of Monaghan.

w(r)[source]

Evaluates the kernel at the radial distance r.

class jax_sph.kernel.QuinticKernel(h, dim=3)[source]

The quintic kernel function of Morris.

w(r)[source]

Evaluates the kernel at the radial distance r.

class jax_sph.kernel.WendlandC2Kernel(h, dim=3)[source]

The 5th-order C2 kernel function of Wendland.

w(r)[source]

Evaluates the kernel at the radial distance r.

class jax_sph.kernel.WendlandC4Kernel(h, dim=3)[source]

The 5th-order C4 kernel function of Wendland.

w(r)[source]

Evaluates the kernel at the radial distance r.

class jax_sph.kernel.WendlandC6Kernel(h, dim=3)[source]

The 5th-order C6 kernel function of Wendland.

w(r)[source]

Evaluates the kernel at the radial distance r.

class jax_sph.kernel.GaussianKernel(h, dim=3)[source]

The gaussian kernel function of Monaghan.

w(r)[source]

Evaluates the kernel at the radial distance r.

class jax_sph.kernel.SuperGaussianKernel(h, dim=3)[source]

The supergaussian kernel function of Monaghan.

w(r)[source]

Evaluates the kernel at the radial distance r.

Integrator

Integrator schemes.

jax_sph.integrator.si_euler(tvf: float, model: Callable, shift_fn: Callable, bc_fn: Callable, nw_fn: Callable)[source]

Semi-implicit Euler integrator including Transport Velocity.

The integrator advances the state of the system following the steps:

  1. Update u and v with dudt and dvdt

  2. Update position r with velocity v

  3. Update neighbor list

  4. Compute accelerations - SPH model call

  5. Impose boundary conditions as defined by the case.