diff --git a/src/general/neighborhood_search.jl b/src/general/neighborhood_search.jl index 5f985384d..7c595b01f 100644 --- a/src/general/neighborhood_search.jl +++ b/src/general/neighborhood_search.jl @@ -207,8 +207,7 @@ end # `f(particle, neighbor, pos_diff, distance)` is called for every particle-neighbor pair. # By default, loop over `each_moving_particle(system)`. @inline function for_particle_neighbor(f, system, neighbor_system, - system_coords, neighbor_coords, - neighborhood_search; + system_coords, neighbor_coords, neighborhood_search; particles=each_moving_particle(system)) @threaded for particle in particles for_particle_neighbor_inner(f, system, neighbor_system, diff --git a/src/general/semidiscretization.jl b/src/general/semidiscretization.jl index 8b5abf31c..9473ba198 100644 --- a/src/general/semidiscretization.jl +++ b/src/general/semidiscretization.jl @@ -37,9 +37,8 @@ struct Semidiscretization{S, RU, RV, NS, DC} for system in systems) new{typeof(systems), typeof(ranges_u), typeof(ranges_v), - typeof(searches), typeof(damping_coefficient)}(systems, ranges_u, - ranges_v, searches, - damping_coefficient) + typeof(searches), typeof(damping_coefficient)}(systems, ranges_u, ranges_v, + searches, damping_coefficient) end end @@ -93,8 +92,7 @@ end return compact_support(smoothing_kernel, smoothing_length) end -@inline function compact_support(system::Union{TotalLagrangianSPHSystem, - BoundarySPHSystem}, +@inline function compact_support(system::Union{TotalLagrangianSPHSystem, BoundarySPHSystem}, neighbor) return compact_support(system, system.boundary_model, neighbor) end @@ -124,8 +122,7 @@ function nhs_init_function(system::TotalLagrangianSPHSystem, return i -> initial_coords(neighbor, i) end -function nhs_init_function(system::Union{TotalLagrangianSPHSystem, - BoundarySPHSystem}, +function nhs_init_function(system::Union{TotalLagrangianSPHSystem, BoundarySPHSystem}, neighbor) return nhs_init_function(system, system.boundary_model, neighbor) end @@ -274,15 +271,13 @@ function kick!(dv_ode, v_ode, u_ode, semi, t) @trixi_timeit timer() "kick!" begin @trixi_timeit timer() "reset ∂v/∂t" set_zero!(dv_ode) - @trixi_timeit timer() "update systems and nhs" update_systems_and_nhs(v_ode, - u_ode, + @trixi_timeit timer() "update systems and nhs" update_systems_and_nhs(v_ode, u_ode, semi, t) @trixi_timeit timer() "gravity and damping" gravity_and_damping!(dv_ode, v_ode, semi) - @trixi_timeit timer() "system interaction" system_interaction!(dv_ode, - v_ode, u_ode, + @trixi_timeit timer() "system interaction" system_interaction!(dv_ode, v_ode, u_ode, semi) end @@ -374,8 +369,7 @@ end @inline add_acceleration!(dv, particle, system::BoundarySPHSystem) = dv -@inline function add_damping_force!(dv, damping_coefficient::Float64, v, particle, - system) +@inline function add_damping_force!(dv, damping_coefficient::Float64, v, particle, system) for i in 1:ndims(system) dv[i, particle] -= damping_coefficient * v[i, particle] end @@ -414,8 +408,8 @@ function update1!(system, system_index, v, u, v_ode, u_ode, semi, t) return system end -function update1!(system::TotalLagrangianSPHSystem, system_index, v, u, - v_ode, u_ode, semi, t) +function update1!(system::TotalLagrangianSPHSystem, system_index, v, u, v_ode, u_ode, + semi, t) # Only update solid systems update!(system, system_index, v, u, v_ode, u_ode, semi, t) end @@ -424,8 +418,8 @@ function update2!(system, system_index, v, u, v_ode, u_ode, semi, t) return system end -function update2!(system::WeaklyCompressibleSPHSystem, system_index, v, u, - v_ode, u_ode, semi, t) +function update2!(system::WeaklyCompressibleSPHSystem, system_index, v, u, v_ode, u_ode, + semi, t) # Only update fluid systems update!(system, system_index, v, u, v_ode, u_ode, semi, t) end @@ -443,8 +437,7 @@ function update3!(system::TotalLagrangianSPHSystem, system_index, v, u, v_ode, u update!(boundary_model, system, system_index, v, u, v_ode, u_ode, semi) end -function update3!(system::WeaklyCompressibleSPHSystem, system_index, v, u, v_ode, - u_ode, +function update3!(system::WeaklyCompressibleSPHSystem, system_index, v, u, v_ode, u_ode, semi, t) return system end diff --git a/src/schemes/boundary/rhs.jl b/src/schemes/boundary/rhs.jl index f2823666e..20bef6375 100644 --- a/src/schemes/boundary/rhs.jl +++ b/src/schemes/boundary/rhs.jl @@ -10,9 +10,7 @@ end # Boundary-fluid interaction with dummy particles model function interact!(dv, v_particle_system, u_particle_system, v_neighbor_system, u_neighbor_system, neighborhood_search, - particle_system::BoundarySPHSystem{ - <:BoundaryModelDummyParticles - }, + particle_system::BoundarySPHSystem{<:BoundaryModelDummyParticles}, neighbor_system::WeaklyCompressibleSPHSystem) @unpack density_calculator = particle_system.boundary_model @@ -23,16 +21,14 @@ end function interact!(dv, v_particle_system, u_particle_system, v_neighbor_system, u_neighbor_system, neighborhood_search, - particle_system::BoundarySPHSystem, - neighbor_system, density_calculator) + particle_system::BoundarySPHSystem, neighbor_system, density_calculator) return dv end # With `ContinuityDensity` solve the continuity equation function interact!(dv, v_particle_system, u_particle_system, v_neighbor_system, u_neighbor_system, neighborhood_search, - particle_system::BoundarySPHSystem, - neighbor_system, ::ContinuityDensity) + particle_system::BoundarySPHSystem, neighbor_system, ::ContinuityDensity) @unpack boundary_model = particle_system system_coords = current_coordinates(u_particle_system, particle_system) diff --git a/src/schemes/boundary/system.jl b/src/schemes/boundary/system.jl index 1ddf4a322..73a0d5eeb 100644 --- a/src/schemes/boundary/system.jl +++ b/src/schemes/boundary/system.jl @@ -355,13 +355,11 @@ end return n_moving_particles(system, system.boundary_model.density_calculator) end -@inline function n_moving_particles(system::BoundarySPHSystem, - density_calculator) +@inline function n_moving_particles(system::BoundarySPHSystem, density_calculator) return 0 end -@inline function n_moving_particles(system::BoundarySPHSystem, - ::ContinuityDensity) +@inline function n_moving_particles(system::BoundarySPHSystem, ::ContinuityDensity) nparticles(system) end @@ -393,8 +391,7 @@ end return hydrodynamic_mass[particle] / boundary_particle_spacing^ndims(system) end -@inline function particle_density(v, model::BoundaryModelDummyParticles, system, - particle) +@inline function particle_density(v, model::BoundaryModelDummyParticles, system, particle) return particle_density(v, model.density_calculator, system, particle) end @@ -409,8 +406,7 @@ end return system.boundary_model.hydrodynamic_mass[particle] end -function update!(system::BoundarySPHSystem, system_index, - v, u, v_ode, u_ode, semi, t) +function update!(system::BoundarySPHSystem, system_index, v, u, v_ode, u_ode, semi, t) @unpack coordinates, movement_function, boundary_model = system system.ismoving[1] = move_boundary_particles!(movement_function, coordinates, t) @@ -423,10 +419,11 @@ end function move_boundary_particles!(movement_function, coordinates, t) movement_function(coordinates, t) end + move_boundary_particles!(movement_function::Nothing, coordinates, t) = false -@inline function update!(boundary_model::BoundaryModelMonaghanKajtar, system, - system_index, v, u, v_ode, u_ode, semi) +@inline function update!(boundary_model::BoundaryModelMonaghanKajtar, + system, system_index, v, u, v_ode, u_ode, semi) # Nothing to do in the update step return boundary_model end diff --git a/src/schemes/fluid/weakly_compressible_sph/rhs.jl b/src/schemes/fluid/weakly_compressible_sph/rhs.jl index da62e4028..40a72cbee 100644 --- a/src/schemes/fluid/weakly_compressible_sph/rhs.jl +++ b/src/schemes/fluid/weakly_compressible_sph/rhs.jl @@ -75,8 +75,7 @@ end function interact!(dv, v_particle_system, u_particle_system, v_neighbor_system, u_neighbor_system, neighborhood_search, particle_system::WeaklyCompressibleSPHSystem, - neighbor_system::Union{BoundarySPHSystem, - TotalLagrangianSPHSystem}) + neighbor_system::Union{BoundarySPHSystem, TotalLagrangianSPHSystem}) @unpack density_calculator, state_equation, viscosity, smoothing_length = particle_system @unpack sound_speed = state_equation diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index 38cf4be53..1811ce0de 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -110,8 +110,7 @@ end # Nothing to initialize for this system initialize!(system::WeaklyCompressibleSPHSystem, neighborhood_search) = system -function update!(system::WeaklyCompressibleSPHSystem, system_index, v, u, v_ode, - u_ode, +function update!(system::WeaklyCompressibleSPHSystem, system_index, v, u, v_ode, u_ode, semi, t) @unpack density_calculator = system @@ -120,13 +119,11 @@ function update!(system::WeaklyCompressibleSPHSystem, system_index, v, u, v_ode, return system end -function compute_quantities(v, u, ::ContinuityDensity, system, system_index, u_ode, - semi) +function compute_quantities(v, u, ::ContinuityDensity, system, system_index, u_ode, semi) compute_pressure!(system, v) end -function compute_quantities(v, u, ::SummationDensity, system, system_index, u_ode, - semi) +function compute_quantities(v, u, ::SummationDensity, system, system_index, u_ode, semi) @unpack systems, neighborhood_searches = semi @unpack cache = system @unpack density = cache # Density is in the cache for SummationDensity diff --git a/src/schemes/solid/total_lagrangian_sph/system.jl b/src/schemes/solid/total_lagrangian_sph/system.jl index bca48ee43..8d4df6448 100644 --- a/src/schemes/solid/total_lagrangian_sph/system.jl +++ b/src/schemes/solid/total_lagrangian_sph/system.jl @@ -289,8 +289,8 @@ function calc_correction_matrix!(corr_matrix, neighborhood_search, system) return corr_matrix end -function update!(system::TotalLagrangianSPHSystem, system_index, v, u, - v_ode, u_ode, semi, t) +function update!(system::TotalLagrangianSPHSystem, system_index, v, u, v_ode, u_ode, + semi, t) @unpack neighborhood_searches = semi # Update current coordinates