diff --git a/src/neighborhood_search/grid_nhs.jl b/src/neighborhood_search/grid_nhs.jl index 81fc280fc..032a76aab 100644 --- a/src/neighborhood_search/grid_nhs.jl +++ b/src/neighborhood_search/grid_nhs.jl @@ -189,8 +189,8 @@ function update!(neighborhood_search::GridNeighborhoodSearch, coords_fun) end # Use this function barrier and unpack inside to avoid passing closures to Polyester.jl -# with @batch (@threaded). -# Otherwise, @threaded does not work here with Julia ARM on macOS. +# with `@batch` (`@threaded`). +# Otherwise, `@threaded` does not work here with Julia ARM on macOS. # See https://github.com/JuliaSIMD/Polyester.jl/issues/88. @inline function mark_changed_cell!(neighborhood_search, cell, coords_fun) (; hashtable, cell_buffer, cell_buffer_indices) = neighborhood_search diff --git a/src/neighborhood_search/neighborhood_search.jl b/src/neighborhood_search/neighborhood_search.jl index 0b378454e..e9062c5db 100644 --- a/src/neighborhood_search/neighborhood_search.jl +++ b/src/neighborhood_search/neighborhood_search.jl @@ -48,8 +48,8 @@ end end # Use this function barrier and unpack inside to avoid passing closures to Polyester.jl -# with @batch (@threaded). -# Otherwise, @threaded does not work here with Julia ARM on macOS. +# with `@batch` (`@threaded`). +# Otherwise, `@threaded` does not work here with Julia ARM on macOS. # See https://github.com/JuliaSIMD/Polyester.jl/issues/88. @inline function for_particle_neighbor_inner(f, system_coords, neighbor_system_coords, neighborhood_search, particle) diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index 2a3ad2dcd..90f1d3ab4 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -278,13 +278,18 @@ function reinit_density!(system, v, u, v_ode, u_ode, semi) end function compute_pressure!(system, v) - (; state_equation, pressure) = system - - @trixi_timeit timer() "state equation" @threaded for particle in eachparticle(system) - pressure[particle] = state_equation(particle_density(v, system, particle)) + @threaded for particle in eachparticle(system) + apply_state_equation!(system, particle_density(v, system, particle), particle) end end +# Use this function to avoid passing closures to Polyester.jl with `@batch` (`@threaded`). +# Otherwise, `@threaded` does not work here with Julia ARM on macOS. +# See https://github.com/JuliaSIMD/Polyester.jl/issues/88. +@inline function apply_state_equation!(system, density, particle) + system.pressure[particle] = system.state_equation(density) +end + function write_v0!(v0, system::WeaklyCompressibleSPHSystem) (; initial_condition, density_calculator) = system