Skip to content

Make PST work for different smoothing length factors #834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/callbacks/particle_shifting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ function particle_shifting!(u, v, system::FluidSystem, v_ode, u_ode, semi,

# TODO this needs to be adapted to multi-resolution.
# Section 3.2 explains what else needs to be changed.
Wdx = smoothing_kernel(system, particle_spacing(system, 1), 1)
dx = particle_spacing(system, 1)
Wdx = smoothing_kernel(system, dx, 1)
h = smoothing_length(system, 1)

foreach_system(semi) do neighbor_system
Expand All @@ -96,8 +97,16 @@ function particle_shifting!(u, v, system::FluidSystem, v_ode, u_ode, semi,
n = 4

# Eq. 7 in Sun et al. (2017).
# CFL * Ma can be rewritten as Δt * v_max / h (see p. 29, right above Eq. 9).
delta_r_ = -dt * v_max * 4 * h * (1 + R * (kernel / Wdx)^n) *
# According to the paper, CFL * Ma can be rewritten as Δt * v_max / h
# (see p. 29, right above Eq. 9), but this does not work when scaling h.
# When setting CFL * Ma = Δt * v_max / (2 * Δx), PST works as expected
# for both small and large smoothing length factors.
# We need to scale
# - quadratically with the smoothing length,
# - linearly with the particle spacing,
# - linearly with the time step.
# See https://github.com/trixi-framework/TrixiParticles.jl/pull/834.
delta_r_ = -dt * v_max * (2 * h)^2 / (2 * dx) * (1 + R * (kernel / Wdx)^n) *
m_b / (rho_a + rho_b) * grad_kernel

# Write into the buffer
Expand Down
Loading