Skip to content

Commit

Permalink
solver clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasErbesdobler committed Jun 9, 2024
1 parent 547febb commit 96e88e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cases/db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ case:
viscosity: 0.00005
special:
L_wall: 5.366
H_wall: 2.0
H_wall: 5.366 #2.0
L: 2.0 # water column length
H: 1.0 # water column height
W: 0.2 # width in 3D case
Expand Down
16 changes: 4 additions & 12 deletions jax_sph/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,9 @@ def rho_evol_riemann_fn(
rho_L = rho_i

# u_w from eq. (15), Yang (2020)
# u_d = 2 * u_i - u_j
u_d = 2 * u_i - u_tilde_j
u_R = jnp.where(
wall_mask_j == 1,
# -u_L + 2 * jnp.dot(u_j, n_w_j),
jnp.dot(u_d, -n_w_j),
-u_L + 2 * jnp.dot(u_j, -n_w_j),
jnp.dot(u_j, -e_ij),
)
p_R = jnp.where(wall_mask_j == 1, p_L + rho_L * jnp.dot(g_ext_i, -r_ij), p_j)
Expand Down Expand Up @@ -215,13 +212,10 @@ def acceleration_fn_riemann(
p_L = p_i
rho_L = rho_i

# u_w from eq. (15), Yang (2020)
# u_d = 2 * u_i - u_j
u_d = 2 * u_i - u_tilde_j
# u_w from eq. (15), Yang (2020)
u_R = jnp.where(
wall_mask_j == 1,
# -u_L + 2 * jnp.dot(u_j, n_w_j),
jnp.dot(u_d, -n_w_j),
-u_L + 2 * jnp.dot(u_j, -n_w_j),
jnp.dot(u_j, -e_ij),
)
p_R = jnp.where(wall_mask_j == 1, p_L + rho_L * jnp.dot(g_ext_i, -r_ij), p_j)
Expand All @@ -244,7 +238,6 @@ def acceleration_fn_riemann(
eq_9 = -2 * m_j * (P_star / (rho_i * rho_j)) * kernel_grad

# viscosity term eq. (6), Zhang (2019)
# TODO: u_j is supposed to be u_i, but why is it not working?
u_d = 2 * u_j - u_tilde_j
v_ij = jnp.where(
wall_mask_j == 1,
Expand Down Expand Up @@ -404,8 +397,7 @@ def free_weight(fluid_mask_i, tag_i):
return fluid_mask_i

def Riemann_velocities(u, w_dist, fluid_mask, i_s, j_s, N):
u_tilde = jnp.empty_like(u)
return u_tilde
return u
else:

def free_weight(fluid_mask_i, tag_i):
Expand Down

0 comments on commit 96e88e4

Please sign in to comment.