@@ -10,7 +10,7 @@ to retrieve first order kernel and particle consistency.
1010"""
1111struct FirstOrderMirroring{ELTYPE}
1212 firstorder_tolerance:: ELTYPE
13- function FirstOrderMirroring (; firstorder_tolerance:: ELTYPE = 1e-3 ) where {ELTYPE}
13+ function FirstOrderMirroring (; firstorder_tolerance:: Real = 1 / 1000.0f0 )
1414 return new {typeof(firstorder_tolerance)} (firstorder_tolerance)
1515 end
1616end
@@ -27,7 +27,7 @@ the corrected gradient as proposed by [Negi et al. (2022)](@cite Negi2022).
2727"""
2828struct SimpleMirroring{ELTYPE}
2929 firstorder_tolerance:: ELTYPE
30- function SimpleMirroring (; firstorder_tolerance:: Real = 1e-3 )
30+ function SimpleMirroring (; firstorder_tolerance:: Real = 1 / 1000.0f0 )
3131 return new {typeof(firstorder_tolerance)} (firstorder_tolerance)
3232 end
3333end
@@ -62,14 +62,16 @@ struct BoundaryModelTafuni{MM}
6262end
6363
6464function BoundaryModelTafuni (;
65- mirror_method= FirstOrderMirroring (; firstorder_tolerance= 1e-3 ))
65+ mirror_method= FirstOrderMirroring (;
66+ firstorder_tolerance= 1 /
67+ 1000.0f0 ))
6668 return BoundaryModelTafuni (mirror_method)
6769end
6870
6971function update_boundary_quantities! (system, boundary_model:: BoundaryModelTafuni ,
7072 v, u, v_ode, u_ode, semi, t)
7173 (; reference_pressure, reference_density, reference_velocity, boundary_zone,
72- cache) = system
74+ pressure, density, cache) = system
7375 (; prescribed_pressure, prescribed_density, prescribed_velocity) = cache
7476
7577 @trixi_timeit timer () " extrapolate and correct values" begin
@@ -205,21 +207,22 @@ function extrapolate_values!(system,
205207 # pressure
206208 if ! (prescribed_pressure)
207209 first_order_scalar_interpolation! (pressure, particle, L_inv,
208- interpolated_pressure_correction,
210+ interpolated_pressure_correction[] ,
209211 two_to_end, pos_diff, mirror_method)
210212 end
211213
212214 # density
213215 if ! (prescribed_density)
214216 first_order_scalar_interpolation! (density, particle, L_inv,
215- interpolated_density_correction,
217+ interpolated_density_correction[] ,
216218 two_to_end, pos_diff, mirror_method)
217219 end
218220
219221 # velocity
220222 if ! (prescribed_velocity)
221223 first_order_velocity_interpolation! (v_open_boundary, system, particle,
222- L_inv, interpolated_velocity_correction,
224+ L_inv,
225+ interpolated_velocity_correction[],
223226 two_to_end, pos_diff, mirror_method)
224227
225228 # Project the velocity on the normal direction of the boundary zone (only for inflow boundaries).
@@ -381,9 +384,9 @@ function zeroth_order_velocity_interpolation!(v, system, particle, shepard_coeff
381384end
382385
383386function first_order_scalar_interpolation! (values, particle, L_inv,
384- extrapolated_values_correction ,
387+ interpolated_values_correction ,
385388 two_to_end, pos_diff, :: FirstOrderMirroring )
386- f_s = L_inv * extrapolated_values_correction[]
389+ f_s = L_inv * interpolated_values_correction
387390 df_p = f_s[two_to_end] # f_s[2:end] as SVector
388391
389392 values[particle] = f_s[1 ] + dot (pos_diff, df_p)
@@ -392,9 +395,9 @@ function first_order_scalar_interpolation!(values, particle, L_inv,
392395end
393396
394397function first_order_scalar_interpolation! (values, particle, L_inv,
395- extrapolated_values_correction ,
398+ interpolated_values_correction ,
396399 two_to_end, pos_diff, :: SimpleMirroring )
397- f_s = L_inv * extrapolated_values_correction[]
400+ f_s = L_inv * interpolated_values_correction
398401
399402 values[particle] = f_s[1 ]
400403
@@ -405,7 +408,7 @@ function first_order_velocity_interpolation!(v, system, particle, L_inv,
405408 interpolated_velocity_correction,
406409 two_to_end, pos_diff, :: FirstOrderMirroring )
407410 @inbounds for dim in eachindex (pos_diff)
408- f_v = L_inv * interpolated_velocity_correction[][ dim, :]
411+ f_v = L_inv * interpolated_velocity_correction[dim, :]
409412 df_v = f_v[two_to_end] # f_v[2:end] as SVector
410413
411414 v[dim, particle] = f_v[1 ] + dot (pos_diff, df_v)
@@ -418,7 +421,7 @@ function first_order_velocity_interpolation!(v, system, particle, L_inv,
418421 interpolated_velocity_correction,
419422 two_to_end, pos_diff, :: SimpleMirroring )
420423 @inbounds for dim in eachindex (pos_diff)
421- f_v = L_inv * interpolated_velocity_correction[][ dim, :]
424+ f_v = L_inv * interpolated_velocity_correction[dim, :]
422425
423426 v[dim, particle] = f_v[1 ]
424427 end
@@ -496,11 +499,9 @@ function average_velocity!(v, u, system, boundary_zone::BoundaryZone{InFlow}, se
496499 active_coordinates (u, system)))
497500
498501 avg_velocity = sum (candidates) do particle
499- return current_velocity (v, system, particle)
502+ return current_velocity (v, system, particle) / length (candidates)
500503 end
501504
502- avg_velocity /= length (candidates)
503-
504505 @threaded semi for particle in each_moving_particle (system)
505506 # Set the velocity of the ghost node to the average velocity of the fluid domain
506507 @inbounds for dim in eachindex (avg_velocity)
0 commit comments