|
| 1 | +using PointNeighbors |
| 2 | +using TrixiParticles |
| 3 | +using BenchmarkTools |
| 4 | + |
| 5 | +const TrivialNeighborhoodSearch = PointNeighbors.TrivialNeighborhoodSearch |
| 6 | +const GridNeighborhoodSearch = PointNeighbors.GridNeighborhoodSearch |
| 7 | + |
| 8 | +""" |
| 9 | + benchmark_wcsph(neighborhood_search, coordinates; parallel = true) |
| 10 | +
|
| 11 | +A benchmark of the right-hand side of a full real-life Weakly Compressible |
| 12 | +Smoothed Particle Hydrodynamics (WCSPH) simulation with TrixiParticles.jl. |
| 13 | +""" |
| 14 | +function benchmark_wcsph(neighborhood_search, coordinates; parallel = true) |
| 15 | + density = 1000.0 |
| 16 | + fluid = InitialCondition(; coordinates, density, mass = 0.1) |
| 17 | + |
| 18 | + # Compact support == smoothing length for the Wendland kernel |
| 19 | + smoothing_length = neighborhood_search.search_radius |
| 20 | + smoothing_kernel = WendlandC2Kernel{ndims(neighborhood_search)}() |
| 21 | + |
| 22 | + sound_speed = 10.0 |
| 23 | + state_equation = StateEquationCole(; sound_speed, reference_density = density, |
| 24 | + exponent = 1) |
| 25 | + |
| 26 | + fluid_density_calculator = ContinuityDensity() |
| 27 | + viscosity = ArtificialViscosityMonaghan(alpha = 0.02, beta = 0.0) |
| 28 | + density_diffusion = DensityDiffusionMolteniColagrossi(delta = 0.1) |
| 29 | + |
| 30 | + fluid_system = WeaklyCompressibleSPHSystem(fluid, fluid_density_calculator, |
| 31 | + state_equation, smoothing_kernel, |
| 32 | + smoothing_length, viscosity = viscosity, |
| 33 | + density_diffusion = density_diffusion) |
| 34 | + |
| 35 | + v = vcat(fluid.velocity, fluid.density') |
| 36 | + u = copy(fluid.coordinates) |
| 37 | + dv = zero(v) |
| 38 | + |
| 39 | + return @belapsed TrixiParticles.interact!($dv, $v, $u, $v, $u, $neighborhood_search, |
| 40 | + $fluid_system, $fluid_system) |
| 41 | +end |
0 commit comments