Skip to content

Commit 8227e20

Browse files
author
LasNikas
committed
fix interpolation
1 parent cfe7f0f commit 8227e20

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/callbacks/particle_shifting.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ function particle_shifting!(u, v, system::FluidSystem, v_ode, u_ode, semi,
7979
Wdx = smoothing_kernel(system, particle_spacing(system, 1), 1)
8080
h = smoothing_length(system, 1)
8181

82-
k_factor(::WendlandC2Kernel) = 2
83-
k_factor(kernel) = 4
84-
8582
foreach_system(semi) do neighbor_system
8683
u_neighbor = wrap_u(u_ode, neighbor_system, semi)
8784
v_neighbor = wrap_v(v_ode, neighbor_system, semi)
@@ -106,8 +103,8 @@ function particle_shifting!(u, v, system::FluidSystem, v_ode, u_ode, semi,
106103

107104
# Eq. 7 in Sun et al. (2017).
108105
# CFL * Ma can be rewritten as Δt * v_max / h (see p. 29, right above Eq. 9).
109-
delta_r_ = -dt * v_max * k_factor(system_smoothing_kernel(system)) * h *
110-
(1 + R * (kernel / Wdx)^n) * m_b / (rho_a + rho_b) * grad_kernel
106+
delta_r_ = -dt * v_max * 4 * h * (1 + R * (kernel / Wdx)^n) *
107+
m_b / (rho_a + rho_b) * grad_kernel
111108

112109
# Write into the buffer
113110
for i in eachindex(delta_r_)

validation/vortex_street_2d/validation_vortex_street_2d.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ using FFTW
33
using CSV, DataFrames
44
using Test
55

6-
# Results in [90k particles, 220k particles, 1.2M particles, 5M particles]
6+
# Results in [90k particles, 340k particles, 1.2M particles, 5M particles]
77
# In the Tafuni et al. (2018), the resolution is `0.01` (5M particles).
8-
resolution_factor = 0.08 # [0.08, 0.05, 0.02, 0.01]
8+
resolution_factor = 0.08 # [0.08, 0.04, 0.02, 0.01]
99

1010
# ======================================================================================
1111
# ==== Run the simulation
1212
trixi_include(joinpath(validation_dir(), "vortex_street_2d", "vortex_street_2d.jl"),
1313
parallelization_backend=PolyesterBackend(),
14-
factor_d=resolution_factor, saving_callback=nothing, tspan=(0.0, 20.0))
14+
sound_speed=10.0, reynolds_number=200, saving_callback=nothing,
15+
smoothing_kernel=SchoenbergQuinticSplineKernel{2}(), h_factor=1.2,
16+
factor_d=resolution_factor, tspan=(0.0, 20.0))
1517

1618
# ======================================================================================
1719
# ==== Read results and compute the Strouhal number

validation/vortex_street_2d/vortex_street_2d.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ circle = SphereShape(particle_spacing, (cylinder_diameter + particle_spacing) /
142142
sphere_type=RoundSphere())
143143

144144
# Points for pressure interpolation, located at the wall interface
145-
const data_points = copy(circle.coordinates)
145+
const data_points = copy(circle.coordinates)
146146
const center = SVector(cylinder_center)
147147

148148
calculate_lift_force(system, v_ode, u_ode, semi, t) = nothing
@@ -185,8 +185,8 @@ end
185185

186186
# ==========================================================================================
187187
# ==== Simulation
188-
min_corner = minimum(pipe.boundary.coordinates .- particle_spacing, dims=2)
189-
max_corner = maximum(pipe.boundary.coordinates .+ particle_spacing, dims=2)
188+
min_corner = minimum(pipe.boundary.coordinates .- 5 * particle_spacing, dims=2)
189+
max_corner = maximum(pipe.boundary.coordinates .+ 5 * particle_spacing, dims=2)
190190
cell_list = FullGridCellList(; min_corner, max_corner)
191191

192192
neighborhood_search = GridNeighborhoodSearch{2}(; cell_list,
@@ -203,7 +203,8 @@ info_callback = InfoCallback(interval=100)
203203

204204
output_directory = joinpath(validation_dir(), "vortex_street_2d",
205205
"out_vortex_street_dp_$(factor_d)D_c_$(sound_speed)_h_factor_$(h_factor)_" *
206-
TrixiParticles.type2string(smoothing_kernel))
206+
TrixiParticles.type2string(smoothing_kernel) *
207+
"_Re_$reynolds_number")
207208

208209
saving_callback = SolutionSavingCallback(; dt=0.02, prefix="", output_directory)
209210

0 commit comments

Comments
 (0)