From 03807a21d957030bb1d7dbe5ba50e1b4cdb7ad5d Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Fri, 17 Apr 2026 01:42:39 +0200 Subject: [PATCH 01/56] Refactor SPH system initialization to use keyword arguments - Updated the initialization of `WeaklyCompressibleSPHSystem` and `EntropicallyDampedSPHSystem` across multiple examples to utilize keyword arguments for better readability and maintainability. - Adjusted the documentation for both systems to reflect the new argument structure. - Ensured consistency in the usage of density calculators and state equations in the examples. - Modified tests to validate the new keyword argument structure for both SPH systems. --- docs/literate/src/tut_rigid_body_fsi.jl | 9 +++-- docs/literate/src/tut_setup.jl | 9 +++-- examples/fluid/dam_break_2d.jl | 12 ++++--- examples/fluid/dam_break_2phase_2d.jl | 7 ++-- examples/fluid/dam_break_3d.jl | 9 +++-- examples/fluid/dam_break_oil_film_2d.jl | 18 ++++++---- examples/fluid/falling_water_column_2d.jl | 9 +++-- examples/fluid/falling_water_spheres_2d.jl | 17 ++++++---- examples/fluid/hydrostatic_water_column_2d.jl | 9 +++-- examples/fluid/lid_driven_cavity_2d.jl | 17 ++++++---- examples/fluid/moving_wall_2d.jl | 9 +++-- examples/fluid/oscillating_drop_2d.jl | 9 +++-- .../fluid/periodic_array_of_cylinders_2d.jl | 7 ++-- examples/fluid/periodic_channel_2d.jl | 9 +++-- examples/fluid/pipe_flow_2d.jl | 15 +++++--- examples/fluid/poiseuille_flow_2d.jl | 17 ++++++---- examples/fluid/poiseuille_flow_3d.jl | 9 +++-- examples/fluid/sphere_surface_tension_2d.jl | 15 ++++---- .../fluid/sphere_surface_tension_wall_2d.jl | 8 +++-- examples/fluid/taylor_green_vortex_2d.jl | 14 +++++--- examples/fsi/dam_break_gate_2d.jl | 9 +++-- examples/fsi/dam_break_plate_2d.jl | 9 +++-- examples/fsi/falling_rigid_spheres_2d.jl | 9 +++-- .../fsi/falling_rotating_rigid_squares_2d.jl | 9 +++-- examples/fsi/falling_spheres_2d.jl | 9 +++-- examples/fsi/falling_water_column_2d.jl | 9 +++-- examples/fsi/hydrostatic_water_column_2d.jl | 14 +++++--- .../fluid/entropically_damped_sph/system.jl | 28 +++++++++++---- .../fluid/weakly_compressible_sph/system.jl | 34 +++++++++++++------ test/examples/examples_fluid.jl | 32 ++++++++--------- test/examples/gpu.jl | 16 ++++----- test/general/custom_quantities.jl | 6 ++-- test/io/read_vtk.jl | 7 ++-- test/systems/edac_system.jl | 15 ++++++++ test/systems/wcsph_system.jl | 16 +++++++++ 35 files changed, 303 insertions(+), 147 deletions(-) diff --git a/docs/literate/src/tut_rigid_body_fsi.jl b/docs/literate/src/tut_rigid_body_fsi.jl index 5f11a3d561..80badfe6b5 100644 --- a/docs/literate/src/tut_rigid_body_fsi.jl +++ b/docs/literate/src/tut_rigid_body_fsi.jl @@ -97,9 +97,12 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, fluid_smoothing_kernel, - fluid_smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=fluid_smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, density_diffusion=density_diffusion, acceleration=(0.0, -gravity)) nothing # hide diff --git a/docs/literate/src/tut_setup.jl b/docs/literate/src/tut_setup.jl index 67e54bdcd3..11d1d81a0e 100644 --- a/docs/literate/src/tut_setup.jl +++ b/docs/literate/src/tut_setup.jl @@ -120,9 +120,12 @@ nothing # hide # The simulation quality greatly benefits from using [density diffusion](@ref density_diffusion). fluid_density_calculator = ContinuityDensity() density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, density_diffusion=density_diffusion, acceleration=(0.0, -gravity)) nothing # hide diff --git a/examples/fluid/dam_break_2d.jl b/examples/fluid/dam_break_2d.jl index 56303b1877..d6ce1fbbf3 100644 --- a/examples/fluid/dam_break_2d.jl +++ b/examples/fluid/dam_break_2d.jl @@ -65,11 +65,15 @@ viscosity_fluid = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) # density_diffusion = DensityDiffusionAntuono(tank.fluid, delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity_fluid, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity_fluid, density_diffusion=density_diffusion, - acceleration=(0.0, -gravity), correction=nothing, + acceleration=(0.0, -gravity), + correction=nothing, surface_tension=nothing, reference_particle_spacing=0) diff --git a/examples/fluid/dam_break_2phase_2d.jl b/examples/fluid/dam_break_2phase_2d.jl index 6b626bf42e..c437839121 100644 --- a/examples/fluid/dam_break_2phase_2d.jl +++ b/examples/fluid/dam_break_2phase_2d.jl @@ -76,8 +76,11 @@ air_eos = StateEquationCole(; sound_speed, reference_density=air_density, expone clip_negative_pressure=false) #air_eos = StateEquationIdealGas(; sound_speed, reference_density=air_density, gamma=1.4) -air_system_system = WeaklyCompressibleSPHSystem(air_system, fluid_density_calculator, - air_eos, smoothing_kernel, smoothing_length, +air_system_system = WeaklyCompressibleSPHSystem(air_system; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=air_eos, viscosity=air_viscosity, acceleration=(0.0, -gravity)) diff --git a/examples/fluid/dam_break_3d.jl b/examples/fluid/dam_break_3d.jl index a073c001ec..0cf10a30e3 100644 --- a/examples/fluid/dam_break_3d.jl +++ b/examples/fluid/dam_break_3d.jl @@ -47,9 +47,12 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, density_diffusion=density_diffusion, acceleration=(0.0, -gravity, 0.0)) diff --git a/examples/fluid/dam_break_oil_film_2d.jl b/examples/fluid/dam_break_oil_film_2d.jl index ecf7bb2998..e6e0047fc8 100644 --- a/examples/fluid/dam_break_oil_film_2d.jl +++ b/examples/fluid/dam_break_oil_film_2d.jl @@ -60,17 +60,23 @@ end oil_state_equation = StateEquationCole(; sound_speed, reference_density=oil_density, exponent=1, clip_negative_pressure=false) -oil_system = WeaklyCompressibleSPHSystem(oil, fluid_density_calculator, - oil_eos, smoothing_kernel, - smoothing_length, viscosity=oil_viscosity, +oil_system = WeaklyCompressibleSPHSystem(oil; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=oil_eos, + viscosity=oil_viscosity, acceleration=(0.0, -gravity), surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.01), correction=AkinciFreeSurfaceCorrection(oil_density), reference_particle_spacing=fluid_particle_spacing) -# oil_system = WeaklyCompressibleSPHSystem(oil, fluid_density_calculator, -# oil_eos, smoothing_kernel, -# smoothing_length, viscosity=oil_viscosity, +# oil_system = WeaklyCompressibleSPHSystem(oil; +# smoothing_kernel=smoothing_kernel, +# smoothing_length=smoothing_length, +# density_calculator=fluid_density_calculator, +# state_equation=oil_eos, +# viscosity=oil_viscosity, # acceleration=(0.0, -gravity), # surface_tension=SurfaceTensionMorris(surface_tension_coefficient=0.03), # reference_particle_spacing=fluid_particle_spacing) diff --git a/examples/fluid/falling_water_column_2d.jl b/examples/fluid/falling_water_column_2d.jl index f712f88d93..cd2037943f 100644 --- a/examples/fluid/falling_water_column_2d.jl +++ b/examples/fluid/falling_water_column_2d.jl @@ -45,9 +45,12 @@ smoothing_kernel = SchoenbergCubicSplineKernel{2}() fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index 778d404d69..419748a281 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -59,17 +59,22 @@ alpha = 8 * nu / (fluid_smoothing_length * sound_speed) viscosity = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0) density_diffusion = DensityDiffusionAntuono(sphere2, delta=0.1) -sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1, fluid_smoothing_kernel, - fluid_smoothing_length, - sound_speed, viscosity=viscosity, +sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1; + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=fluid_smoothing_length, + sound_speed=sound_speed, + viscosity=viscosity, density_calculator=ContinuityDensity(), acceleration=(0.0, -gravity), surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.05), reference_particle_spacing=fluid_particle_spacing) -sphere = WeaklyCompressibleSPHSystem(sphere2, fluid_density_calculator, - state_equation, fluid_smoothing_kernel, - fluid_smoothing_length, viscosity=viscosity, +sphere = WeaklyCompressibleSPHSystem(sphere2; + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=fluid_smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, density_diffusion=density_diffusion, acceleration=(0.0, -gravity)) diff --git a/examples/fluid/hydrostatic_water_column_2d.jl b/examples/fluid/hydrostatic_water_column_2d.jl index a62dbab249..be17cc8d89 100644 --- a/examples/fluid/hydrostatic_water_column_2d.jl +++ b/examples/fluid/hydrostatic_water_column_2d.jl @@ -45,9 +45,12 @@ fluid_density_calculator = ContinuityDensity() # This is to set acceleration with `trixi_include` system_acceleration = (0.0, -gravity) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity_fluid, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity_fluid, acceleration=system_acceleration, source_terms=nothing) diff --git a/examples/fluid/lid_driven_cavity_2d.jl b/examples/fluid/lid_driven_cavity_2d.jl index 9849ca06f7..727bedead8 100644 --- a/examples/fluid/lid_driven_cavity_2d.jl +++ b/examples/fluid/lid_driven_cavity_2d.jl @@ -61,18 +61,23 @@ if wcsph density_calculator = ContinuityDensity() state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) - fluid_system = WeaklyCompressibleSPHSystem(cavity.fluid, density_calculator, - state_equation, smoothing_kernel, + fluid_system = WeaklyCompressibleSPHSystem(cavity.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=density_calculator, + state_equation=state_equation, pressure_acceleration=TrixiParticles.inter_particle_averaged_pressure, - smoothing_length, viscosity=viscosity, + viscosity=viscosity, shifting_technique=TransportVelocityAdami(background_pressure=pressure)) else state_equation = nothing density_calculator = ContinuityDensity() - fluid_system = EntropicallyDampedSPHSystem(cavity.fluid, smoothing_kernel, - smoothing_length, + fluid_system = EntropicallyDampedSPHSystem(cavity.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, density_calculator=density_calculator, - sound_speed, viscosity=viscosity, + sound_speed=sound_speed, + viscosity=viscosity, shifting_technique=TransportVelocityAdami(background_pressure=pressure)) end diff --git a/examples/fluid/moving_wall_2d.jl b/examples/fluid/moving_wall_2d.jl index 85663188ea..537ddf13b0 100644 --- a/examples/fluid/moving_wall_2d.jl +++ b/examples/fluid/moving_wall_2d.jl @@ -51,9 +51,12 @@ smoothing_kernel = SchoenbergCubicSplineKernel{2}() fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.1, beta=0.0) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fluid/oscillating_drop_2d.jl b/examples/fluid/oscillating_drop_2d.jl index fb96050f42..d825308a1a 100644 --- a/examples/fluid/oscillating_drop_2d.jl +++ b/examples/fluid/oscillating_drop_2d.jl @@ -56,9 +56,12 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) density_diffusion = DensityDiffusionAntuono(fluid, delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, density_diffusion=density_diffusion, source_terms=source_terms) diff --git a/examples/fluid/periodic_array_of_cylinders_2d.jl b/examples/fluid/periodic_array_of_cylinders_2d.jl index b2dad5bca6..294a07fb89 100644 --- a/examples/fluid/periodic_array_of_cylinders_2d.jl +++ b/examples/fluid/periodic_array_of_cylinders_2d.jl @@ -64,8 +64,11 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit exponent=1, clip_negative_pressure=false) density_diffusion = DensityDiffusionAntuono(fluid, delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=ContinuityDensity(), + state_equation=state_equation, density_diffusion=density_diffusion, viscosity=ViscosityAdami(; nu), shifting_technique=ParticleShiftingTechnique(), diff --git a/examples/fluid/periodic_channel_2d.jl b/examples/fluid/periodic_channel_2d.jl index 5dab8cfc4a..ebd2dc3776 100644 --- a/examples/fluid/periodic_channel_2d.jl +++ b/examples/fluid/periodic_channel_2d.jl @@ -46,9 +46,12 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) # `pressure_acceleration=nothing` is the default and can be overwritten with `trixi_include` -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, shifting_technique=nothing, pressure_acceleration=nothing) diff --git a/examples/fluid/pipe_flow_2d.jl b/examples/fluid/pipe_flow_2d.jl index d81b72b094..5de1b9cf4d 100644 --- a/examples/fluid/pipe_flow_2d.jl +++ b/examples/fluid/pipe_flow_2d.jl @@ -82,18 +82,23 @@ if wcsph exponent=1) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) - fluid_system = WeaklyCompressibleSPHSystem(pipe.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, + fluid_system = WeaklyCompressibleSPHSystem(pipe.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, density_diffusion=density_diffusion, - smoothing_length, viscosity=viscosity, + viscosity=viscosity, shifting_technique=ParticleShiftingTechnique(v_max_factor=1.5), buffer_size=n_buffer_particles) else # Alternatively the EDAC scheme can be used state_equation = nothing - fluid_system = EntropicallyDampedSPHSystem(pipe.fluid, smoothing_kernel, - smoothing_length, sound_speed, + fluid_system = EntropicallyDampedSPHSystem(pipe.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed, viscosity=viscosity, density_calculator=fluid_density_calculator, shifting_technique=ParticleShiftingTechnique(), diff --git a/examples/fluid/poiseuille_flow_2d.jl b/examples/fluid/poiseuille_flow_2d.jl index d808b1be71..e78852ba08 100644 --- a/examples/fluid/poiseuille_flow_2d.jl +++ b/examples/fluid/poiseuille_flow_2d.jl @@ -96,18 +96,23 @@ shifting_technique = TransportVelocityAdami(; background_pressure) if use_wcsph state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) - fluid_system = WeaklyCompressibleSPHSystem(fluid, fluid_density_calculator, - state_equation, smoothing_kernel, + fluid_system = WeaklyCompressibleSPHSystem(fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, buffer_size=n_buffer_particles, shifting_technique=shifting_technique, density_diffusion=DensityDiffusionMolteniColagrossi(delta=0.1), - smoothing_length, viscosity=viscosity) + viscosity=viscosity) else state_equation = nothing - fluid_system = EntropicallyDampedSPHSystem(fluid, smoothing_kernel, - smoothing_length, - sound_speed, viscosity=viscosity, + fluid_system = EntropicallyDampedSPHSystem(fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed, + viscosity=viscosity, density_calculator=fluid_density_calculator, shifting_technique=shifting_technique, buffer_size=n_buffer_particles) diff --git a/examples/fluid/poiseuille_flow_3d.jl b/examples/fluid/poiseuille_flow_3d.jl index c49e7f66bb..0837707502 100644 --- a/examples/fluid/poiseuille_flow_3d.jl +++ b/examples/fluid/poiseuille_flow_3d.jl @@ -113,12 +113,15 @@ shifting_technique = TransportVelocityAdami(; background_pressure) state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) -fluid_system = WeaklyCompressibleSPHSystem(fluid_particles, fluid_density_calculator, - state_equation, smoothing_kernel, +fluid_system = WeaklyCompressibleSPHSystem(fluid_particles; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, buffer_size=n_buffer_particles, shifting_technique=shifting_technique, density_diffusion=DensityDiffusionMolteniColagrossi(delta=0.1), - smoothing_length, viscosity=viscosity) + viscosity=viscosity) # ========================================================================================== # ==== Open Boundary diff --git a/examples/fluid/sphere_surface_tension_2d.jl b/examples/fluid/sphere_surface_tension_2d.jl index ca33941ee3..7103ebd1c9 100644 --- a/examples/fluid/sphere_surface_tension_2d.jl +++ b/examples/fluid/sphere_surface_tension_2d.jl @@ -38,9 +38,11 @@ fluid = RectangularShape(particle_spacing, round.(Int, fluid_size ./ particle_sp alpha = 8 * nu / (smoothing_length * sound_speed) source_terms = SourceTermDamping(; damping_coefficient=0.5) -# fluid_system = WeaklyCompressibleSPHSystem(fluid, SummationDensity(), -# state_equation, fluid_smoothing_kernel, -# smoothing_length, +# fluid_system = WeaklyCompressibleSPHSystem(fluid; +# smoothing_kernel=fluid_smoothing_kernel, +# smoothing_length=smoothing_length, +# density_calculator=SummationDensity(), +# state_equation=state_equation, # reference_particle_spacing=particle_spacing, # viscosity=ArtificialViscosityMonaghan(alpha=alpha, # beta=0.0), @@ -49,9 +51,10 @@ source_terms = SourceTermDamping(; damping_coefficient=0.5) # source_terms=source_terms) # Alternatively can also be used with surface_tension=SurfaceTensionMomentumMorris(surface_tension_coefficient=1.0) -fluid_system = EntropicallyDampedSPHSystem(fluid, fluid_smoothing_kernel, - smoothing_length, - sound_speed, +fluid_system = EntropicallyDampedSPHSystem(fluid; + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed, viscosity=ViscosityMorris(nu=nu), density_calculator=ContinuityDensity(), reference_particle_spacing=particle_spacing, diff --git a/examples/fluid/sphere_surface_tension_wall_2d.jl b/examples/fluid/sphere_surface_tension_wall_2d.jl index 3df25ae986..653a0651fa 100644 --- a/examples/fluid/sphere_surface_tension_wall_2d.jl +++ b/examples/fluid/sphere_surface_tension_wall_2d.jl @@ -52,9 +52,11 @@ alpha = 8 * nu / (fluid_smoothing_length * sound_speed) # `adhesion_coefficient = 0.001` and `surface_tension_coefficient = 2.0` for no wetting viscosity = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0) -sphere_surface_tension = WeaklyCompressibleSPHSystem(sphere1, ContinuityDensity(), - state_equation, fluid_smoothing_kernel, - fluid_smoothing_length, +sphere_surface_tension = WeaklyCompressibleSPHSystem(sphere1; + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=fluid_smoothing_length, + density_calculator=ContinuityDensity(), + state_equation=state_equation, viscosity=viscosity, acceleration=(0.0, -gravity), surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=2.0), diff --git a/examples/fluid/taylor_green_vortex_2d.jl b/examples/fluid/taylor_green_vortex_2d.jl index 0e13d3738d..289daa6b4b 100644 --- a/examples/fluid/taylor_green_vortex_2d.jl +++ b/examples/fluid/taylor_green_vortex_2d.jl @@ -81,17 +81,21 @@ if wcsph density_calculator = ContinuityDensity() state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) - fluid_system = WeaklyCompressibleSPHSystem(fluid, density_calculator, - state_equation, smoothing_kernel, + fluid_system = WeaklyCompressibleSPHSystem(fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=density_calculator, + state_equation=state_equation, pressure_acceleration=TrixiParticles.inter_particle_averaged_pressure, - smoothing_length, viscosity=ViscosityAdami(; nu), shifting_technique=TransportVelocityAdami(; background_pressure)) else density_calculator = SummationDensity() - fluid_system = EntropicallyDampedSPHSystem(fluid, smoothing_kernel, smoothing_length, - sound_speed, + fluid_system = EntropicallyDampedSPHSystem(fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed, density_calculator=density_calculator, shifting_technique=TransportVelocityAdami(; background_pressure), diff --git a/examples/fsi/dam_break_gate_2d.jl b/examples/fsi/dam_break_gate_2d.jl index 4667b1af42..96dc372862 100644 --- a/examples/fsi/dam_break_gate_2d.jl +++ b/examples/fsi/dam_break_gate_2d.jl @@ -110,9 +110,12 @@ smoothing_kernel = WendlandC2Kernel{2}() fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.1, beta=0.0) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fsi/dam_break_plate_2d.jl b/examples/fsi/dam_break_plate_2d.jl index 44d86c5317..19dabc813c 100644 --- a/examples/fsi/dam_break_plate_2d.jl +++ b/examples/fsi/dam_break_plate_2d.jl @@ -80,9 +80,12 @@ smoothing_kernel = WendlandC2Kernel{2}() fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fsi/falling_rigid_spheres_2d.jl b/examples/fsi/falling_rigid_spheres_2d.jl index 026e35793e..18fd142cc5 100644 --- a/examples/fsi/falling_rigid_spheres_2d.jl +++ b/examples/fsi/falling_rigid_spheres_2d.jl @@ -58,9 +58,12 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, fluid_smoothing_kernel, - fluid_smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=fluid_smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, density_diffusion=density_diffusion, acceleration=(0.0, -gravity)) diff --git a/examples/fsi/falling_rotating_rigid_squares_2d.jl b/examples/fsi/falling_rotating_rigid_squares_2d.jl index 5eb1160ea0..aa281a2236 100644 --- a/examples/fsi/falling_rotating_rigid_squares_2d.jl +++ b/examples/fsi/falling_rotating_rigid_squares_2d.jl @@ -74,9 +74,12 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, fluid_smoothing_kernel, - fluid_smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=fluid_smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, density_diffusion=density_diffusion, acceleration=(0.0, -gravity)) diff --git a/examples/fsi/falling_spheres_2d.jl b/examples/fsi/falling_spheres_2d.jl index e938cbf6f8..faa342d102 100644 --- a/examples/fsi/falling_spheres_2d.jl +++ b/examples/fsi/falling_spheres_2d.jl @@ -62,9 +62,12 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, fluid_smoothing_kernel, - fluid_smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=fluid_smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, density_diffusion=density_diffusion, acceleration=(0.0, -gravity)) diff --git a/examples/fsi/falling_water_column_2d.jl b/examples/fsi/falling_water_column_2d.jl index 210806213d..085e37285b 100644 --- a/examples/fsi/falling_water_column_2d.jl +++ b/examples/fsi/falling_water_column_2d.jl @@ -47,9 +47,12 @@ fluid_smoothing_kernel = SchoenbergCubicSplineKernel{2}() fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) -fluid_system = WeaklyCompressibleSPHSystem(fluid, fluid_density_calculator, - state_equation, fluid_smoothing_kernel, - fluid_smoothing_length, viscosity=viscosity, +fluid_system = WeaklyCompressibleSPHSystem(fluid; + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=fluid_smoothing_length, + density_calculator=fluid_density_calculator, + state_equation=state_equation, + viscosity=viscosity, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fsi/hydrostatic_water_column_2d.jl b/examples/fsi/hydrostatic_water_column_2d.jl index 22a132fd3e..4e51684336 100644 --- a/examples/fsi/hydrostatic_water_column_2d.jl +++ b/examples/fsi/hydrostatic_water_column_2d.jl @@ -94,8 +94,10 @@ tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, (plate_size[1 state_equation=state_equation) if use_edac - fluid_system = EntropicallyDampedSPHSystem(tank.fluid, smoothing_kernel, - smoothing_length_fluid, sound_speed, + fluid_system = EntropicallyDampedSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length_fluid, + sound_speed=sound_speed, acceleration=(0.0, -gravity), correction=ShepardKernelCorrection(), source_terms=SourceTermDamping(; @@ -104,9 +106,11 @@ else fluid_density_calculator = ContinuityDensity() density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) # density_diffusion = DensityDiffusionAntuono(tank.fluid, delta=0.1) - fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator, - state_equation, smoothing_kernel, - smoothing_length_fluid, + fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length_fluid, + density_calculator=fluid_density_calculator, + state_equation=state_equation, density_diffusion=density_diffusion, acceleration=(0.0, -gravity), source_terms=SourceTermDamping(; diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index 33f80f43a4..ab571814d7 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -1,6 +1,8 @@ @doc raw""" - EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, sound_speed; + EntropicallyDampedSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + sound_speed, pressure_acceleration=inter_particle_averaged_pressure, density_calculator=SummationDensity(), shifting_technique=nothing, @@ -17,13 +19,13 @@ See [Entropically Damped Artificial Compressibility for SPH](@ref edac) for more # Arguments - `initial_condition`: Initial condition representing the system's particles. -- `sound_speed`: Speed of sound. -- `smoothing_kernel`: Smoothing kernel to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). -- `smoothing_length`: Smoothing length to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). # Keywords +- `smoothing_kernel`: Smoothing kernel to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). +- `smoothing_length`: Smoothing length to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). +- `sound_speed`: Speed of sound. - `viscosity`: Viscosity model for this system (default: no viscosity). Recommended: [`ViscosityAdami`](@ref). - `acceleration`: Acceleration vector for the system. (default: zero vector) @@ -83,6 +85,18 @@ struct EntropicallyDampedSPHSystem{NDIMS, ELTYPE <: Real, IC, M, DC, K, V, COR, cache :: C end +# Keyword-only public front door used by the examples and docs. +function EntropicallyDampedSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + sound_speed, + density_calculator=SummationDensity(), + kwargs...) + return EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, + smoothing_length, sound_speed; + density_calculator, kwargs...) +end + # The default constructor needs to be accessible for Adapt.jl to work with this struct. # See the comments in general/gpu.jl for more details. function EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index 7a9b290965..cfb07822d5 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -1,7 +1,9 @@ """ - WeaklyCompressibleSPHSystem(initial_condition, - density_calculator, state_equation, - smoothing_kernel, smoothing_length; + WeaklyCompressibleSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + density_calculator, + state_equation, acceleration=ntuple(_ -> 0.0, NDIMS), viscosity=nothing, density_diffusion=nothing, pressure_acceleration=nothing, @@ -18,15 +20,15 @@ See [Weakly Compressible SPH](@ref wcsph) for more details on the method. # Arguments - `initial_condition`: [`InitialCondition`](@ref) representing the system's particles. -- `density_calculator`: Density calculator for the system. - See [`ContinuityDensity`](@ref) and [`SummationDensity`](@ref). -- `state_equation`: Equation of state for the system. See [`StateEquationCole`](@ref). -- `smoothing_kernel`: Smoothing kernel to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). -- `smoothing_length`: Smoothing length to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). # Keywords +- `smoothing_kernel`: Smoothing kernel to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). +- `smoothing_length`: Smoothing length to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). +- `density_calculator`: Density calculator for the system. + See [`ContinuityDensity`](@ref) and [`SummationDensity`](@ref). +- `state_equation`: Equation of state for the system. See [`StateEquationCole`](@ref). - `acceleration`: Acceleration vector for the system. (default: zero vector) - `viscosity`: Viscosity model for this system (default: no viscosity). See [`ArtificialViscosityMonaghan`](@ref) or [`ViscosityAdami`](@ref). @@ -86,6 +88,18 @@ struct WeaklyCompressibleSPHSystem{NDIMS, ELTYPE <: Real, IC, MA, P, DC, SE, K, cache :: C end +# Keyword-only public front door used by the examples and docs. +function WeaklyCompressibleSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + density_calculator, + state_equation, + kwargs...) + return WeaklyCompressibleSPHSystem(initial_condition, density_calculator, + state_equation, smoothing_kernel, + smoothing_length; kwargs...) +end + # The default constructor needs to be accessible for Adapt.jl to work with this struct. # See the comments in general/gpu.jl for more details. function WeaklyCompressibleSPHSystem(initial_condition, density_calculator, state_equation, diff --git a/test/examples/examples_fluid.jl b/test/examples/examples_fluid.jl index 125f3bd38e..00827e0048 100644 --- a/test/examples/examples_fluid.jl +++ b/test/examples/examples_fluid.jl @@ -51,34 +51,34 @@ "WCSPH with WendlandC6Kernel" => (smoothing_length=2.0, smoothing_kernel=WendlandC6Kernel{2}()), "EDAC with source term damping" => (source_terms=SourceTermDamping(damping_coefficient=1e-4), - fluid_system=EntropicallyDampedSPHSystem(tank.fluid, - smoothing_kernel, - smoothing_length, - sound_speed, + fluid_system=EntropicallyDampedSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed, viscosity=viscosity_fluid, density_calculator=ContinuityDensity(), acceleration=(0.0, -gravity))), - "EDAC with SummationDensity" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid, - smoothing_kernel, - smoothing_length, - sound_speed, + "EDAC with SummationDensity" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed, viscosity=viscosity_fluid, density_calculator=SummationDensity(), acceleration=(0.0, -gravity)),), - "EDAC with ViscosityAdami" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid, - smoothing_kernel, - smoothing_length, - sound_speed, + "EDAC with ViscosityAdami" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed, viscosity=ViscosityAdami(nu=0.0015), density_calculator=ContinuityDensity(), acceleration=(0.0, -gravity)),), - "EDAC with ViscosityMorris" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid, - smoothing_kernel, - smoothing_length, - sound_speed, + "EDAC with ViscosityMorris" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed, viscosity=ViscosityMorris(nu=0.0015), density_calculator=ContinuityDensity(), acceleration=(0.0, diff --git a/test/examples/gpu.jl b/test/examples/gpu.jl index 3117a67ca5..7b8ef18504 100644 --- a/test/examples/gpu.jl +++ b/test/examples/gpu.jl @@ -342,18 +342,18 @@ end "WCSPH with WendlandC6Kernel" => (smoothing_length=2.0, smoothing_kernel=WendlandC6Kernel{2}()), "EDAC with source term damping" => (source_terms=SourceTermDamping(damping_coefficient=1.0f-4), - fluid_system=EntropicallyDampedSPHSystem(tank.fluid, - smoothing_kernel, - smoothing_length, - sound_speed, + fluid_system=EntropicallyDampedSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed, viscosity=viscosity_fluid, density_calculator=ContinuityDensity(), acceleration=(0.0, -gravity))), - "EDAC with SummationDensity" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid, - smoothing_kernel, - smoothing_length, - sound_speed, + "EDAC with SummationDensity" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed, viscosity=viscosity_fluid, density_calculator=SummationDensity(), acceleration=(0.0, diff --git a/test/general/custom_quantities.jl b/test/general/custom_quantities.jl index 54e976b395..d5ebc21a1c 100644 --- a/test/general/custom_quantities.jl +++ b/test/general/custom_quantities.jl @@ -12,8 +12,10 @@ smoothing_kernel = SchoenbergCubicSplineKernel{2}() smoothing_length = 1.2 * particle_spacing - fluid_system = EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, 1.0) + fluid_system = EntropicallyDampedSPHSystem(initial_condition; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=1.0) fluid_system.cache.density .= initial_condition.density boundary_model = BoundaryModelDummyParticles(initial_condition.density, diff --git a/test/io/read_vtk.jl b/test/io/read_vtk.jl index 264fb97c9e..0241c57678 100644 --- a/test/io/read_vtk.jl +++ b/test/io/read_vtk.jl @@ -86,9 +86,10 @@ end @testset verbose=true "`AbstractFluidSystem`" begin - fluid_system = EntropicallyDampedSPHSystem(expected_ic, - SchoenbergCubicSplineKernel{2}(), - 1.5, 1.5) + fluid_system = EntropicallyDampedSPHSystem(expected_ic; + smoothing_kernel=SchoenbergCubicSplineKernel{2}(), + smoothing_length=1.5, + sound_speed=1.5) # Overwrite values because we skip the update step fluid_system.cache.density .= expected_ic.density diff --git a/test/systems/edac_system.jl b/test/systems/edac_system.jl index ac8a424853..f2166dd578 100644 --- a/test/systems/edac_system.jl +++ b/test/systems/edac_system.jl @@ -26,6 +26,10 @@ system = EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, smoothing_length, sound_speed) + system_keywords = EntropicallyDampedSPHSystem(initial_condition; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + sound_speed=sound_speed) @test system isa EntropicallyDampedSPHSystem{NDIMS} @test system.initial_condition == initial_condition @@ -36,6 +40,17 @@ @test system.viscosity === nothing @test system.nu_edac == (0.5 * smoothing_length * sound_speed) / 8 @test system.acceleration == [0.0 for _ in 1:NDIMS] + @test system_keywords isa EntropicallyDampedSPHSystem{NDIMS} + @test system_keywords.initial_condition == system.initial_condition + @test system_keywords.mass == system.mass + @test system_keywords.density_calculator == system.density_calculator + @test system_keywords.smoothing_kernel == system.smoothing_kernel + @test TrixiParticles.initial_smoothing_length(system_keywords) == + TrixiParticles.initial_smoothing_length(system) + @test system_keywords.shifting_technique isa Nothing + @test system_keywords.viscosity === system.viscosity + @test system_keywords.nu_edac == system.nu_edac + @test system_keywords.acceleration == system.acceleration error_str1 = "`acceleration` must be of length $NDIMS for a $(NDIMS)D problem" @test_throws ArgumentError(error_str1) EntropicallyDampedSPHSystem(initial_condition, diff --git a/test/systems/wcsph_system.jl b/test/systems/wcsph_system.jl index 7c034e7757..07681a37d8 100644 --- a/test/systems/wcsph_system.jl +++ b/test/systems/wcsph_system.jl @@ -34,6 +34,11 @@ density_calculator, state_equation, smoothing_kernel, smoothing_length) + system_keywords = WeaklyCompressibleSPHSystem(initial_condition; + smoothing_kernel=smoothing_kernel, + smoothing_length=smoothing_length, + density_calculator=density_calculator, + state_equation=state_equation) @test system isa WeaklyCompressibleSPHSystem{NDIMS} @test system.initial_condition == initial_condition @@ -44,9 +49,20 @@ @test TrixiParticles.initial_smoothing_length(system) == smoothing_length @test system.viscosity === nothing @test system.acceleration == [0.0 for _ in 1:NDIMS] + @test system_keywords isa WeaklyCompressibleSPHSystem{NDIMS} + @test system_keywords.initial_condition == system.initial_condition + @test system_keywords.mass == system.mass + @test system_keywords.density_calculator == system.density_calculator + @test system_keywords.state_equation == system.state_equation + @test system_keywords.smoothing_kernel == system.smoothing_kernel + @test TrixiParticles.initial_smoothing_length(system_keywords) == + TrixiParticles.initial_smoothing_length(system) + @test system_keywords.viscosity === system.viscosity + @test system_keywords.acceleration == system.acceleration if density_calculator isa SummationDensity @test length(system.cache.density) == size(coordinates, 2) + @test length(system_keywords.cache.density) == size(coordinates, 2) end error_str1 = "`acceleration` must be of length $NDIMS for a $(NDIMS)D problem" From be971d90e04298ea682838d0ac19907b3a257a4f Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Fri, 17 Apr 2026 14:59:26 +0200 Subject: [PATCH 02/56] fix test --- test/io/read_vtk.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/io/read_vtk.jl b/test/io/read_vtk.jl index e9bdc7668e..9c03b3cbd0 100644 --- a/test/io/read_vtk.jl +++ b/test/io/read_vtk.jl @@ -106,18 +106,18 @@ end @testset verbose=true "Exact Field Matches" begin - trixi2vtk(expected_ic; filename="tmp_initial_condition_exact_field_match", + trixi2vtk(expected_data; filename="tmp_initial_condition_exact_field_match", output_directory=tmp_dir, - center_of_mass_velocity=fill(42.0, size(expected_ic.velocity))) + center_of_mass_velocity=fill(42.0, size(expected_data.velocity))) file = joinpath(tmp_dir, "tmp_initial_condition_exact_field_match.vtu") test_ic = vtk2trixi(file) - @test isapprox(expected_ic.velocity, test_ic.velocity, rtol=1e-5) + @test isapprox(expected_data.velocity, test_ic.velocity, rtol=1e-5) end end @testset verbose=true "`AbstractFluidSystem`" begin - fluid_system = EntropicallyDampedSPHSystem(expected_ic; + fluid_system = EntropicallyDampedSPHSystem(expected_data; smoothing_kernel=SchoenbergCubicSplineKernel{2}(), smoothing_length=1.5, sound_speed=1.5) From e63edb9ab638d42347141637924def54a8e6afc2 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 21 Apr 2026 12:04:40 +0200 Subject: [PATCH 03/56] Update docs/literate/src/tut_setup.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- docs/literate/src/tut_setup.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/literate/src/tut_setup.jl b/docs/literate/src/tut_setup.jl index 11d1d81a0e..7c3dcbc9bc 100644 --- a/docs/literate/src/tut_setup.jl +++ b/docs/literate/src/tut_setup.jl @@ -121,8 +121,7 @@ nothing # hide fluid_density_calculator = ContinuityDensity() density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation=state_equation, viscosity=viscosity, From b88cae36dd8cab95eb986019513e78ec636db3d1 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 21 Apr 2026 14:48:47 +0200 Subject: [PATCH 04/56] remove unneeded named arguments --- examples/fluid/dam_break_2d.jl | 9 +++------ examples/fluid/dam_break_2phase_2d.jl | 3 +-- examples/fluid/dam_break_3d.jl | 10 +++------- examples/fluid/dam_break_oil_film_2d.jl | 3 +-- examples/fluid/falling_water_column_2d.jl | 9 +++------ examples/fluid/falling_water_spheres_2d.jl | 17 ++++++----------- examples/fluid/hydrostatic_water_column_2d.jl | 6 ++---- examples/fluid/lid_driven_cavity_2d.jl | 8 +++----- examples/fluid/moving_wall_2d.jl | 9 +++------ examples/fluid/oscillating_drop_2d.jl | 9 +++------ .../fluid/periodic_array_of_cylinders_2d.jl | 8 +++----- examples/fluid/periodic_channel_2d.jl | 9 +++------ examples/fluid/pipe_flow_2d.jl | 14 +++++--------- examples/fluid/poiseuille_flow_2d.jl | 15 ++++++--------- examples/fluid/poiseuille_flow_3d.jl | 10 ++++------ examples/fluid/sphere_surface_tension_2d.jl | 7 +++---- .../fluid/sphere_surface_tension_wall_2d.jl | 3 +-- examples/fluid/taylor_green_vortex_2d.jl | 12 ++++-------- examples/fsi/dam_break_gate_2d.jl | 6 ++---- examples/fsi/dam_break_plate_2d.jl | 6 ++---- examples/fsi/falling_rigid_spheres_2d.jl | 4 +--- .../fsi/falling_rotating_rigid_squares_2d.jl | 4 +--- examples/fsi/falling_spheres_2d.jl | 4 +--- examples/fsi/falling_water_column_2d.jl | 3 +-- examples/fsi/hydrostatic_water_column_2d.jl | 11 ++++------- 25 files changed, 69 insertions(+), 130 deletions(-) diff --git a/examples/fluid/dam_break_2d.jl b/examples/fluid/dam_break_2d.jl index 24147ca0af..b6821086bb 100644 --- a/examples/fluid/dam_break_2d.jl +++ b/examples/fluid/dam_break_2d.jl @@ -66,13 +66,10 @@ density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) # density_diffusion = DensityDiffusionAntuono(delta=0.1) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity_fluid, - density_diffusion=density_diffusion, - acceleration=(0.0, -gravity), + state_equation, viscosity=viscosity_fluid, + density_diffusion, acceleration=(0.0, -gravity), correction=nothing, surface_tension=nothing, reference_particle_spacing=0) diff --git a/examples/fluid/dam_break_2phase_2d.jl b/examples/fluid/dam_break_2phase_2d.jl index c437839121..f0b13df6e9 100644 --- a/examples/fluid/dam_break_2phase_2d.jl +++ b/examples/fluid/dam_break_2phase_2d.jl @@ -77,8 +77,7 @@ air_eos = StateEquationCole(; sound_speed, reference_density=air_density, expone #air_eos = StateEquationIdealGas(; sound_speed, reference_density=air_density, gamma=1.4) air_system_system = WeaklyCompressibleSPHSystem(air_system; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation=air_eos, viscosity=air_viscosity, diff --git a/examples/fluid/dam_break_3d.jl b/examples/fluid/dam_break_3d.jl index 0cf10a30e3..44fb1b3c3f 100644 --- a/examples/fluid/dam_break_3d.jl +++ b/examples/fluid/dam_break_3d.jl @@ -48,20 +48,16 @@ viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, - density_diffusion=density_diffusion, + state_equation, viscosity, density_diffusion, acceleration=(0.0, -gravity, 0.0)) # ========================================================================================== # ==== Boundary boundary_density_calculator = AdamiPressureExtrapolation() boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, - boundary_density_calculator, + state_equation, boundary_density_calculator, smoothing_kernel, smoothing_length) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) diff --git a/examples/fluid/dam_break_oil_film_2d.jl b/examples/fluid/dam_break_oil_film_2d.jl index e6e0047fc8..56f944f64b 100644 --- a/examples/fluid/dam_break_oil_film_2d.jl +++ b/examples/fluid/dam_break_oil_film_2d.jl @@ -61,8 +61,7 @@ end oil_state_equation = StateEquationCole(; sound_speed, reference_density=oil_density, exponent=1, clip_negative_pressure=false) oil_system = WeaklyCompressibleSPHSystem(oil; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation=oil_eos, viscosity=oil_viscosity, diff --git a/examples/fluid/falling_water_column_2d.jl b/examples/fluid/falling_water_column_2d.jl index cd2037943f..92dac295ad 100644 --- a/examples/fluid/falling_water_column_2d.jl +++ b/examples/fluid/falling_water_column_2d.jl @@ -46,19 +46,16 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, + state_equation, viscosity, acceleration=(0.0, -gravity)) # ========================================================================================== # ==== Boundary boundary_density_calculator = AdamiPressureExtrapolation() boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, - boundary_density_calculator, + state_equation, boundary_density_calculator, smoothing_kernel, smoothing_length) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index 1f3fa9f342..12a4c534ea 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -60,22 +60,18 @@ viscosity = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0) density_diffusion = DensityDiffusionAntuono(delta=0.1) sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1; - smoothing_kernel=fluid_smoothing_kernel, - smoothing_length=fluid_smoothing_length, - sound_speed=sound_speed, - viscosity=viscosity, + fluid_smoothing_kernel, + fluid_smoothing_length, + sound_speed, viscosity, density_calculator=ContinuityDensity(), acceleration=(0.0, -gravity), surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.05), reference_particle_spacing=fluid_particle_spacing) sphere = WeaklyCompressibleSPHSystem(sphere2; - smoothing_kernel=fluid_smoothing_kernel, - smoothing_length=fluid_smoothing_length, + fluid_smoothing_kernel, fluid_smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, - density_diffusion=density_diffusion, + state_equation, viscosity, density_diffusion, acceleration=(0.0, -gravity)) # ========================================================================================== @@ -83,8 +79,7 @@ sphere = WeaklyCompressibleSPHSystem(sphere2; boundary_density_calculator = AdamiPressureExtrapolation() wall_viscosity = nu boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, - boundary_density_calculator, + state_equation, boundary_density_calculator, fluid_smoothing_kernel, fluid_smoothing_length, viscosity=ViscosityAdami(nu=wall_viscosity), reference_particle_spacing=fluid_particle_spacing) diff --git a/examples/fluid/hydrostatic_water_column_2d.jl b/examples/fluid/hydrostatic_water_column_2d.jl index be17cc8d89..a04dd51475 100644 --- a/examples/fluid/hydrostatic_water_column_2d.jl +++ b/examples/fluid/hydrostatic_water_column_2d.jl @@ -46,11 +46,9 @@ fluid_density_calculator = ContinuityDensity() # This is to set acceleration with `trixi_include` system_acceleration = (0.0, -gravity) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity_fluid, + state_equation, viscosity=viscosity_fluid, acceleration=system_acceleration, source_terms=nothing) diff --git a/examples/fluid/lid_driven_cavity_2d.jl b/examples/fluid/lid_driven_cavity_2d.jl index 727bedead8..f587cfda05 100644 --- a/examples/fluid/lid_driven_cavity_2d.jl +++ b/examples/fluid/lid_driven_cavity_2d.jl @@ -62,12 +62,10 @@ if wcsph state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) fluid_system = WeaklyCompressibleSPHSystem(cavity.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - density_calculator=density_calculator, - state_equation=state_equation, + smoothing_kernel, smoothing_length, + density_calculator, state_equation, pressure_acceleration=TrixiParticles.inter_particle_averaged_pressure, - viscosity=viscosity, + viscosity, shifting_technique=TransportVelocityAdami(background_pressure=pressure)) else state_equation = nothing diff --git a/examples/fluid/moving_wall_2d.jl b/examples/fluid/moving_wall_2d.jl index 537ddf13b0..a5ad400235 100644 --- a/examples/fluid/moving_wall_2d.jl +++ b/examples/fluid/moving_wall_2d.jl @@ -52,19 +52,16 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.1, beta=0.0) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, + state_equation, viscosity, acceleration=(0.0, -gravity)) # ========================================================================================== # ==== Boundary boundary_density_calculator = AdamiPressureExtrapolation() boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, - boundary_density_calculator, + state_equation, boundary_density_calculator, smoothing_kernel, smoothing_length) boundary_system = WallBoundarySystem(tank.boundary, boundary_model, diff --git a/examples/fluid/oscillating_drop_2d.jl b/examples/fluid/oscillating_drop_2d.jl index f95ae5cee2..930a6039ad 100644 --- a/examples/fluid/oscillating_drop_2d.jl +++ b/examples/fluid/oscillating_drop_2d.jl @@ -57,13 +57,10 @@ viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) density_diffusion = DensityDiffusionAntuono(delta=0.1) fluid_system = WeaklyCompressibleSPHSystem(fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, - density_diffusion=density_diffusion, - source_terms=source_terms) + state_equation, viscosity, density_diffusion, + source_terms) # ========================================================================================== # ==== Simulation diff --git a/examples/fluid/periodic_array_of_cylinders_2d.jl b/examples/fluid/periodic_array_of_cylinders_2d.jl index 45beb64fe7..1c36a5e4be 100644 --- a/examples/fluid/periodic_array_of_cylinders_2d.jl +++ b/examples/fluid/periodic_array_of_cylinders_2d.jl @@ -65,11 +65,9 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit density_diffusion = DensityDiffusionAntuono(delta=0.1) fluid_system = WeaklyCompressibleSPHSystem(fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=ContinuityDensity(), - state_equation=state_equation, - density_diffusion=density_diffusion, + state_equation, density_diffusion, viscosity=ViscosityAdami(; nu), shifting_technique=ParticleShiftingTechnique(), pressure_acceleration=tensile_instability_control, @@ -81,7 +79,7 @@ boundary_model = BoundaryModelDummyParticles(boundary.density, boundary.mass, AdamiPressureExtrapolation(), viscosity=ViscosityAdami(; nu), smoothing_kernel, smoothing_length, - state_equation=state_equation) + state_equation) boundary_system = WallBoundarySystem(boundary, boundary_model) diff --git a/examples/fluid/periodic_channel_2d.jl b/examples/fluid/periodic_channel_2d.jl index ebd2dc3776..42aa22ba53 100644 --- a/examples/fluid/periodic_channel_2d.jl +++ b/examples/fluid/periodic_channel_2d.jl @@ -47,11 +47,9 @@ viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) # `pressure_acceleration=nothing` is the default and can be overwritten with `trixi_include` fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, + state_equation, viscosity, shifting_technique=nothing, pressure_acceleration=nothing) @@ -63,8 +61,7 @@ viscosity_wall = nothing #viscosity_wall = ViscosityAdami(nu=0.0025 * smoothing_length * sound_speed / 8) boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, - boundary_density_calculator, + state_equation, boundary_density_calculator, smoothing_kernel, smoothing_length, viscosity=viscosity_wall) diff --git a/examples/fluid/pipe_flow_2d.jl b/examples/fluid/pipe_flow_2d.jl index 5de1b9cf4d..469839bb4d 100644 --- a/examples/fluid/pipe_flow_2d.jl +++ b/examples/fluid/pipe_flow_2d.jl @@ -83,12 +83,10 @@ if wcsph density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) fluid_system = WeaklyCompressibleSPHSystem(pipe.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - density_diffusion=density_diffusion, - viscosity=viscosity, + state_equation, density_diffusion, + viscosity, shifting_technique=ParticleShiftingTechnique(v_max_factor=1.5), buffer_size=n_buffer_particles) else @@ -96,10 +94,8 @@ else state_equation = nothing fluid_system = EntropicallyDampedSPHSystem(pipe.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed, - viscosity=viscosity, + smoothing_kernel, smoothing_length, + sound_speed, viscosity, density_calculator=fluid_density_calculator, shifting_technique=ParticleShiftingTechnique(), buffer_size=n_buffer_particles) diff --git a/examples/fluid/poiseuille_flow_2d.jl b/examples/fluid/poiseuille_flow_2d.jl index e78852ba08..a94c1c177b 100644 --- a/examples/fluid/poiseuille_flow_2d.jl +++ b/examples/fluid/poiseuille_flow_2d.jl @@ -97,22 +97,19 @@ if use_wcsph state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) fluid_system = WeaklyCompressibleSPHSystem(fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, + state_equation, buffer_size=n_buffer_particles, - shifting_technique=shifting_technique, + shifting_technique, density_diffusion=DensityDiffusionMolteniColagrossi(delta=0.1), - viscosity=viscosity) + viscosity) else state_equation = nothing fluid_system = EntropicallyDampedSPHSystem(fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed, - viscosity=viscosity, + smoothing_kernel, smoothing_length, + sound_speed, viscosity, density_calculator=fluid_density_calculator, shifting_technique=shifting_technique, buffer_size=n_buffer_particles) diff --git a/examples/fluid/poiseuille_flow_3d.jl b/examples/fluid/poiseuille_flow_3d.jl index 0837707502..88f9e327f9 100644 --- a/examples/fluid/poiseuille_flow_3d.jl +++ b/examples/fluid/poiseuille_flow_3d.jl @@ -114,14 +114,12 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit exponent=1) fluid_system = WeaklyCompressibleSPHSystem(fluid_particles; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - buffer_size=n_buffer_particles, - shifting_technique=shifting_technique, + state_equation, buffer_size=n_buffer_particles, + shifting_technique, density_diffusion=DensityDiffusionMolteniColagrossi(delta=0.1), - viscosity=viscosity) + viscosity) # ========================================================================================== # ==== Open Boundary diff --git a/examples/fluid/sphere_surface_tension_2d.jl b/examples/fluid/sphere_surface_tension_2d.jl index 7103ebd1c9..6208e875b8 100644 --- a/examples/fluid/sphere_surface_tension_2d.jl +++ b/examples/fluid/sphere_surface_tension_2d.jl @@ -40,9 +40,9 @@ alpha = 8 * nu / (smoothing_length * sound_speed) source_terms = SourceTermDamping(; damping_coefficient=0.5) # fluid_system = WeaklyCompressibleSPHSystem(fluid; # smoothing_kernel=fluid_smoothing_kernel, -# smoothing_length=smoothing_length, +# smoothing_length, # density_calculator=SummationDensity(), -# state_equation=state_equation, +# state_equation, # reference_particle_spacing=particle_spacing, # viscosity=ArtificialViscosityMonaghan(alpha=alpha, # beta=0.0), @@ -53,8 +53,7 @@ source_terms = SourceTermDamping(; damping_coefficient=0.5) # Alternatively can also be used with surface_tension=SurfaceTensionMomentumMorris(surface_tension_coefficient=1.0) fluid_system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed, + smoothing_length, sound_speed, viscosity=ViscosityMorris(nu=nu), density_calculator=ContinuityDensity(), reference_particle_spacing=particle_spacing, diff --git a/examples/fluid/sphere_surface_tension_wall_2d.jl b/examples/fluid/sphere_surface_tension_wall_2d.jl index 653a0651fa..66ca1f1f44 100644 --- a/examples/fluid/sphere_surface_tension_wall_2d.jl +++ b/examples/fluid/sphere_surface_tension_wall_2d.jl @@ -56,8 +56,7 @@ sphere_surface_tension = WeaklyCompressibleSPHSystem(sphere1; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, density_calculator=ContinuityDensity(), - state_equation=state_equation, - viscosity=viscosity, + state_equation, viscosity, acceleration=(0.0, -gravity), surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=2.0), correction=AkinciFreeSurfaceCorrection(fluid_density), diff --git a/examples/fluid/taylor_green_vortex_2d.jl b/examples/fluid/taylor_green_vortex_2d.jl index 289daa6b4b..06fe942150 100644 --- a/examples/fluid/taylor_green_vortex_2d.jl +++ b/examples/fluid/taylor_green_vortex_2d.jl @@ -82,10 +82,8 @@ if wcsph state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) fluid_system = WeaklyCompressibleSPHSystem(fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - density_calculator=density_calculator, - state_equation=state_equation, + smoothing_kernel, smoothing_length, + density_calculator, state_equation, pressure_acceleration=TrixiParticles.inter_particle_averaged_pressure, viscosity=ViscosityAdami(; nu), shifting_technique=TransportVelocityAdami(; @@ -93,10 +91,8 @@ if wcsph else density_calculator = SummationDensity() fluid_system = EntropicallyDampedSPHSystem(fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed, - density_calculator=density_calculator, + smoothing_kernel, smoothing_length, + sound_speed, density_calculator, shifting_technique=TransportVelocityAdami(; background_pressure), viscosity=ViscosityAdami(; nu)) diff --git a/examples/fsi/dam_break_gate_2d.jl b/examples/fsi/dam_break_gate_2d.jl index 96dc372862..74a22ed5a5 100644 --- a/examples/fsi/dam_break_gate_2d.jl +++ b/examples/fsi/dam_break_gate_2d.jl @@ -111,11 +111,9 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.1, beta=0.0) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, + state_equation, viscosity, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fsi/dam_break_plate_2d.jl b/examples/fsi/dam_break_plate_2d.jl index 19dabc813c..50b48507d4 100644 --- a/examples/fsi/dam_break_plate_2d.jl +++ b/examples/fsi/dam_break_plate_2d.jl @@ -81,11 +81,9 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, + state_equation, viscosity, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fsi/falling_rigid_spheres_2d.jl b/examples/fsi/falling_rigid_spheres_2d.jl index 18fd142cc5..1c90da1680 100644 --- a/examples/fsi/falling_rigid_spheres_2d.jl +++ b/examples/fsi/falling_rigid_spheres_2d.jl @@ -62,9 +62,7 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, - density_diffusion=density_diffusion, + state_equation, viscosity, density_diffusion, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fsi/falling_rotating_rigid_squares_2d.jl b/examples/fsi/falling_rotating_rigid_squares_2d.jl index aa281a2236..669958d73b 100644 --- a/examples/fsi/falling_rotating_rigid_squares_2d.jl +++ b/examples/fsi/falling_rotating_rigid_squares_2d.jl @@ -78,9 +78,7 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, - density_diffusion=density_diffusion, + state_equation, viscosity, density_diffusion, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fsi/falling_spheres_2d.jl b/examples/fsi/falling_spheres_2d.jl index faa342d102..e4ff550f00 100644 --- a/examples/fsi/falling_spheres_2d.jl +++ b/examples/fsi/falling_spheres_2d.jl @@ -66,9 +66,7 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, - density_diffusion=density_diffusion, + state_equation, viscosity, density_diffusion, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fsi/falling_water_column_2d.jl b/examples/fsi/falling_water_column_2d.jl index 085e37285b..539b44eeb8 100644 --- a/examples/fsi/falling_water_column_2d.jl +++ b/examples/fsi/falling_water_column_2d.jl @@ -51,8 +51,7 @@ fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, + state_equation, viscosity, acceleration=(0.0, -gravity)) # ========================================================================================== diff --git a/examples/fsi/hydrostatic_water_column_2d.jl b/examples/fsi/hydrostatic_water_column_2d.jl index a99bc6c763..3f340a0005 100644 --- a/examples/fsi/hydrostatic_water_column_2d.jl +++ b/examples/fsi/hydrostatic_water_column_2d.jl @@ -95,9 +95,8 @@ tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, (plate_size[1 if use_edac fluid_system = EntropicallyDampedSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length_fluid, - sound_speed=sound_speed, + smoothing_kernel, smoothing_length_fluid, + sound_speed, acceleration=(0.0, -gravity), correction=ShepardKernelCorrection(), source_terms=SourceTermDamping(; @@ -107,11 +106,9 @@ else density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) # density_diffusion = DensityDiffusionAntuono(delta=0.1) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length_fluid, + smoothing_kernel, smoothing_length_fluid, density_calculator=fluid_density_calculator, - state_equation=state_equation, - density_diffusion=density_diffusion, + state_equation, density_diffusion, acceleration=(0.0, -gravity), source_terms=SourceTermDamping(; damping_coefficient=0.05)) From 664e6028b77824e5366265e3e9bb741a382f1e11 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 21 Apr 2026 15:29:18 +0200 Subject: [PATCH 05/56] more fixes --- examples/dem/collapsing_sand_pile_3d.jl | 4 +-- examples/fluid/dam_break_2d.jl | 10 +++---- examples/fluid/dam_break_3d.jl | 11 ++++---- examples/fluid/dam_break_oil_film_2d.jl | 4 +-- examples/fluid/falling_water_column_2d.jl | 9 ++++--- examples/fluid/falling_water_spheres_2d.jl | 11 ++++---- examples/fluid/hydrostatic_water_column_2d.jl | 8 +++--- examples/fluid/lid_driven_cavity_2d.jl | 26 +++++++++---------- examples/fluid/moving_wall_2d.jl | 9 ++++--- .../fluid/periodic_array_of_cylinders_2d.jl | 4 +-- examples/fluid/periodic_channel_2d.jl | 9 ++++--- examples/fluid/pipe_flow_2d.jl | 6 ++--- examples/fluid/poiseuille_flow_2d.jl | 8 +++--- examples/fluid/poiseuille_flow_3d.jl | 10 +++---- examples/fluid/sphere_surface_tension_2d.jl | 2 +- examples/fsi/dam_break_gate_2d.jl | 18 ++++++------- examples/fsi/dam_break_plate_2d.jl | 14 +++++----- examples/fsi/falling_rigid_spheres_2d.jl | 22 ++++++++-------- .../fsi/falling_rotating_rigid_squares_2d.jl | 14 +++++----- examples/fsi/falling_spheres_2d.jl | 18 ++++++------- examples/fsi/falling_water_column_2d.jl | 4 +-- examples/fsi/hydrostatic_water_column_2d.jl | 22 +++++++++------- examples/preprocessing/packing_2d.jl | 10 +++---- .../structure/colliding_rigid_spheres_2d.jl | 8 +++--- examples/structure/oscillating_beam_2d.jl | 5 ++-- 25 files changed, 136 insertions(+), 130 deletions(-) diff --git a/examples/dem/collapsing_sand_pile_3d.jl b/examples/dem/collapsing_sand_pile_3d.jl index f463ac2417..d0f2f84054 100644 --- a/examples/dem/collapsing_sand_pile_3d.jl +++ b/examples/dem/collapsing_sand_pile_3d.jl @@ -65,8 +65,8 @@ contact_model = LinearContactModel(1e6) damping_coefficient = 0.00001 sand_system = DEMSystem(sand_particles, contact_model; - damping_coefficient=damping_coefficient, - acceleration=acceleration, radius=0.4 * particle_spacing) + damping_coefficient, + acceleration, radius=0.4 * particle_spacing) boundary_stiffness = 1.0e5 boundary_system = BoundaryDEMSystem(boundary_particles, boundary_stiffness) diff --git a/examples/fluid/dam_break_2d.jl b/examples/fluid/dam_break_2d.jl index b6821086bb..3eb90d1dbc 100644 --- a/examples/fluid/dam_break_2d.jl +++ b/examples/fluid/dam_break_2d.jl @@ -44,9 +44,9 @@ sound_speed = 20 * sqrt(gravity * H) state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1, clip_negative_pressure=false) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, - acceleration=(0.0, -gravity), state_equation=state_equation, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, + acceleration=(0.0, -gravity), state_equation, coordinates_eltype=Float64) # ========================================================================================== @@ -81,9 +81,9 @@ viscosity_wall = nothing # For a no-slip boundary condition, define a wall viscosity: # viscosity_wall = viscosity_fluid boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, boundary_density_calculator, - smoothing_kernel, smoothing_length, + smoothing_kernel, smoothing_length; + state_equation, correction=nothing, reference_particle_spacing=0, viscosity=viscosity_wall) diff --git a/examples/fluid/dam_break_3d.jl b/examples/fluid/dam_break_3d.jl index 44fb1b3c3f..4282b69a20 100644 --- a/examples/fluid/dam_break_3d.jl +++ b/examples/fluid/dam_break_3d.jl @@ -33,9 +33,9 @@ fluid_density = 1000.0 state_equation = StateEquationAdaptiveCole(; reference_density=fluid_density, exponent=7) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, - acceleration=(0.0, -gravity, 0.0), state_equation=state_equation, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, + acceleration=(0.0, -gravity, 0.0), state_equation, coordinates_eltype=Float64) # ========================================================================================== @@ -57,8 +57,9 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; # ==== Boundary boundary_density_calculator = AdamiPressureExtrapolation() boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation, boundary_density_calculator, - smoothing_kernel, smoothing_length) + boundary_density_calculator, + smoothing_kernel, smoothing_length; + state_equation) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) diff --git a/examples/fluid/dam_break_oil_film_2d.jl b/examples/fluid/dam_break_oil_film_2d.jl index 56f944f64b..04c2c7dfa3 100644 --- a/examples/fluid/dam_break_oil_film_2d.jl +++ b/examples/fluid/dam_break_oil_film_2d.jl @@ -71,8 +71,8 @@ oil_system = WeaklyCompressibleSPHSystem(oil; reference_particle_spacing=fluid_particle_spacing) # oil_system = WeaklyCompressibleSPHSystem(oil; -# smoothing_kernel=smoothing_kernel, -# smoothing_length=smoothing_length, +# smoothing_kernel, +# smoothing_length, # density_calculator=fluid_density_calculator, # state_equation=oil_eos, # viscosity=oil_viscosity, diff --git a/examples/fluid/falling_water_column_2d.jl b/examples/fluid/falling_water_column_2d.jl index 92dac295ad..f845f1ec5f 100644 --- a/examples/fluid/falling_water_column_2d.jl +++ b/examples/fluid/falling_water_column_2d.jl @@ -29,8 +29,8 @@ sound_speed = 10 * sqrt(gravity * initial_fluid_size[2]) state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=7) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio) +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio) # Move water column for i in axes(tank.fluid.coordinates, 2) @@ -55,8 +55,9 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; # ==== Boundary boundary_density_calculator = AdamiPressureExtrapolation() boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation, boundary_density_calculator, - smoothing_kernel, smoothing_length) + boundary_density_calculator, + smoothing_kernel, smoothing_length; + state_equation) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index 12a4c534ea..4fd4832315 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -30,10 +30,10 @@ sound_speed = 100 state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation=state_equation) + acceleration=(0.0, -gravity), state_equation) sphere_radius = 0.05 @@ -79,8 +79,9 @@ sphere = WeaklyCompressibleSPHSystem(sphere2; boundary_density_calculator = AdamiPressureExtrapolation() wall_viscosity = nu boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation, boundary_density_calculator, - fluid_smoothing_kernel, fluid_smoothing_length, + boundary_density_calculator, + fluid_smoothing_kernel, fluid_smoothing_length; + state_equation, viscosity=ViscosityAdami(nu=wall_viscosity), reference_particle_spacing=fluid_particle_spacing) diff --git a/examples/fluid/hydrostatic_water_column_2d.jl b/examples/fluid/hydrostatic_water_column_2d.jl index a04dd51475..a3818a0067 100644 --- a/examples/fluid/hydrostatic_water_column_2d.jl +++ b/examples/fluid/hydrostatic_water_column_2d.jl @@ -29,9 +29,9 @@ sound_speed = 10.0 state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=7, clip_negative_pressure=false) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; n_layers=boundary_layers, acceleration=(0.0, -gravity), - state_equation=state_equation) + state_equation) # ========================================================================================== # ==== Fluid @@ -61,9 +61,9 @@ boundary_density_calculator = AdamiPressureExtrapolation() # This is to set wall viscosity with `trixi_include` viscosity_wall = nothing boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, boundary_density_calculator, - smoothing_kernel, smoothing_length, + smoothing_kernel, smoothing_length; + state_equation, viscosity=viscosity_wall) boundary_system = WallBoundarySystem(tank.boundary, boundary_model, prescribed_motion=nothing) diff --git a/examples/fluid/lid_driven_cavity_2d.jl b/examples/fluid/lid_driven_cavity_2d.jl index f587cfda05..78b31034aa 100644 --- a/examples/fluid/lid_driven_cavity_2d.jl +++ b/examples/fluid/lid_driven_cavity_2d.jl @@ -41,9 +41,9 @@ pressure = sound_speed^2 * fluid_density viscosity = ViscosityAdami(; nu=VELOCITY_LID / reynolds_number) -cavity = RectangularTank(particle_spacing, cavity_size, cavity_size, fluid_density, +cavity = RectangularTank(particle_spacing, cavity_size, cavity_size, fluid_density; n_layers=boundary_layers, - faces=(true, true, true, false), pressure=pressure) + faces=(true, true, true, false), pressure) lid_position = 0.0 - particle_spacing * boundary_layers lid_length = cavity.n_particles_per_dimension[1] + 2boundary_layers @@ -71,11 +71,11 @@ else state_equation = nothing density_calculator = ContinuityDensity() fluid_system = EntropicallyDampedSPHSystem(cavity.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - density_calculator=density_calculator, - sound_speed=sound_speed, - viscosity=viscosity, + smoothing_kernel, + smoothing_length, + density_calculator, + sound_speed, + viscosity, shifting_technique=TransportVelocityAdami(background_pressure=pressure)) end @@ -91,15 +91,15 @@ lid_movement = PrescribedMotion(lid_movement_function, is_moving) boundary_model_cavity = BoundaryModelDummyParticles(cavity.boundary.density, cavity.boundary.mass, AdamiPressureExtrapolation(), - viscosity=viscosity, - state_equation=state_equation, - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + viscosity, + state_equation) boundary_model_lid = BoundaryModelDummyParticles(lid.density, lid.mass, AdamiPressureExtrapolation(), - viscosity=viscosity, - state_equation=state_equation, - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + viscosity, + state_equation) boundary_system_cavity = WallBoundarySystem(cavity.boundary, boundary_model_cavity) diff --git a/examples/fluid/moving_wall_2d.jl b/examples/fluid/moving_wall_2d.jl index a5ad400235..44f0de9892 100644 --- a/examples/fluid/moving_wall_2d.jl +++ b/examples/fluid/moving_wall_2d.jl @@ -29,9 +29,9 @@ sound_speed = 10 * sqrt(gravity * initial_fluid_size[2]) state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=7) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; n_layers=boundary_layers, spacing_ratio=1.0, - acceleration=(0.0, -gravity), state_equation=state_equation) + acceleration=(0.0, -gravity), state_equation) reset_wall!(tank, (false, true, false, false), (0.0, tank.fluid_size[1], 0.0, 0.0)) @@ -61,8 +61,9 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; # ==== Boundary boundary_density_calculator = AdamiPressureExtrapolation() boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation, boundary_density_calculator, - smoothing_kernel, smoothing_length) + boundary_density_calculator, + smoothing_kernel, smoothing_length; + state_equation) boundary_system = WallBoundarySystem(tank.boundary, boundary_model, prescribed_motion=boundary_movement) diff --git a/examples/fluid/periodic_array_of_cylinders_2d.jl b/examples/fluid/periodic_array_of_cylinders_2d.jl index 1c36a5e4be..0aefb88d62 100644 --- a/examples/fluid/periodic_array_of_cylinders_2d.jl +++ b/examples/fluid/periodic_array_of_cylinders_2d.jl @@ -47,8 +47,8 @@ pressure = sound_speed^2 * fluid_density particle_spacing = tank_size[1] / n_particles_x box = RectangularTank(particle_spacing, fluid_size, tank_size, - fluid_density, n_layers=boundary_layers, - pressure=pressure, faces=(false, false, true, true)) + fluid_density; n_layers=boundary_layers, + pressure, faces=(false, false, true, true)) cylinder = SphereShape(particle_spacing, cylinder_radius, tank_size ./ 2, fluid_density, sphere_type=RoundSphere()) diff --git a/examples/fluid/periodic_channel_2d.jl b/examples/fluid/periodic_channel_2d.jl index 42aa22ba53..3b85e54124 100644 --- a/examples/fluid/periodic_channel_2d.jl +++ b/examples/fluid/periodic_channel_2d.jl @@ -32,8 +32,8 @@ sound_speed = 10 * initial_velocity[1] state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=7) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, faces=(false, false, true, true), velocity=initial_velocity, coordinates_eltype=Float64) @@ -61,8 +61,9 @@ viscosity_wall = nothing #viscosity_wall = ViscosityAdami(nu=0.0025 * smoothing_length * sound_speed / 8) boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation, boundary_density_calculator, - smoothing_kernel, smoothing_length, + boundary_density_calculator, + smoothing_kernel, smoothing_length; + state_equation, viscosity=viscosity_wall) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) diff --git a/examples/fluid/pipe_flow_2d.jl b/examples/fluid/pipe_flow_2d.jl index 469839bb4d..20ea499a24 100644 --- a/examples/fluid/pipe_flow_2d.jl +++ b/examples/fluid/pipe_flow_2d.jl @@ -147,9 +147,9 @@ wall = union(pipe.boundary, inlet.boundary, outlet.boundary) viscosity_boundary = viscosity boundary_model = BoundaryModelDummyParticles(wall.density, wall.mass, AdamiPressureExtrapolation(), - state_equation=state_equation, - viscosity=viscosity_boundary, - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation, + viscosity=viscosity_boundary) boundary_system = WallBoundarySystem(wall, boundary_model) diff --git a/examples/fluid/poiseuille_flow_2d.jl b/examples/fluid/poiseuille_flow_2d.jl index a94c1c177b..7ee58ae923 100644 --- a/examples/fluid/poiseuille_flow_2d.jl +++ b/examples/fluid/poiseuille_flow_2d.jl @@ -111,7 +111,7 @@ else smoothing_kernel, smoothing_length, sound_speed, viscosity, density_calculator=fluid_density_calculator, - shifting_technique=shifting_technique, + shifting_technique, buffer_size=n_buffer_particles) end @@ -157,9 +157,9 @@ wall_boundary = union(channel.boundary) boundary_model = BoundaryModelDummyParticles(wall_boundary.density, wall_boundary.mass, AdamiPressureExtrapolation(), - state_equation=state_equation, - viscosity=viscosity, - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation, + viscosity) boundary_system = WallBoundarySystem(wall_boundary, boundary_model) diff --git a/examples/fluid/poiseuille_flow_3d.jl b/examples/fluid/poiseuille_flow_3d.jl index 88f9e327f9..4fe9a5a2c0 100644 --- a/examples/fluid/poiseuille_flow_3d.jl +++ b/examples/fluid/poiseuille_flow_3d.jl @@ -170,9 +170,9 @@ open_boundary = OpenBoundarySystem(inlet_zone, outlet_zone; fluid_system, # ==== Boundary boundary_model = BoundaryModelDummyParticles(wall_boundary.density, wall_boundary.mass, AdamiPressureExtrapolation(), - state_equation=state_equation, - viscosity=viscosity, - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation, + viscosity) boundary_system = WallBoundarySystem(wall_boundary, boundary_model) @@ -187,8 +187,8 @@ neighborhood_search = GridNeighborhoodSearch{3}(; update_strategy=ParallelUpdate()) semi = Semidiscretization(fluid_system, open_boundary, - boundary_system, - neighborhood_search=neighborhood_search, + boundary_system; + neighborhood_search, parallelization_backend=PolyesterBackend()) ode_problem = semidiscretize(semi, tspan) diff --git a/examples/fluid/sphere_surface_tension_2d.jl b/examples/fluid/sphere_surface_tension_2d.jl index 6208e875b8..17c989eb45 100644 --- a/examples/fluid/sphere_surface_tension_2d.jl +++ b/examples/fluid/sphere_surface_tension_2d.jl @@ -54,7 +54,7 @@ source_terms = SourceTermDamping(; damping_coefficient=0.5) fluid_system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length, sound_speed, - viscosity=ViscosityMorris(nu=nu), + viscosity=ViscosityMorris(; nu), density_calculator=ContinuityDensity(), reference_particle_spacing=particle_spacing, acceleration=zeros(length(fluid_size)), diff --git a/examples/fsi/dam_break_gate_2d.jl b/examples/fsi/dam_break_gate_2d.jl index 74a22ed5a5..b2008c4d9b 100644 --- a/examples/fsi/dam_break_gate_2d.jl +++ b/examples/fsi/dam_break_gate_2d.jl @@ -47,9 +47,9 @@ sound_speed = 10 * sqrt(2 * gravity * initial_fluid_size[2]) state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=7) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, - acceleration=(0.0, -gravity), state_equation=state_equation, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, + acceleration=(0.0, -gravity), state_equation, coordinates_eltype=Float64) # Make the gate slightly higher than the fluid @@ -120,14 +120,14 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; # ==== Boundary boundary_density_calculator = AdamiPressureExtrapolation() boundary_model_tank = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, boundary_density_calculator, - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation) boundary_model_gate = BoundaryModelDummyParticles(gate.density, gate.mass, - state_equation=state_equation, boundary_density_calculator, - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation) boundary_system_tank = WallBoundarySystem(tank.boundary, boundary_model_tank) boundary_system_gate = WallBoundarySystem(gate, boundary_model_gate, @@ -144,9 +144,9 @@ hydrodynamic_masses = hydrodynamic_densites * structure_particle_spacing^2 boundary_model_structure = BoundaryModelDummyParticles(hydrodynamic_densites, hydrodynamic_masses, - state_equation=state_equation, AdamiPressureExtrapolation(), - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation) structure_system = TotalLagrangianSPHSystem(structure, structure_smoothing_kernel, diff --git a/examples/fsi/dam_break_plate_2d.jl b/examples/fsi/dam_break_plate_2d.jl index 50b48507d4..0d00e209f1 100644 --- a/examples/fsi/dam_break_plate_2d.jl +++ b/examples/fsi/dam_break_plate_2d.jl @@ -37,9 +37,9 @@ sound_speed = 20 * sqrt(gravity * initial_fluid_size[2]) state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, - acceleration=(0.0, -gravity), state_equation=state_equation) +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, + acceleration=(0.0, -gravity), state_equation) # Elastic plate/beam length_beam = 0.08 @@ -90,9 +90,9 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; # ==== Boundary boundary_density_calculator = AdamiPressureExtrapolation() boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, boundary_density_calculator, - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) @@ -120,9 +120,9 @@ boundary_model_structure = BoundaryModelMonaghanKajtar(k_structure, spacing_rati # # boundary_model_structure = BoundaryModelDummyParticles(hydrodynamic_densites, # hydrodynamic_masses, -# state_equation=state_equation, # boundary_density_calculator, -# smoothing_kernel, smoothing_length) +# smoothing_kernel, smoothing_length; +# state_equation) structure_system = TotalLagrangianSPHSystem(structure, structure_smoothing_kernel, diff --git a/examples/fsi/falling_rigid_spheres_2d.jl b/examples/fsi/falling_rigid_spheres_2d.jl index 1c90da1680..83afe80286 100644 --- a/examples/fsi/falling_rigid_spheres_2d.jl +++ b/examples/fsi/falling_rigid_spheres_2d.jl @@ -30,10 +30,10 @@ sound_speed = 100.0 state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation=state_equation) + acceleration=(0.0, -gravity), state_equation) sphere1_radius = 0.3 sphere2_radius = 0.2 @@ -69,9 +69,9 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; # ==== Boundary boundary_density_calculator = AdamiPressureExtrapolation() boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, boundary_density_calculator, - fluid_smoothing_kernel, fluid_smoothing_length) + fluid_smoothing_kernel, fluid_smoothing_length; + state_equation) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) @@ -84,10 +84,10 @@ hydrodynamic_masses_1 = hydrodynamic_densities_1 * boundary_model_structure_1 = BoundaryModelDummyParticles(hydrodynamic_densities_1, hydrodynamic_masses_1, - state_equation=state_equation, boundary_density_calculator, fluid_smoothing_kernel, - fluid_smoothing_length) + fluid_smoothing_length; + state_equation) hydrodynamic_densities_2 = fluid_density * ones(size(sphere2.density)) hydrodynamic_masses_2 = hydrodynamic_densities_2 * @@ -95,10 +95,10 @@ hydrodynamic_masses_2 = hydrodynamic_densities_2 * boundary_model_structure_2 = BoundaryModelDummyParticles(hydrodynamic_densities_2, hydrodynamic_masses_2, - state_equation=state_equation, boundary_density_calculator, fluid_smoothing_kernel, - fluid_smoothing_length) + fluid_smoothing_length; + state_equation) # Basic rigid contact model used for both rigid bodies. contact_model = RigidContactModel(; normal_stiffness=2.0e5, @@ -108,12 +108,12 @@ contact_model = RigidContactModel(; normal_stiffness=2.0e5, structure_system_1 = RigidBodySystem(sphere1; boundary_model=boundary_model_structure_1, - contact_model=contact_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) structure_system_2 = RigidBodySystem(sphere2; boundary_model=boundary_model_structure_2, - contact_model=contact_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) diff --git a/examples/fsi/falling_rotating_rigid_squares_2d.jl b/examples/fsi/falling_rotating_rigid_squares_2d.jl index 669958d73b..517e8f672f 100644 --- a/examples/fsi/falling_rotating_rigid_squares_2d.jl +++ b/examples/fsi/falling_rotating_rigid_squares_2d.jl @@ -31,10 +31,10 @@ sound_speed = 100.0 state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation=state_equation) + acceleration=(0.0, -gravity), state_equation) square1_side_length = 0.4 square2_side_length = 0.3 @@ -85,9 +85,9 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; # ==== Boundary boundary_density_calculator = AdamiPressureExtrapolation() boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, boundary_density_calculator, - fluid_smoothing_kernel, fluid_smoothing_length) + fluid_smoothing_kernel, fluid_smoothing_length; + state_equation) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) @@ -101,10 +101,10 @@ function structure_boundary_model(shape) return BoundaryModelDummyParticles(hydrodynamic_densities, hydrodynamic_masses, - state_equation=state_equation, boundary_density_calculator, fluid_smoothing_kernel, - fluid_smoothing_length) + fluid_smoothing_length; + state_equation) end boundary_model_structure_1 = structure_boundary_model(square1) diff --git a/examples/fsi/falling_spheres_2d.jl b/examples/fsi/falling_spheres_2d.jl index e4ff550f00..3bfebf380e 100644 --- a/examples/fsi/falling_spheres_2d.jl +++ b/examples/fsi/falling_spheres_2d.jl @@ -31,10 +31,10 @@ sound_speed = 10 * sqrt(gravity * initial_fluid_size[2]) state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation=state_equation) + acceleration=(0.0, -gravity), state_equation) sphere1_radius = 0.3 sphere2_radius = 0.2 @@ -73,9 +73,9 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; # ==== Boundary boundary_density_calculator = BernoulliPressureExtrapolation() boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, boundary_density_calculator, - fluid_smoothing_kernel, fluid_smoothing_length) + fluid_smoothing_kernel, fluid_smoothing_length; + state_equation) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) @@ -91,10 +91,10 @@ hydrodynamic_masses_1 = hydrodynamic_densites_1 * structure_boundary_model_1 = BoundaryModelDummyParticles(hydrodynamic_densites_1, hydrodynamic_masses_1, - state_equation=state_equation, boundary_density_calculator, fluid_smoothing_kernel, - fluid_smoothing_length) + fluid_smoothing_length; + state_equation) hydrodynamic_densites_2 = fluid_density * ones(size(sphere2.density)) hydrodynamic_masses_2 = hydrodynamic_densites_2 * @@ -102,10 +102,10 @@ hydrodynamic_masses_2 = hydrodynamic_densites_2 * structure_boundary_model_2 = BoundaryModelDummyParticles(hydrodynamic_densites_2, hydrodynamic_masses_2, - state_equation=state_equation, boundary_density_calculator, fluid_smoothing_kernel, - fluid_smoothing_length) + fluid_smoothing_length; + state_equation) structure_system_1 = TotalLagrangianSPHSystem(sphere1, structure_smoothing_kernel, diff --git a/examples/fsi/falling_water_column_2d.jl b/examples/fsi/falling_water_column_2d.jl index 539b44eeb8..2af0f77915 100644 --- a/examples/fsi/falling_water_column_2d.jl +++ b/examples/fsi/falling_water_column_2d.jl @@ -68,8 +68,8 @@ boundary_model = BoundaryModelMonaghanKajtar(k, spacing_ratio, particle_spacing, structure_system = TotalLagrangianSPHSystem(structure, smoothing_kernel, smoothing_length, - material.E, material.nu, - boundary_model=boundary_model, + material.E, material.nu; + boundary_model, clamped_particles=1:nparticles(clamped_particles), acceleration=(0.0, -gravity)) diff --git a/examples/fsi/hydrostatic_water_column_2d.jl b/examples/fsi/hydrostatic_water_column_2d.jl index 3f340a0005..1d8ca6ce9e 100644 --- a/examples/fsi/hydrostatic_water_column_2d.jl +++ b/examples/fsi/hydrostatic_water_column_2d.jl @@ -86,12 +86,13 @@ state_equation = use_edac ? nothing : exponent=7, clip_negative_pressure=false) tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, (plate_size[1], 3.0), + fluid_density; min_coordinates=(0.0, fluid_particle_spacing / 2), - fluid_density, n_layers=boundary_layers, - spacing_ratio=spacing_ratio, + n_layers=boundary_layers, + spacing_ratio, faces=(true, true, false, false), acceleration=(0.0, -gravity), - state_equation=state_equation) + state_equation) if use_edac fluid_system = EntropicallyDampedSPHSystem(tank.fluid; @@ -115,19 +116,20 @@ else end boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, boundary_density_calculator, - smoothing_kernel, smoothing_length_fluid) + smoothing_kernel, smoothing_length_fluid; + state_equation) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) boundary_model_structure = BoundaryModelDummyParticles(hydrodynamic_densities, hydrodynamic_masses, - state_equation=state_equation, boundary_density_calculator, smoothing_kernel, - smoothing_length_structure) + smoothing_length_structure; + state_equation) structure_system = TotalLagrangianSPHSystem(structure_geometry, smoothing_kernel, smoothing_length_structure, - E, nu, boundary_model=boundary_model_structure, + E, nu; + boundary_model=boundary_model_structure, n_clamped_particles=nparticles(fixed_particles), acceleration=(0.0, -gravity)) @@ -141,8 +143,8 @@ max_corner = max.(maximum(structure_geometry.coordinates, dims=2), cell_list = FullGridCellList(; min_corner, max_corner) neighborhood_search = GridNeighborhoodSearch{2}(; update_strategy=ParallelUpdate(), cell_list) -semi = Semidiscretization(structure_system, fluid_system, boundary_system, - neighborhood_search=neighborhood_search, +semi = Semidiscretization(structure_system, fluid_system, boundary_system; + neighborhood_search, parallelization_backend=PolyesterBackend()) ode = semidiscretize(semi, tspan) diff --git a/examples/preprocessing/packing_2d.jl b/examples/preprocessing/packing_2d.jl index 0975b6e2ad..15ab94dc81 100644 --- a/examples/preprocessing/packing_2d.jl +++ b/examples/preprocessing/packing_2d.jl @@ -50,7 +50,7 @@ shape_sampled = ComplexShape(geometry; particle_spacing, density, # Returns `InitialCondition` boundary_sampled = sample_boundary(signed_distance_field; boundary_density=density, - boundary_thickness, place_on_shell=place_on_shell) + boundary_thickness, place_on_shell) trixi2vtk(shape_sampled) trixi2vtk(boundary_sampled, filename="boundary") @@ -65,13 +65,13 @@ trixi2vtk(boundary_sampled, filename="boundary") background_pressure = 1.0 smoothing_length = 0.8 * particle_spacing -packing_system = ParticlePackingSystem(shape_sampled; smoothing_length=smoothing_length, - signed_distance_field, place_on_shell=place_on_shell, +packing_system = ParticlePackingSystem(shape_sampled; smoothing_length, + signed_distance_field, place_on_shell, background_pressure) -boundary_system = ParticlePackingSystem(boundary_sampled; smoothing_length=smoothing_length, +boundary_system = ParticlePackingSystem(boundary_sampled; smoothing_length, is_boundary=true, signed_distance_field, - place_on_shell=place_on_shell, + place_on_shell, boundary_compress_factor=0.8, background_pressure) diff --git a/examples/structure/colliding_rigid_spheres_2d.jl b/examples/structure/colliding_rigid_spheres_2d.jl index 6bfa1877d1..90927d0cb3 100644 --- a/examples/structure/colliding_rigid_spheres_2d.jl +++ b/examples/structure/colliding_rigid_spheres_2d.jl @@ -37,13 +37,13 @@ contact_model = RigidContactModel(; normal_stiffness=2.0e4, contact_distance=2.0 * particle_spacing) structure_system_1 = RigidBodySystem(sphere_1; - contact_model=contact_model, + contact_model, acceleration=(0.0, 0.0), - particle_spacing=particle_spacing) + particle_spacing) structure_system_2 = RigidBodySystem(sphere_2; - contact_model=contact_model, + contact_model, acceleration=(0.0, 0.0), - particle_spacing=particle_spacing) + particle_spacing) # ========================================================================================== # ==== Simulation diff --git a/examples/structure/oscillating_beam_2d.jl b/examples/structure/oscillating_beam_2d.jl index b48a10bcbf..12688f46f6 100644 --- a/examples/structure/oscillating_beam_2d.jl +++ b/examples/structure/oscillating_beam_2d.jl @@ -96,9 +96,8 @@ function deflection_y(system, data, t) return data.coordinates[2, middle_particle_id] - STARTPOSITION_Y end -saving_callback = SolutionSavingCallback(dt=0.02, prefix="", - deflection_x=deflection_x, - deflection_y=deflection_y) +saving_callback = SolutionSavingCallback(dt=0.02, prefix=""; + deflection_x, deflection_y) callbacks = CallbackSet(info_callback, saving_callback) From 927fcdd96f7821c0f68d26cdc1f9b37b21e5bfae Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Wed, 22 Apr 2026 14:39:17 +0200 Subject: [PATCH 06/56] Refactor constructors to use keyword arguments for DEM and SPH systems --- examples/dem/collapsing_sand_pile_3d.jl | 4 +-- examples/dem/rectangular_tank_2d.jl | 4 +-- examples/fluid/dam_break_2d_gpu.jl | 16 +++++----- examples/fluid/dam_break_2d_iisph.jl | 26 ++++++++------- .../dam_break_2d_iisph_pressure_boundaries.jl | 27 ++++++++-------- examples/fluid/pipe_flow_3d.jl | 12 +++---- examples/fsi/dam_break_gate_2d.jl | 10 +++--- examples/fsi/dam_break_plate_2d.jl | 10 +++--- examples/fsi/falling_spheres_2d.jl | 18 ++++++----- examples/fsi/falling_water_column_2d.jl | 8 +++-- examples/fsi/hydrostatic_water_column_2d.jl | 8 +++-- examples/structure/oscillating_beam_2d.jl | 7 ++-- src/schemes/boundary/dem_boundary/system.jl | 13 +++++++- .../implicit_incompressible_sph/system.jl | 32 +++++++++++++------ .../discrete_element_method/system.jl | 14 ++++++-- .../structure/total_lagrangian_sph/system.jl | 27 ++++++++++++---- 16 files changed, 149 insertions(+), 87 deletions(-) diff --git a/examples/dem/collapsing_sand_pile_3d.jl b/examples/dem/collapsing_sand_pile_3d.jl index d0f2f84054..1c5b7087be 100644 --- a/examples/dem/collapsing_sand_pile_3d.jl +++ b/examples/dem/collapsing_sand_pile_3d.jl @@ -64,12 +64,12 @@ boundary_particles = floor_particles contact_model = LinearContactModel(1e6) damping_coefficient = 0.00001 -sand_system = DEMSystem(sand_particles, contact_model; +sand_system = DEMSystem(sand_particles; contact_model, damping_coefficient, acceleration, radius=0.4 * particle_spacing) boundary_stiffness = 1.0e5 -boundary_system = BoundaryDEMSystem(boundary_particles, boundary_stiffness) +boundary_system = BoundaryDEMSystem(boundary_particles; normal_stiffness=boundary_stiffness) # ========================================================================================== # ==== Simulation diff --git a/examples/dem/rectangular_tank_2d.jl b/examples/dem/rectangular_tank_2d.jl index 5c53f16562..331f695a9d 100644 --- a/examples/dem/rectangular_tank_2d.jl +++ b/examples/dem/rectangular_tank_2d.jl @@ -47,11 +47,11 @@ contact_model = HertzContactModel(10e9, 0.3) # contact_model = LinearContactModel(2 * 10e5) # Construct the rock system using the new DEMSystem signature. -rock_system = DEMSystem(tank.fluid, contact_model; damping_coefficient=0.0001, +rock_system = DEMSystem(tank.fluid; contact_model, damping_coefficient=0.0001, acceleration=(0.0, gravity), radius=0.4 * particle_spacing) # Construct the boundary system for the tank walls. -boundary_system = BoundaryDEMSystem(tank.boundary, 10e7) +boundary_system = BoundaryDEMSystem(tank.boundary; normal_stiffness=10e7) # ========================================================================================== # ==== Simulation diff --git a/examples/fluid/dam_break_2d_gpu.jl b/examples/fluid/dam_break_2d_gpu.jl index dd0b140419..9ab9b5c3d2 100644 --- a/examples/fluid/dam_break_2d_gpu.jl +++ b/examples/fluid/dam_break_2d_gpu.jl @@ -34,13 +34,13 @@ neighborhood_search = GridNeighborhoodSearch{2}(; cell_list) # Run the dam break simulation with this neighborhood search trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), - neighborhood_search=neighborhood_search, - fluid_particle_spacing=fluid_particle_spacing, - tspan=tspan, smoothing_length=smoothing_length, - density_diffusion=density_diffusion, - boundary_layers=boundary_layers, spacing_ratio=spacing_ratio, - boundary_model=boundary_model, + joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + neighborhood_search, + fluid_particle_spacing, + tspan, smoothing_length, + density_diffusion, + boundary_layers, spacing_ratio, + boundary_model, parallelization_backend=PolyesterBackend(), - boundary_density_calculator=boundary_density_calculator, + boundary_density_calculator, coordinates_eltype=Float64) diff --git a/examples/fluid/dam_break_2d_iisph.jl b/examples/fluid/dam_break_2d_iisph.jl index 9c2ba6f224..e6421c737c 100644 --- a/examples/fluid/dam_break_2d_iisph.jl +++ b/examples/fluid/dam_break_2d_iisph.jl @@ -5,8 +5,8 @@ fluid_particle_spacing = 0.6 / 40 # Load setup from dam break example trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), - fluid_particle_spacing=fluid_particle_spacing, + joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + fluid_particle_spacing, sol=nothing, ode=nothing) # IISPH doesn't require a large compact support like WCSPH and performs worse with a typical @@ -26,24 +26,26 @@ viscosity = ViscosityAdami(; nu) # Use IISPH as fluid system time_step = 1e-3 -fluid_system = ImplicitIncompressibleSPHSystem(tank.fluid, smoothing_kernel, - smoothing_length, fluid_density, - viscosity=ViscosityAdami(nu=nu), +fluid_system = ImplicitIncompressibleSPHSystem(tank.fluid; + smoothing_kernel, + smoothing_length, + reference_density=fluid_density, + viscosity, acceleration=(0.0, -gravity), min_iterations=2, max_iterations=30, - time_step=time_step) + time_step) # Run the dam break simulation with these changes trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), + joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); neighborhood_search=GridNeighborhoodSearch{2}(), - viscosity_fluid=ViscosityAdami(nu=nu), - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - fluid_system=fluid_system, + viscosity_fluid=viscosity, + smoothing_kernel, + smoothing_length, + fluid_system, boundary_density_calculator=PressureZeroing(), - tspan=tspan, + tspan, state_equation=nothing, callbacks=CallbackSet(info_callback, saving_callback), time_integration_scheme=SymplecticEuler(), dt=time_step) diff --git a/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl b/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl index 86f9e6cde9..10421762f0 100644 --- a/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl +++ b/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl @@ -3,7 +3,7 @@ using TrixiParticles # Load setup from dam break example trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), + joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); sol=nothing, ode=nothing) # Change smoothing kernel and length @@ -19,25 +19,26 @@ time_step = 1e-3 # Reduce omega when using pressure boundaries to ensure numerical stability omega = 0.4 -iisph_system = ImplicitIncompressibleSPHSystem(tank.fluid, smoothing_kernel, - smoothing_length, fluid_density, - viscosity=ViscosityAdami(nu=nu), +iisph_system = ImplicitIncompressibleSPHSystem(tank.fluid; + smoothing_kernel, + smoothing_length, + reference_density=fluid_density, + viscosity, acceleration=(0.0, -gravity), min_iterations=2, max_iterations=30, - omega=omega, - time_step=time_step) + omega, + time_step) # Run the dam break simulation with these changes trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), - viscosity_fluid=ViscosityAdami(nu=nu), - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + viscosity_fluid=viscosity, + smoothing_kernel, + smoothing_length, fluid_system=iisph_system, - boundary_density_calculator=PressureBoundaries(; time_step=time_step, - omega=omega), - tspan=tspan, + boundary_density_calculator=PressureBoundaries(; time_step, omega), + tspan, state_equation=nothing, callbacks=CallbackSet(info_callback, saving_callback), time_integration_scheme=SymplecticEuler(), dt=time_step) diff --git a/examples/fluid/pipe_flow_3d.jl b/examples/fluid/pipe_flow_3d.jl index a0f16b57a6..fad9b580f3 100644 --- a/examples/fluid/pipe_flow_3d.jl +++ b/examples/fluid/pipe_flow_3d.jl @@ -34,12 +34,12 @@ min_coords_inlet = (-open_boundary_layers * particle_spacing, 0.0, 0.0) min_coords_outlet = (-open_boundary_layers * particle_spacing, 0.0, 0.0) # setup simulation -trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "pipe_flow_2d.jl"), - domain_size=domain_size, open_boundary_size=open_boundary_size, - flow_direction=flow_direction, faces=(false, false, true, true, true, true), - tspan=tspan, prescribed_velocity=prescribed_velocity, - open_boundary_layers=open_boundary_layers, min_coords_inlet=min_coords_inlet, - min_coords_outlet=min_coords_outlet, +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "pipe_flow_2d.jl"); + domain_size, open_boundary_size, + flow_direction, faces=(false, false, true, true, true, true), + tspan, prescribed_velocity, + open_boundary_layers, min_coords_inlet, + min_coords_outlet, face_in=([0.0, 0.0, 0.0], [0.0, domain_size[2], 0.0], [0.0, 0.0, domain_size[3]]), face_out=([domain_size[1], 0.0, 0.0], [domain_size[1], domain_size[2], 0.0], diff --git a/examples/fsi/dam_break_gate_2d.jl b/examples/fsi/dam_break_gate_2d.jl index b2008c4d9b..3aa0f92479 100644 --- a/examples/fsi/dam_break_gate_2d.jl +++ b/examples/fsi/dam_break_gate_2d.jl @@ -148,10 +148,12 @@ boundary_model_structure = BoundaryModelDummyParticles(hydrodynamic_densites, smoothing_kernel, smoothing_length; state_equation) -structure_system = TotalLagrangianSPHSystem(structure, - structure_smoothing_kernel, - structure_smoothing_length, - E, nu, boundary_model=boundary_model_structure, +structure_system = TotalLagrangianSPHSystem(structure; + smoothing_kernel=structure_smoothing_kernel, + smoothing_length=structure_smoothing_length, + young_modulus=E, + poisson_ratio=nu, + boundary_model=boundary_model_structure, clamped_particles=1:nparticles(clamped_particles), acceleration=(0.0, -gravity)) diff --git a/examples/fsi/dam_break_plate_2d.jl b/examples/fsi/dam_break_plate_2d.jl index 0d00e209f1..bb2e2ec1dc 100644 --- a/examples/fsi/dam_break_plate_2d.jl +++ b/examples/fsi/dam_break_plate_2d.jl @@ -124,10 +124,12 @@ boundary_model_structure = BoundaryModelMonaghanKajtar(k_structure, spacing_rati # smoothing_kernel, smoothing_length; # state_equation) -structure_system = TotalLagrangianSPHSystem(structure, - structure_smoothing_kernel, - structure_smoothing_length, - E, nu, boundary_model=boundary_model_structure, +structure_system = TotalLagrangianSPHSystem(structure; + smoothing_kernel=structure_smoothing_kernel, + smoothing_length=structure_smoothing_length, + young_modulus=E, + poisson_ratio=nu, + boundary_model=boundary_model_structure, clamped_particles=1:nparticles(clamped_particles), acceleration=(0.0, -gravity), penalty_force=PenaltyForceGanzenmueller(alpha=0.01)) diff --git a/examples/fsi/falling_spheres_2d.jl b/examples/fsi/falling_spheres_2d.jl index 3bfebf380e..2e6397ada8 100644 --- a/examples/fsi/falling_spheres_2d.jl +++ b/examples/fsi/falling_spheres_2d.jl @@ -107,18 +107,20 @@ structure_boundary_model_2 = BoundaryModelDummyParticles(hydrodynamic_densites_2 fluid_smoothing_length; state_equation) -structure_system_1 = TotalLagrangianSPHSystem(sphere1, - structure_smoothing_kernel, - structure_smoothing_length, - sphere1_E, nu, +structure_system_1 = TotalLagrangianSPHSystem(sphere1; + smoothing_kernel=structure_smoothing_kernel, + smoothing_length=structure_smoothing_length, + young_modulus=sphere1_E, + poisson_ratio=nu, acceleration=(0.0, -gravity), boundary_model=structure_boundary_model_1, penalty_force=PenaltyForceGanzenmueller(alpha=0.3)) -structure_system_2 = TotalLagrangianSPHSystem(sphere2, - structure_smoothing_kernel, - structure_smoothing_length, - sphere2_E, nu, +structure_system_2 = TotalLagrangianSPHSystem(sphere2; + smoothing_kernel=structure_smoothing_kernel, + smoothing_length=structure_smoothing_length, + young_modulus=sphere2_E, + poisson_ratio=nu, acceleration=(0.0, -gravity), boundary_model=structure_boundary_model_2, penalty_force=PenaltyForceGanzenmueller(alpha=0.3)) diff --git a/examples/fsi/falling_water_column_2d.jl b/examples/fsi/falling_water_column_2d.jl index 2af0f77915..ac16ab8780 100644 --- a/examples/fsi/falling_water_column_2d.jl +++ b/examples/fsi/falling_water_column_2d.jl @@ -66,9 +66,11 @@ hydrodynamic_masses = hydrodynamic_densites * particle_spacing^2 boundary_model = BoundaryModelMonaghanKajtar(k, spacing_ratio, particle_spacing, hydrodynamic_masses) -structure_system = TotalLagrangianSPHSystem(structure, - smoothing_kernel, smoothing_length, - material.E, material.nu; +structure_system = TotalLagrangianSPHSystem(structure; + smoothing_kernel, + smoothing_length, + young_modulus=material.E, + poisson_ratio=material.nu, boundary_model, clamped_particles=1:nparticles(clamped_particles), acceleration=(0.0, -gravity)) diff --git a/examples/fsi/hydrostatic_water_column_2d.jl b/examples/fsi/hydrostatic_water_column_2d.jl index 1d8ca6ce9e..3b0c9435b8 100644 --- a/examples/fsi/hydrostatic_water_column_2d.jl +++ b/examples/fsi/hydrostatic_water_column_2d.jl @@ -126,9 +126,11 @@ boundary_model_structure = BoundaryModelDummyParticles(hydrodynamic_densities, smoothing_kernel, smoothing_length_structure; state_equation) -structure_system = TotalLagrangianSPHSystem(structure_geometry, smoothing_kernel, - smoothing_length_structure, - E, nu; +structure_system = TotalLagrangianSPHSystem(structure_geometry; + smoothing_kernel, + smoothing_length=smoothing_length_structure, + young_modulus=E, + poisson_ratio=nu, boundary_model=boundary_model_structure, n_clamped_particles=nparticles(fixed_particles), acceleration=(0.0, -gravity)) diff --git a/examples/structure/oscillating_beam_2d.jl b/examples/structure/oscillating_beam_2d.jl index 12688f46f6..11395a4688 100644 --- a/examples/structure/oscillating_beam_2d.jl +++ b/examples/structure/oscillating_beam_2d.jl @@ -60,8 +60,11 @@ structure = union(clamped_particles, beam) smoothing_length = sqrt(2) * particle_spacing smoothing_kernel = WendlandC2Kernel{2}() -structure_system = TotalLagrangianSPHSystem(structure, smoothing_kernel, smoothing_length, - material.E, material.nu, +structure_system = TotalLagrangianSPHSystem(structure; + smoothing_kernel, + smoothing_length, + young_modulus=material.E, + poisson_ratio=material.nu, clamped_particles=1:nparticles(clamped_particles), acceleration=(0.0, -gravity), penalty_force=nothing, viscosity=nothing, diff --git a/src/schemes/boundary/dem_boundary/system.jl b/src/schemes/boundary/dem_boundary/system.jl index 02bfe1b415..81cdf16ffe 100644 --- a/src/schemes/boundary/dem_boundary/system.jl +++ b/src/schemes/boundary/dem_boundary/system.jl @@ -1,9 +1,15 @@ """ - BoundaryDEMSystem(initial_condition, normal_stiffness) + BoundaryDEMSystem(initial_condition; normal_stiffness) System for boundaries modeled by boundary particles. The interaction between fluid and boundary particles is specified by the boundary model. +# Arguments +- `initial_condition`: Initial condition of the boundary particles. + +# Keywords +- `normal_stiffness`: Normal stiffness used for DEM wall contact. + !!! warning "Experimental Implementation" This is an experimental feature and may change in a future releases. @@ -27,6 +33,11 @@ struct BoundaryDEMSystem{NDIMS, ELTYPE <: Real, IC, end end +# Keyword-only public front door used by the examples and docs. +function BoundaryDEMSystem(initial_condition; normal_stiffness) + return BoundaryDEMSystem(initial_condition, normal_stiffness) +end + # The default constructor needs to be accessible for Adapt.jl to work with this struct. # See the comments in general/gpu.jl for more details. function BoundaryDEMSystem(initial_condition, normal_stiffness) diff --git a/src/schemes/fluid/implicit_incompressible_sph/system.jl b/src/schemes/fluid/implicit_incompressible_sph/system.jl index 218dd96f87..08570df3d1 100644 --- a/src/schemes/fluid/implicit_incompressible_sph/system.jl +++ b/src/schemes/fluid/implicit_incompressible_sph/system.jl @@ -1,9 +1,10 @@ """ - ImplicitIncompressibleSPHSystem(initial_condition, - smoothing_kernel, smoothing_length, - reference_density; + ImplicitIncompressibleSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + reference_density, viscosity=nothing, - acceleration=ntuple(_ -> 0.0, ndims(smoothing_kernel)), + acceleration=ntuple(_ -> 0.0, NDIMS), omega=0.5, max_error=0.1, min_iterations=2, max_iterations=20, time_step) @@ -16,13 +17,13 @@ See [Implicit Incompressible SPH](@ref iisph) for more details on the method. # Arguments - `initial_condition`: [`InitialCondition`](@ref) representing the system's particles. -- `smoothing_kernel`: Smoothing kernel to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). -- `smoothing_length`: Smoothing length to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). -- `reference_density`: Reference density used for the fluid particles -# Keyword Arguments +# Keywords +- `smoothing_kernel`: Smoothing kernel to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). +- `smoothing_length`: Smoothing length to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). +- `reference_density`: Reference density used for the fluid particles. - `viscosity`: Currently, only [`ViscosityMorris`](@ref) and [`ViscosityAdami`](@ref) are supported. - `acceleration`: Acceleration vector for the system. (default: zero vector) @@ -63,6 +64,17 @@ struct ImplicitIncompressibleSPHSystem{NDIMS, ELTYPE <: Real, ARRAY1D, ARRAY2D, cache :: C end +# Keyword-only public front door used by the examples and docs. +function ImplicitIncompressibleSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + reference_density, + kwargs...) + return ImplicitIncompressibleSPHSystem(initial_condition, smoothing_kernel, + smoothing_length, reference_density; + kwargs...) +end + # The default constructor needs to be accessible for Adapt.jl to work with this struct. # See the comments in general/gpu.jl for more details. function ImplicitIncompressibleSPHSystem(initial_condition, diff --git a/src/schemes/structure/discrete_element_method/system.jl b/src/schemes/structure/discrete_element_method/system.jl index ecdd5a29a5..37bf0a6a83 100644 --- a/src/schemes/structure/discrete_element_method/system.jl +++ b/src/schemes/structure/discrete_element_method/system.jl @@ -1,6 +1,9 @@ """ - DEMSystem(initial_condition, contact_model; damping_coefficient=0.0001, - acceleration=ntuple(_ -> 0.0, ndims(initial_condition)), source_terms=nothing, + DEMSystem(initial_condition; + contact_model, + damping_coefficient=0.0001, + acceleration=ntuple(_ -> 0.0, NDIMS), + source_terms=nothing, radius=nothing) Constructs a Discrete Element Method (DEM) system for numerically simulating the dynamics of @@ -13,9 +16,9 @@ specified material properties and contact mechanics. # Arguments - `initial_condition`: Initial condition of the system, encapsulating the initial positions, velocities, masses, and radii of particles. - - `contact_model`: Contact model used for particle interactions. # Keywords +- `contact_model`: Contact model used for particle interactions. - `acceleration`: Global acceleration vector applied to the system, such as gravity. Specified as an `SVector` of length `NDIMS`, with a default of zero in each dimension. - `source_terms`: Optional; additional forces or modifications to particle dynamics not @@ -40,6 +43,11 @@ struct DEMSystem{NDIMS, ELTYPE <: Real, IC, ARRAY1D, ST, contact_model :: CM end +# Keyword-only public front door used by the examples and docs. +function DEMSystem(initial_condition; contact_model, kwargs...) + return DEMSystem(initial_condition, contact_model; kwargs...) +end + # The default constructor needs to be accessible for Adapt.jl to work with this struct. # See the comments in general/gpu.jl for more details. function DEMSystem(initial_condition, contact_model; damping_coefficient=0.0001, diff --git a/src/schemes/structure/total_lagrangian_sph/system.jl b/src/schemes/structure/total_lagrangian_sph/system.jl index dcb777d84e..66f48dea3c 100644 --- a/src/schemes/structure/total_lagrangian_sph/system.jl +++ b/src/schemes/structure/total_lagrangian_sph/system.jl @@ -1,6 +1,9 @@ @doc raw""" - TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, smoothing_length, - young_modulus, poisson_ratio; + TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus, + poisson_ratio, n_clamped_particles=0, clamped_particles=Int[], clamped_particles_motion=nothing, @@ -18,14 +21,14 @@ See [Total Lagrangian SPH](@ref tlsph) for more details on the method. # Arguments - `initial_condition`: Initial condition representing the system's particles. -- `young_modulus`: Young's modulus. -- `poisson_ratio`: Poisson ratio. + +# Keywords - `smoothing_kernel`: Smoothing kernel to be used for this system. See [Smoothing Kernels](@ref smoothing_kernel). - `smoothing_length`: Smoothing length to be used for this system. See [Smoothing Kernels](@ref smoothing_kernel). - -# Keywords +- `young_modulus`: Young's modulus. +- `poisson_ratio`: Poisson ratio. - `n_clamped_particles` (deprecated): Number of clamped particles that are fixed and not integrated to clamp the structure. Note that the clamped particles must be the **last** particles in the `InitialCondition`. See the info box below. @@ -112,6 +115,18 @@ struct TotalLagrangianSPHSystem{BM, NDIMS, ELTYPE <: Real, IC, ARRAY1D, ARRAY2D, cache :: C end +# Keyword-only public front door used by the examples and docs. +function TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus, + poisson_ratio, + kwargs...) + return TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, + smoothing_length, young_modulus, + poisson_ratio; kwargs...) +end + function TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, smoothing_length, young_modulus, poisson_ratio; n_clamped_particles=0, From d30cb69b26f3f8b690c324e8eed9e3b0fbfa78fd Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Wed, 22 Apr 2026 14:47:46 +0200 Subject: [PATCH 07/56] Refactor constructors in DEM, SPH, and TotalLagrangian systems to use keyword arguments for improved clarity and consistency --- src/schemes/boundary/dem_boundary/system.jl | 7 -- .../implicit_incompressible_sph/system.jl | 12 ---- .../discrete_element_method/system.jl | 9 +-- .../structure/total_lagrangian_sph/system.jl | 9 --- test/general/semidiscretization.jl | 24 +++++-- .../dummy_particles/dummy_particles.jl | 14 ++-- test/schemes/boundary/dummy_particles/rhs.jl | 7 +- test/schemes/fluid/rhs.jl | 10 +-- .../structure/total_lagrangian_sph/rhs.jl | 7 +- test/systems/dem_system.jl | 4 +- test/systems/iisph_system.jl | 68 +++++++++++-------- test/systems/tlsph_system.jl | 49 +++++++++---- 12 files changed, 124 insertions(+), 96 deletions(-) diff --git a/src/schemes/boundary/dem_boundary/system.jl b/src/schemes/boundary/dem_boundary/system.jl index 81cdf16ffe..3eefc46322 100644 --- a/src/schemes/boundary/dem_boundary/system.jl +++ b/src/schemes/boundary/dem_boundary/system.jl @@ -33,14 +33,7 @@ struct BoundaryDEMSystem{NDIMS, ELTYPE <: Real, IC, end end -# Keyword-only public front door used by the examples and docs. function BoundaryDEMSystem(initial_condition; normal_stiffness) - return BoundaryDEMSystem(initial_condition, normal_stiffness) -end - -# The default constructor needs to be accessible for Adapt.jl to work with this struct. -# See the comments in general/gpu.jl for more details. -function BoundaryDEMSystem(initial_condition, normal_stiffness) ELTYPE = eltype(initial_condition) coordinates = initial_condition.coordinates radius = initial_condition.particle_spacing * diff --git a/src/schemes/fluid/implicit_incompressible_sph/system.jl b/src/schemes/fluid/implicit_incompressible_sph/system.jl index 08570df3d1..f603811a91 100644 --- a/src/schemes/fluid/implicit_incompressible_sph/system.jl +++ b/src/schemes/fluid/implicit_incompressible_sph/system.jl @@ -64,22 +64,10 @@ struct ImplicitIncompressibleSPHSystem{NDIMS, ELTYPE <: Real, ARRAY1D, ARRAY2D, cache :: C end -# Keyword-only public front door used by the examples and docs. function ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, reference_density, - kwargs...) - return ImplicitIncompressibleSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, reference_density; - kwargs...) -end - -# The default constructor needs to be accessible for Adapt.jl to work with this struct. -# See the comments in general/gpu.jl for more details. -function ImplicitIncompressibleSPHSystem(initial_condition, - smoothing_kernel, smoothing_length, - reference_density; viscosity=nothing, acceleration=ntuple(_ -> 0.0, ndims(smoothing_kernel)), diff --git a/src/schemes/structure/discrete_element_method/system.jl b/src/schemes/structure/discrete_element_method/system.jl index 37bf0a6a83..ad36166418 100644 --- a/src/schemes/structure/discrete_element_method/system.jl +++ b/src/schemes/structure/discrete_element_method/system.jl @@ -43,14 +43,7 @@ struct DEMSystem{NDIMS, ELTYPE <: Real, IC, ARRAY1D, ST, contact_model :: CM end -# Keyword-only public front door used by the examples and docs. -function DEMSystem(initial_condition; contact_model, kwargs...) - return DEMSystem(initial_condition, contact_model; kwargs...) -end - -# The default constructor needs to be accessible for Adapt.jl to work with this struct. -# See the comments in general/gpu.jl for more details. -function DEMSystem(initial_condition, contact_model; damping_coefficient=0.0001, +function DEMSystem(initial_condition; contact_model, damping_coefficient=0.0001, acceleration=ntuple(_ -> 0.0, ndims(initial_condition)), source_terms=nothing, radius=nothing) diff --git a/src/schemes/structure/total_lagrangian_sph/system.jl b/src/schemes/structure/total_lagrangian_sph/system.jl index 66f48dea3c..a2cadba106 100644 --- a/src/schemes/structure/total_lagrangian_sph/system.jl +++ b/src/schemes/structure/total_lagrangian_sph/system.jl @@ -115,20 +115,11 @@ struct TotalLagrangianSPHSystem{BM, NDIMS, ELTYPE <: Real, IC, ARRAY1D, ARRAY2D, cache :: C end -# Keyword-only public front door used by the examples and docs. function TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, smoothing_length, young_modulus, poisson_ratio, - kwargs...) - return TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, young_modulus, - poisson_ratio; kwargs...) -end - -function TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, smoothing_length, - young_modulus, poisson_ratio; n_clamped_particles=0, clamped_particles=Int[], clamped_particles_motion=nothing, diff --git a/test/general/semidiscretization.jl b/test/general/semidiscretization.jl index 3c2dcbeb58..16a3b5a179 100644 --- a/test/general/semidiscretization.jl +++ b/test/general/semidiscretization.jl @@ -67,7 +67,11 @@ model_c = BoundaryModelMock(zeros(3)) # FSI without boundary model - structure_system1 = TotalLagrangianSPHSystem(ic, kernel, 1.0, 1.0, 1.0) + structure_system1 = TotalLagrangianSPHSystem(ic; + smoothing_kernel=kernel, + smoothing_length=1.0, + young_modulus=1.0, + poisson_ratio=1.0) error_str = "a boundary model for `TotalLagrangianSPHSystem` must be " * "specified when simulating a fluid-structure interaction." @@ -76,7 +80,11 @@ neighborhood_search=nothing) # FSI with boundary model - structure_system2 = TotalLagrangianSPHSystem(ic, kernel, 1.0, 1.0, 1.0, + structure_system2 = TotalLagrangianSPHSystem(ic; + smoothing_kernel=kernel, + smoothing_length=1.0, + young_modulus=1.0, + poisson_ratio=1.0, boundary_model=model_a) structure_system2 = TrixiParticles.initialize_self_interaction_nhs(structure_system2, nothing, @@ -87,7 +95,11 @@ nothing) # FSI with wrong boundary model - structure_system3 = TotalLagrangianSPHSystem(ic, kernel, 1.0, 1.0, 1.0, + structure_system3 = TotalLagrangianSPHSystem(ic; + smoothing_kernel=kernel, + smoothing_length=1.0, + young_modulus=1.0, + poisson_ratio=1.0, boundary_model=model_b) error_str = "`BoundaryModelDummyParticles` with density calculator " * @@ -97,7 +109,11 @@ neighborhood_search=nothing) # FSI with wrong boundary model - structure_system4 = TotalLagrangianSPHSystem(ic, kernel, 1.0, 1.0, 1.0, + structure_system4 = TotalLagrangianSPHSystem(ic; + smoothing_kernel=kernel, + smoothing_length=1.0, + young_modulus=1.0, + poisson_ratio=1.0, boundary_model=model_c) error_str = "the boundary model was initialized with 3 particles, " * diff --git a/test/schemes/boundary/dummy_particles/dummy_particles.jl b/test/schemes/boundary/dummy_particles/dummy_particles.jl index 239f992e67..37d41ddab6 100644 --- a/test/schemes/boundary/dummy_particles/dummy_particles.jl +++ b/test/schemes/boundary/dummy_particles/dummy_particles.jl @@ -74,11 +74,17 @@ RigidBodySystem(boundary; boundary_model=boundary_model_bernoulli, particle_spacing=particle_spacing), - TotalLagrangianSPHSystem(boundary, smoothing_kernel, - smoothing_length, 1e6, 0.3; + TotalLagrangianSPHSystem(boundary; + smoothing_kernel, + smoothing_length, + young_modulus=1e6, + poisson_ratio=0.3, boundary_model=boundary_model_adami), - TotalLagrangianSPHSystem(boundary, smoothing_kernel, - smoothing_length, 1e6, 0.3; + TotalLagrangianSPHSystem(boundary; + smoothing_kernel, + smoothing_length, + young_modulus=1e6, + poisson_ratio=0.3, boundary_model=boundary_model_bernoulli) ] diff --git a/test/schemes/boundary/dummy_particles/rhs.jl b/test/schemes/boundary/dummy_particles/rhs.jl index 4d64fc61a5..43e4a89767 100644 --- a/test/schemes/boundary/dummy_particles/rhs.jl +++ b/test/schemes/boundary/dummy_particles/rhs.jl @@ -77,8 +77,11 @@ v_boundary_continuity = copy(initial_condition.density') # TLSPH system - structure_system = TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, 0.0, 0.0, + structure_system = TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus=0.0, + poisson_ratio=0.0, boundary_model=boundary_model_continuity) # Positions of the structure particles are not used here diff --git a/test/schemes/fluid/rhs.jl b/test/schemes/fluid/rhs.jl index ea008db6cc..af5bcb7333 100644 --- a/test/schemes/fluid/rhs.jl +++ b/test/schemes/fluid/rhs.jl @@ -71,10 +71,10 @@ density_calculator, pressure_acceleration) elseif system_name == "IISPH" - system = ImplicitIncompressibleSPHSystem(fluid, + system = ImplicitIncompressibleSPHSystem(fluid; smoothing_kernel, smoothing_length, - 1000.0, + reference_density=1000.0, time_step=0.001) end @@ -140,8 +140,10 @@ density_calculator=density_calculator, smoothing_length, 0.0) - system_iisph = ImplicitIncompressibleSPHSystem(fluid, smoothing_kernel, - smoothing_length, 1000.0, + system_iisph = ImplicitIncompressibleSPHSystem(fluid; + smoothing_kernel, + smoothing_length, + reference_density=1000.0, time_step=0.001) n_particles = TrixiParticles.nparticles(system_edac) diff --git a/test/schemes/structure/total_lagrangian_sph/rhs.jl b/test/schemes/structure/total_lagrangian_sph/rhs.jl index ce498b4db2..2f7a5aef93 100644 --- a/test/schemes/structure/total_lagrangian_sph/rhs.jl +++ b/test/schemes/structure/total_lagrangian_sph/rhs.jl @@ -160,8 +160,11 @@ smoothing_kernel = SchoenbergCubicSplineKernel{2}() initial_condition = InitialCondition(; coordinates, mass, density) - system = TotalLagrangianSPHSystem(initial_condition, - smoothing_kernel, smoothing_length, E, nu) + system = TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus=E, + poisson_ratio=nu) tspan = (0.0, 1.0) names = ["CPU code", "GPU code emulated on the CPU"] diff --git a/test/systems/dem_system.jl b/test/systems/dem_system.jl index 3816677598..746366d095 100644 --- a/test/systems/dem_system.jl +++ b/test/systems/dem_system.jl @@ -11,7 +11,7 @@ contact_model = HertzContactModel(1.0e10, 0.3) # Construct the DEM system. - system = DEMSystem(initial_condition, contact_model, acceleration=(0.0, 10.0)) + system = DEMSystem(initial_condition; contact_model, acceleration=(0.0, 10.0)) # Expected compact representation. show_compact = "DEMSystem{2}(InitialCondition{Float64, Float64}(), HertzContactModel: elastic_modulus = 1.0e10, poissons_ratio = 0.3, damping_coefficient = 0.0001) with 2 particles" @@ -44,7 +44,7 @@ end contact_model = LinearContactModel(200000.0) # Construct the DEM system. - system = DEMSystem(initial_condition, contact_model, acceleration=(0.0, 10.0)) + system = DEMSystem(initial_condition; contact_model, acceleration=(0.0, 10.0)) # Expected compact representation. show_compact = "DEMSystem{2}(InitialCondition{Float64, Float64}(), LinearContactModel: normal_stiffness = 200000.0, damping_coefficient = 0.0001) with 2 particles" diff --git a/test/systems/iisph_system.jl b/test/systems/iisph_system.jl index 082b607e18..e599c1a7a4 100644 --- a/test/systems/iisph_system.jl +++ b/test/systems/iisph_system.jl @@ -48,7 +48,7 @@ smoothing_length = 0.362 initial_condition = InitialCondition(; coordinates, mass, density) - system = ImplicitIncompressibleSPHSystem(initial_condition, + system = ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, reference_density, @@ -76,32 +76,32 @@ # A too-short acceleration vector triggers dimension validation error_str1 = "`acceleration` must be of length $NDIMS for a $(NDIMS)D problem" - @test_throws ArgumentError(error_str1) ImplicitIncompressibleSPHSystem(initial_condition, + @test_throws ArgumentError(error_str1) ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, - density, + reference_density=density, acceleration=(0.0), time_step=0.001) # Smoothing kernel dimensionality must match the problem dimension error_str2 = "smoothing kernel dimensionality must be $NDIMS for a $(NDIMS)D problem" - @test_throws ArgumentError(error_str2) ImplicitIncompressibleSPHSystem(initial_condition, - smoothing_kernel2, + @test_throws ArgumentError(error_str2) ImplicitIncompressibleSPHSystem(initial_condition; + smoothing_kernel=smoothing_kernel2, smoothing_length, reference_density, time_step=0.001) # Reference density must be positive error_str3 = "`reference_density` must be a positive number" - @test_throws ArgumentError(error_str3) ImplicitIncompressibleSPHSystem(initial_condition, + @test_throws ArgumentError(error_str3) ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, - 0.0, + reference_density=0.0, time_step=0.001) # max_error is a percentage and must be in (0, 100] error_str4 = "`max_error` is given in percentage, so it must be a number between 0 and 100" - @test_throws ArgumentError(error_str4) ImplicitIncompressibleSPHSystem(initial_condition, + @test_throws ArgumentError(error_str4) ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, reference_density, @@ -110,7 +110,7 @@ # min_iterations must be strictly positive error_str5 = "`min_iterations` must be a positive number" - @test_throws ArgumentError(error_str5) ImplicitIncompressibleSPHSystem(initial_condition, + @test_throws ArgumentError(error_str5) ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, reference_density, @@ -119,7 +119,7 @@ # min_iterations must not exceed max_iterations error_str6 = "`min_iterations` must be smaller or equal to `max_iterations`" - @test_throws ArgumentError(error_str6) ImplicitIncompressibleSPHSystem(initial_condition, + @test_throws ArgumentError(error_str6) ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, reference_density, @@ -129,7 +129,7 @@ # time_step must be strictly positive error_str7 = "`time_step must be a positive number" - @test_throws ArgumentError(error_str6) ImplicitIncompressibleSPHSystem(initial_condition, + @test_throws ArgumentError(error_str6) ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, reference_density, @@ -169,7 +169,7 @@ density_calculator = SummationDensity() - system = ImplicitIncompressibleSPHSystem(setup, + system = ImplicitIncompressibleSPHSystem(setup; smoothing_kernel, smoothing_length, reference_density, @@ -202,7 +202,7 @@ # Acceleration vector length validation also applies to setup-based constructors error_str = "`acceleration` must be of length $NDIMS for a $(NDIMS)D problem" - @test_throws ArgumentError(error_str) ImplicitIncompressibleSPHSystem(setup, + @test_throws ArgumentError(error_str) ImplicitIncompressibleSPHSystem(setup; smoothing_kernel, smoothing_length, reference_density, @@ -223,7 +223,7 @@ smoothing_length = 0.362 initial_condition = InitialCondition(; coordinates, mass, density) - system = ImplicitIncompressibleSPHSystem(initial_condition, + system = ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, reference_density, @@ -261,7 +261,7 @@ smoothing_length = 0.362 initial_condition = InitialCondition(; coordinates, mass, density) - system = ImplicitIncompressibleSPHSystem(initial_condition, + system = ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, reference_density, time_step=0.001) @@ -287,7 +287,7 @@ initial_condition = InitialCondition(; coordinates, velocity, mass, density) # SummationDensity (is always in use) - system = ImplicitIncompressibleSPHSystem(initial_condition, + system = ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, reference_density, @@ -316,8 +316,10 @@ pressure_a = [0.8] ic_a = InitialCondition(; coordinates, velocity, mass=mass_a, density=density_a, pressure=pressure_a) - system = ImplicitIncompressibleSPHSystem(ic_a, smoothing_kernel, - smoothing_length, 6.0, + system = ImplicitIncompressibleSPHSystem(ic_a; + smoothing_kernel, + smoothing_length, + reference_density=6.0, time_step=0.5) mass_b = [3.0] @@ -325,8 +327,10 @@ pressure_b = [1.2] ic_b = InitialCondition(; coordinates, velocity, mass=mass_b, density=density_b, pressure=pressure_b) - neighbor_system = ImplicitIncompressibleSPHSystem(ic_b, smoothing_kernel, - smoothing_length, 5.0, + neighbor_system = ImplicitIncompressibleSPHSystem(ic_b; + smoothing_kernel, + smoothing_length, + reference_density=5.0, time_step=0.5) system.sum_d_ij_pj[:, 1] .= (0.4, -0.2) @@ -363,8 +367,10 @@ pressure_a = [0.8] ic_a = InitialCondition(; coordinates, velocity, mass=mass_a, density=density_a, pressure=pressure_a) - system = ImplicitIncompressibleSPHSystem(ic_a, smoothing_kernel, - smoothing_length, 6.0, + system = ImplicitIncompressibleSPHSystem(ic_a; + smoothing_kernel, + smoothing_length, + reference_density=6.0, time_step=0.5) system.sum_d_ij_pj[:, 1] .= (0.4, -0.2) @@ -429,9 +435,12 @@ 0.0 0.2] velocity = zeros(2, 2) ic = InitialCondition(; coordinates, velocity, mass, density, pressure) - system_pressure = ImplicitIncompressibleSPHSystem(ic, smoothing_kernel, - smoothing_length, 1000.0, - omega=0.4, time_step=0.5) + system_pressure = ImplicitIncompressibleSPHSystem(ic; + smoothing_kernel, + smoothing_length, + reference_density=1000.0, + omega=0.4, + time_step=0.5) system_pressure.predicted_density .= [990.0, 1010.0] system_pressure.sum_term .= [5.0, -2.0] system_pressure.a_ii .= [0.5, 1.0e-10] @@ -463,9 +472,12 @@ 0.0 0.2] velocity = zeros(2, 2) ic = InitialCondition(; coordinates, velocity, mass, density, pressure) - system_iters = ImplicitIncompressibleSPHSystem(ic, smoothing_kernel, - smoothing_length, 1000.0, - omega=0.6, max_error=0.25, + system_iters = ImplicitIncompressibleSPHSystem(ic; + smoothing_kernel, + smoothing_length, + reference_density=1000.0, + omega=0.6, + max_error=0.25, min_iterations=3, max_iterations=7, time_step=0.25) diff --git a/test/systems/tlsph_system.jl b/test/systems/tlsph_system.jl index 8cb261f2d2..71755ab712 100644 --- a/test/systems/tlsph_system.jl +++ b/test/systems/tlsph_system.jl @@ -23,8 +23,11 @@ initial_condition = InitialCondition(; coordinates, mass, density=material_densities) - system = TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, E, nu, + system = TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus=E, + poisson_ratio=nu, boundary_model=boundary_model) @test system isa TotalLagrangianSPHSystem @@ -62,8 +65,11 @@ initial_condition = InitialCondition(; coordinates, mass, density=material_densities) - system = TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, E, nu, + system = TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus=E, + poisson_ratio=nu, boundary_model=boundary_model) show_compact = "TotalLagrangianSPHSystem{2}(Val{:smoothing_kernel}(), " * @@ -88,8 +94,11 @@ E = [1.2, 3.4] nu = [0.2, 0.4] - system = TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, E, nu, + system = TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus=E, + poisson_ratio=nu, boundary_model=boundary_model) show_box = """ @@ -222,8 +231,11 @@ smoothing_length) initial_condition = InitialCondition(; coordinates, mass, density) - system = TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, 1.0, 1.0) + system = TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus=1.0, + poisson_ratio=1.0) semi = DummySemidiscretization() TrixiParticles.initialize!(system, semi) @@ -316,8 +328,11 @@ initial_condition = InitialCondition(; coordinates, mass, density=material_densities) - system = TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, E, nu, + system = TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus=E, + poisson_ratio=nu, boundary_model=boundary_model) u0 = zeros(TrixiParticles.u_nvariables(system), @@ -343,8 +358,11 @@ initial_condition = InitialCondition(; coordinates, velocity, mass, density=material_densities) - system = TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, E, nu, + system = TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus=E, + poisson_ratio=nu, boundary_model=boundary_model) v0 = zeros(TrixiParticles.v_nvariables(system), @@ -367,8 +385,11 @@ initial_condition = InitialCondition(; coordinates, velocity, mass, density=material_densities) - system = TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, E, nu) + system = TotalLagrangianSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, + young_modulus=E, + poisson_ratio=nu) # Initialize deformation_grad and pk1_rho2 with arbitrary values for particle in TrixiParticles.eachparticle(system) From 7526800aad0ade381839bc39855261893014a188 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Wed, 22 Apr 2026 16:09:27 +0200 Subject: [PATCH 08/56] fix tests --- examples/fluid/dam_break_2d_gpu.jl | 10 ++++++++++ examples/fluid/dam_break_2d_iisph.jl | 4 ++++ .../fluid/dam_break_2d_iisph_pressure_boundaries.jl | 4 ++++ examples/fluid/falling_water_spheres_2d.jl | 7 ++++--- examples/fluid/periodic_array_of_cylinders_2d.jl | 2 +- examples/fsi/hydrostatic_water_column_2d.jl | 6 ++++-- 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/examples/fluid/dam_break_2d_gpu.jl b/examples/fluid/dam_break_2d_gpu.jl index 9ab9b5c3d2..2cf4e7c8ef 100644 --- a/examples/fluid/dam_break_2d_gpu.jl +++ b/examples/fluid/dam_break_2d_gpu.jl @@ -26,6 +26,16 @@ trixi_include(@__MODULE__, coordinates_eltype=Float64, sol=nothing, ode=nothing) +# Preserve nested example defaults while still allowing `trixi_include` to override them. +tspan = tspan +fluid_particle_spacing = fluid_particle_spacing +smoothing_length = smoothing_length +density_diffusion = density_diffusion +boundary_layers = boundary_layers +spacing_ratio = spacing_ratio +boundary_model = boundary_model +boundary_density_calculator = boundary_density_calculator + # Define a GPU-compatible neighborhood search min_corner = minimum(tank.boundary.coordinates, dims=2) max_corner = maximum(tank.boundary.coordinates, dims=2) diff --git a/examples/fluid/dam_break_2d_iisph.jl b/examples/fluid/dam_break_2d_iisph.jl index e6421c737c..7526876ce0 100644 --- a/examples/fluid/dam_break_2d_iisph.jl +++ b/examples/fluid/dam_break_2d_iisph.jl @@ -9,6 +9,10 @@ trixi_include(@__MODULE__, fluid_particle_spacing, sol=nothing, ode=nothing) +# Preserve the nested example default while still allowing `trixi_include(...; tspan=...)` +# to override this wrapper example. +tspan = tspan + # IISPH doesn't require a large compact support like WCSPH and performs worse with a typical # smoothing length used for WCSPH. smoothing_length = 1.0 * fluid_particle_spacing diff --git a/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl b/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl index 10421762f0..95eac56b79 100644 --- a/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl +++ b/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl @@ -6,6 +6,10 @@ trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); sol=nothing, ode=nothing) +# Preserve the nested example default while still allowing `trixi_include(...; tspan=...)` +# to override this wrapper example. +tspan = tspan + # Change smoothing kernel and length smoothing_length = 1.2 * fluid_particle_spacing smoothing_kernel = SchoenbergCubicSplineKernel{2}() diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index 4fd4832315..b628156e0d 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -60,8 +60,8 @@ viscosity = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0) density_diffusion = DensityDiffusionAntuono(delta=0.1) sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1; - fluid_smoothing_kernel, - fluid_smoothing_length, + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=fluid_smoothing_length, sound_speed, viscosity, density_calculator=ContinuityDensity(), acceleration=(0.0, -gravity), @@ -69,7 +69,8 @@ sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1; reference_particle_spacing=fluid_particle_spacing) sphere = WeaklyCompressibleSPHSystem(sphere2; - fluid_smoothing_kernel, fluid_smoothing_length, + smoothing_kernel=fluid_smoothing_kernel, + smoothing_length=fluid_smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, density_diffusion, acceleration=(0.0, -gravity)) diff --git a/examples/fluid/periodic_array_of_cylinders_2d.jl b/examples/fluid/periodic_array_of_cylinders_2d.jl index 0aefb88d62..c3441176ee 100644 --- a/examples/fluid/periodic_array_of_cylinders_2d.jl +++ b/examples/fluid/periodic_array_of_cylinders_2d.jl @@ -77,8 +77,8 @@ fluid_system = WeaklyCompressibleSPHSystem(fluid; # ==== Boundary boundary_model = BoundaryModelDummyParticles(boundary.density, boundary.mass, AdamiPressureExtrapolation(), + smoothing_kernel, smoothing_length; viscosity=ViscosityAdami(; nu), - smoothing_kernel, smoothing_length, state_equation) boundary_system = WallBoundarySystem(boundary, boundary_model) diff --git a/examples/fsi/hydrostatic_water_column_2d.jl b/examples/fsi/hydrostatic_water_column_2d.jl index 3b0c9435b8..ef624e3452 100644 --- a/examples/fsi/hydrostatic_water_column_2d.jl +++ b/examples/fsi/hydrostatic_water_column_2d.jl @@ -96,7 +96,8 @@ tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, (plate_size[1 if use_edac fluid_system = EntropicallyDampedSPHSystem(tank.fluid; - smoothing_kernel, smoothing_length_fluid, + smoothing_kernel, + smoothing_length=smoothing_length_fluid, sound_speed, acceleration=(0.0, -gravity), correction=ShepardKernelCorrection(), @@ -107,7 +108,8 @@ else density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) # density_diffusion = DensityDiffusionAntuono(delta=0.1) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel, smoothing_length_fluid, + smoothing_kernel, + smoothing_length=smoothing_length_fluid, density_calculator=fluid_density_calculator, state_equation, density_diffusion, acceleration=(0.0, -gravity), From da12eb908184e5a86abefd32131ae46b86a854b4 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Thu, 23 Apr 2026 09:39:59 +0200 Subject: [PATCH 09/56] better fix for included parameters --- examples/fluid/dam_break_2d_gpu.jl | 32 ++++++++----------- examples/fluid/dam_break_2d_iisph.jl | 6 ++-- .../dam_break_2d_iisph_pressure_boundaries.jl | 7 ++-- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/examples/fluid/dam_break_2d_gpu.jl b/examples/fluid/dam_break_2d_gpu.jl index 2cf4e7c8ef..35ebaf4f66 100644 --- a/examples/fluid/dam_break_2d_gpu.jl +++ b/examples/fluid/dam_break_2d_gpu.jl @@ -18,24 +18,21 @@ using TrixiParticles +fluid_particle_spacing = 0.6 / 40 +spacing_ratio = 1 +boundary_layers = 4 +coordinates_eltype = Float64 +tspan = (0.0, 5.7 / sqrt(9.81 / 0.6)) + # Load setup from dam break example trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), - fluid_particle_spacing=0.6 / 40, - spacing_ratio=1, boundary_layers=4, - coordinates_eltype=Float64, + joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + fluid_particle_spacing, + spacing_ratio, boundary_layers, + coordinates_eltype, + tspan, sol=nothing, ode=nothing) -# Preserve nested example defaults while still allowing `trixi_include` to override them. -tspan = tspan -fluid_particle_spacing = fluid_particle_spacing -smoothing_length = smoothing_length -density_diffusion = density_diffusion -boundary_layers = boundary_layers -spacing_ratio = spacing_ratio -boundary_model = boundary_model -boundary_density_calculator = boundary_density_calculator - # Define a GPU-compatible neighborhood search min_corner = minimum(tank.boundary.coordinates, dims=2) max_corner = maximum(tank.boundary.coordinates, dims=2) @@ -47,10 +44,7 @@ trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); neighborhood_search, fluid_particle_spacing, - tspan, smoothing_length, - density_diffusion, + tspan, boundary_layers, spacing_ratio, - boundary_model, parallelization_backend=PolyesterBackend(), - boundary_density_calculator, - coordinates_eltype=Float64) + coordinates_eltype) diff --git a/examples/fluid/dam_break_2d_iisph.jl b/examples/fluid/dam_break_2d_iisph.jl index 7526876ce0..03c19409ee 100644 --- a/examples/fluid/dam_break_2d_iisph.jl +++ b/examples/fluid/dam_break_2d_iisph.jl @@ -2,17 +2,15 @@ using TrixiParticles fluid_particle_spacing = 0.6 / 40 +tspan = (0.0, 5.7 / sqrt(9.81 / 0.6)) # Load setup from dam break example trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); fluid_particle_spacing, + tspan, sol=nothing, ode=nothing) -# Preserve the nested example default while still allowing `trixi_include(...; tspan=...)` -# to override this wrapper example. -tspan = tspan - # IISPH doesn't require a large compact support like WCSPH and performs worse with a typical # smoothing length used for WCSPH. smoothing_length = 1.0 * fluid_particle_spacing diff --git a/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl b/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl index 95eac56b79..d853155f98 100644 --- a/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl +++ b/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl @@ -1,15 +1,14 @@ # 2D dam break simulation using implicit incompressible SPH (IISPH) with pressure boundaries using TrixiParticles +tspan = (0.0, 5.7 / sqrt(9.81 / 0.6)) + # Load setup from dam break example trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + tspan, sol=nothing, ode=nothing) -# Preserve the nested example default while still allowing `trixi_include(...; tspan=...)` -# to override this wrapper example. -tspan = tspan - # Change smoothing kernel and length smoothing_length = 1.2 * fluid_particle_spacing smoothing_kernel = SchoenbergCubicSplineKernel{2}() From 0cf74ae9ee44ea79c0854e6bfe7b3e820721986a Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Thu, 23 Apr 2026 09:55:22 +0200 Subject: [PATCH 10/56] another pass to reduce unreqed named args --- examples/fluid/accelerated_tank_2d.jl | 4 ++-- examples/fluid/dam_break_2d.jl | 2 +- examples/fluid/dam_break_2phase_2d.jl | 10 +++++----- examples/fluid/dam_break_oil_film_2d.jl | 8 ++++---- examples/fluid/falling_water_spheres_2d.jl | 2 +- examples/fluid/falling_water_spheres_3d.jl | 12 ++++++------ examples/fluid/hydrostatic_water_column_2d.jl | 2 +- examples/fluid/oscillating_drop_2d.jl | 2 +- examples/fluid/pulsative_channel_flow_3d.jl | 10 +++++----- examples/fluid/sphere_surface_tension_2d.jl | 4 ++-- examples/fluid/sphere_surface_tension_3d.jl | 8 ++++---- examples/fluid/sphere_surface_tension_wall_2d.jl | 16 ++++++++-------- .../falling_rotating_rigid_squares_w_buoys_2d.jl | 4 ++-- examples/fsi/falling_water_column_2d.jl | 4 ++-- examples/preprocessing/packing_3d.jl | 6 +++--- 15 files changed, 47 insertions(+), 47 deletions(-) diff --git a/examples/fluid/accelerated_tank_2d.jl b/examples/fluid/accelerated_tank_2d.jl index cb6fbfb9d1..92b3289c14 100644 --- a/examples/fluid/accelerated_tank_2d.jl +++ b/examples/fluid/accelerated_tank_2d.jl @@ -19,7 +19,7 @@ is_moving(t) = true boundary_movement = PrescribedMotion(movement_function, is_moving) trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "hydrostatic_water_column_2d.jl"), - fluid_particle_spacing=fluid_particle_spacing, + joinpath(examples_dir(), "fluid", "hydrostatic_water_column_2d.jl"); + fluid_particle_spacing, prescribed_motion=boundary_movement, tspan=(0.0, 1.0), system_acceleration=(0.0, 0.0)); diff --git a/examples/fluid/dam_break_2d.jl b/examples/fluid/dam_break_2d.jl index 3eb90d1dbc..e825044618 100644 --- a/examples/fluid/dam_break_2d.jl +++ b/examples/fluid/dam_break_2d.jl @@ -57,7 +57,7 @@ smoothing_kernel = WendlandC2Kernel{2}() fluid_density_calculator = ContinuityDensity() alpha = 0.02 -viscosity_fluid = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0) +viscosity_fluid = ArtificialViscosityMonaghan(; alpha, beta=0.0) # The density diffusion model by Molteni and Colagrossi shows unphysical effects at the # free surface in long-running simulations, but is significantly faster than the model diff --git a/examples/fluid/dam_break_2phase_2d.jl b/examples/fluid/dam_break_2phase_2d.jl index f0b13df6e9..be86bdbc3a 100644 --- a/examples/fluid/dam_break_2phase_2d.jl +++ b/examples/fluid/dam_break_2phase_2d.jl @@ -40,11 +40,11 @@ nu_sim_water = nu_ratio * nu_sim_air air_viscosity = ViscosityMorris(nu=nu_sim_air) water_viscosity = ViscosityMorris(nu=nu_sim_water) -trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), - sol=nothing, fluid_particle_spacing=fluid_particle_spacing, - viscosity_fluid=water_viscosity, smoothing_length=smoothing_length, - gravity=gravity, tspan=tspan, density_diffusion=nothing, - sound_speed=sound_speed, exponent=7, +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + sol=nothing, fluid_particle_spacing, + viscosity_fluid=water_viscosity, smoothing_length, + gravity, tspan, density_diffusion=nothing, + sound_speed, exponent=7, tank_size=(floor(5.366 * H / fluid_particle_spacing) * fluid_particle_spacing, 2.6 * H)) diff --git a/examples/fluid/dam_break_oil_film_2d.jl b/examples/fluid/dam_break_oil_film_2d.jl index 04c2c7dfa3..3bbd292f57 100644 --- a/examples/fluid/dam_break_oil_film_2d.jl +++ b/examples/fluid/dam_break_oil_film_2d.jl @@ -34,11 +34,11 @@ nu_sim_water = nu_ratio * nu_sim_oil oil_viscosity = ViscosityMorris(nu=nu_sim_oil) # TODO: broken if both systems use surface tension -trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), - sol=nothing, fluid_particle_spacing=fluid_particle_spacing, tspan=tspan, +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + sol=nothing, fluid_particle_spacing, tspan, viscosity_fluid=ViscosityMorris(nu=nu_sim_water), - smoothing_length=smoothing_length, - gravity=gravity, density_diffusion=nothing, sound_speed=sound_speed, + smoothing_length, + gravity, density_diffusion=nothing, sound_speed, prefix="", reference_particle_spacing=fluid_particle_spacing) # ========================================================================================== diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index b628156e0d..2b86a88811 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -56,7 +56,7 @@ fluid_density_calculator = ContinuityDensity() nu = 0.005 alpha = 8 * nu / (fluid_smoothing_length * sound_speed) -viscosity = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0) +viscosity = ArtificialViscosityMonaghan(; alpha, beta=0.0) density_diffusion = DensityDiffusionAntuono(delta=0.1) sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1; diff --git a/examples/fluid/falling_water_spheres_3d.jl b/examples/fluid/falling_water_spheres_3d.jl index 78db127b5f..7727acf9a4 100644 --- a/examples/fluid/falling_water_spheres_3d.jl +++ b/examples/fluid/falling_water_spheres_3d.jl @@ -34,13 +34,13 @@ sphere2 = SphereShape(fluid_particle_spacing, sphere1_radius, sphere2_center, fluid_smoothing_length = 1.0 * fluid_particle_spacing trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"), - fluid_particle_spacing=fluid_particle_spacing, tspan=(0.0, 0.1), + joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); + fluid_particle_spacing, tspan=(0.0, 0.1), initial_fluid_size=(0.0, 0.0, 0.0), interval=100, - tank_size=(2.0, 1.0, 0.1), sound_speed=sound_speed, + tank_size=(2.0, 1.0, 0.1), sound_speed, faces=(true, true, true, true, true, false), - acceleration=(0.0, 0.0, -gravity), sphere1=sphere1, sphere2=sphere2, - fluid_smoothing_length=fluid_smoothing_length, + acceleration=(0.0, 0.0, -gravity), sphere1, sphere2, + fluid_smoothing_length, fluid_smoothing_kernel=SchoenbergCubicSplineKernel{3}(), - nu=nu, alpha=10 * nu / (fluid_smoothing_length * sound_speed), + nu, alpha=10 * nu / (fluid_smoothing_length * sound_speed), surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.05)) diff --git a/examples/fluid/hydrostatic_water_column_2d.jl b/examples/fluid/hydrostatic_water_column_2d.jl index a3818a0067..4a952e480f 100644 --- a/examples/fluid/hydrostatic_water_column_2d.jl +++ b/examples/fluid/hydrostatic_water_column_2d.jl @@ -39,7 +39,7 @@ smoothing_length = 1.2 * fluid_particle_spacing smoothing_kernel = SchoenbergCubicSplineKernel{2}() alpha = 0.02 -viscosity_fluid = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0) +viscosity_fluid = ArtificialViscosityMonaghan(; alpha, beta=0.0) fluid_density_calculator = ContinuityDensity() diff --git a/examples/fluid/oscillating_drop_2d.jl b/examples/fluid/oscillating_drop_2d.jl index 930a6039ad..d2cec27a26 100644 --- a/examples/fluid/oscillating_drop_2d.jl +++ b/examples/fluid/oscillating_drop_2d.jl @@ -43,7 +43,7 @@ pressure = coords -> Q * (1 - coords[1]^2 - coords[2]^2) density = coords -> TrixiParticles.inverse_state_equation(state_equation, pressure(coords)) fluid = SphereShape(fluid_particle_spacing, radius, (0.0, 0.0), - density, pressure=pressure, + density; pressure, sphere_type=RoundSphere(), velocity=coords -> sigma .* (coords[1], -coords[2])) diff --git a/examples/fluid/pulsative_channel_flow_3d.jl b/examples/fluid/pulsative_channel_flow_3d.jl index 6a020fe016..cb11c1194b 100644 --- a/examples/fluid/pulsative_channel_flow_3d.jl +++ b/examples/fluid/pulsative_channel_flow_3d.jl @@ -14,8 +14,8 @@ using TrixiParticles # A more reasonable particle spacing factor is 30, which takes around an hour to 0.5s simulation time particle_spacing_factor = 15 -trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "poiseuille_flow_3d.jl"), - sol=nothing, particle_spacing_factor=particle_spacing_factor) +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "poiseuille_flow_3d.jl"); + sol=nothing, particle_spacing_factor) v_max = channel_diameter^2 * imposed_pressure_drop / (8 * dynamic_viscosity * channel_length) @@ -38,9 +38,9 @@ extra_callback = nothing # simulation end time has been shortened to avoid long runtimes in the example # a more full pulse is seen with a runtime of 3.0, which takes around 30m at particle_spacing_factor = 15 and around 6h at particle_spacing_factor = 30 simulation_end_time = 0.5 -trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "poiseuille_flow_3d.jl"), +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "poiseuille_flow_3d.jl"); tspan=(0.0, simulation_end_time), - particle_spacing_factor=particle_spacing_factor, - extra_callback=extra_callback, saving_callback=saving_callback, v_max=v_max, + particle_spacing_factor, + extra_callback, saving_callback, v_max, inlet_reference_pressure=dynamic_pressure_drop, outlet_reference_pressure=dynamic_pressure_drop) diff --git a/examples/fluid/sphere_surface_tension_2d.jl b/examples/fluid/sphere_surface_tension_2d.jl index 17c989eb45..b64cbea4ab 100644 --- a/examples/fluid/sphere_surface_tension_2d.jl +++ b/examples/fluid/sphere_surface_tension_2d.jl @@ -44,11 +44,11 @@ source_terms = SourceTermDamping(; damping_coefficient=0.5) # density_calculator=SummationDensity(), # state_equation, # reference_particle_spacing=particle_spacing, -# viscosity=ArtificialViscosityMonaghan(alpha=alpha, +# viscosity=ArtificialViscosityMonaghan(; alpha, # beta=0.0), # surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.02), # correction=AkinciFreeSurfaceCorrection(fluid_density), -# source_terms=source_terms) +# source_terms) # Alternatively can also be used with surface_tension=SurfaceTensionMomentumMorris(surface_tension_coefficient=1.0) fluid_system = EntropicallyDampedSPHSystem(fluid; diff --git a/examples/fluid/sphere_surface_tension_3d.jl b/examples/fluid/sphere_surface_tension_3d.jl index 77eacb0ece..7683e4057a 100644 --- a/examples/fluid/sphere_surface_tension_3d.jl +++ b/examples/fluid/sphere_surface_tension_3d.jl @@ -23,9 +23,9 @@ smoothing_length = 1.0 * particle_spacing nu = 0.04 trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "sphere_surface_tension_2d.jl"), + joinpath(examples_dir(), "fluid", "sphere_surface_tension_2d.jl"); surface_tension_coefficient=0.5, dt=0.25, - tspan=(0.0, 100.0), nu=nu, smoothing_length=1.5 * particle_spacing, + tspan=(0.0, 100.0), nu, smoothing_length=1.5 * particle_spacing, fluid_smoothing_kernel=WendlandC2Kernel{3}(), - particle_spacing=particle_spacing, sound_speed=sound_speed, - fluid_density=fluid_density, fluid_size=fluid_size) + particle_spacing, sound_speed, + fluid_density, fluid_size) diff --git a/examples/fluid/sphere_surface_tension_wall_2d.jl b/examples/fluid/sphere_surface_tension_wall_2d.jl index 66ca1f1f44..88f0adbc81 100644 --- a/examples/fluid/sphere_surface_tension_wall_2d.jl +++ b/examples/fluid/sphere_surface_tension_wall_2d.jl @@ -51,7 +51,7 @@ alpha = 8 * nu / (fluid_smoothing_length * sound_speed) # `adhesion_coefficient = 1.0` and `surface_tension_coefficient = 0.01` for perfect wetting # `adhesion_coefficient = 0.001` and `surface_tension_coefficient = 2.0` for no wetting -viscosity = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0) +viscosity = ArtificialViscosityMonaghan(; alpha, beta=0.0) sphere_surface_tension = WeaklyCompressibleSPHSystem(sphere1; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, @@ -63,10 +63,10 @@ sphere_surface_tension = WeaklyCompressibleSPHSystem(sphere1; reference_particle_spacing=fluid_particle_spacing) trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"), - sphere=nothing, sphere1=sphere1, adhesion_coefficient=0.001, - wall_viscosity=4.0 * nu, surface_tension_coefficient=0.9, alpha=alpha, - sound_speed=sound_speed, fluid_density=fluid_density, nu=nu, - fluid_particle_spacing=fluid_particle_spacing, tspan=tspan, - tank_size=tank_size, fluid_smoothing_length=fluid_smoothing_length, - sphere_surface_tension=sphere_surface_tension) + joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); + sphere=nothing, sphere1, adhesion_coefficient=0.001, + wall_viscosity=4.0 * nu, surface_tension_coefficient=0.9, alpha, + sound_speed, fluid_density, nu, + fluid_particle_spacing, tspan, + tank_size, fluid_smoothing_length, + sphere_surface_tension) diff --git a/examples/fsi/falling_rotating_rigid_squares_w_buoys_2d.jl b/examples/fsi/falling_rotating_rigid_squares_w_buoys_2d.jl index 37efb627a9..194d27c20f 100644 --- a/examples/fsi/falling_rotating_rigid_squares_w_buoys_2d.jl +++ b/examples/fsi/falling_rotating_rigid_squares_w_buoys_2d.jl @@ -38,5 +38,5 @@ extra_structure_systems = [begin for x in small_sphere_x_positions] trixi_include(@__MODULE__, - joinpath(examples_dir(), "fsi", "falling_rotating_rigid_squares_2d.jl"), - extra_structure_systems=extra_structure_systems, tspan=tspan); + joinpath(examples_dir(), "fsi", "falling_rotating_rigid_squares_2d.jl"); + extra_structure_systems, tspan); diff --git a/examples/fsi/falling_water_column_2d.jl b/examples/fsi/falling_water_column_2d.jl index ac16ab8780..1c2a89351c 100644 --- a/examples/fsi/falling_water_column_2d.jl +++ b/examples/fsi/falling_water_column_2d.jl @@ -14,8 +14,8 @@ using OrdinaryDiffEq n_particles_y = 5 # Load setup from oscillating beam example -trixi_include(@__MODULE__, joinpath(examples_dir(), "structure", "oscillating_beam_2d.jl"), - thickness=0.05, n_particles_y=n_particles_y, +trixi_include(@__MODULE__, joinpath(examples_dir(), "structure", "oscillating_beam_2d.jl"); + thickness=0.05, n_particles_y, sol=nothing) # Don't run simulation, only include the setup part # Fluid resolution diff --git a/examples/preprocessing/packing_3d.jl b/examples/preprocessing/packing_3d.jl index ede3433b38..c16d1211f6 100644 --- a/examples/preprocessing/packing_3d.jl +++ b/examples/preprocessing/packing_3d.jl @@ -22,7 +22,7 @@ particle_spacing = 0.1 # how many rows of boundary particles will be sampled. boundary_thickness = 8 * particle_spacing -trixi_include(joinpath(examples_dir(), "preprocessing", "packing_2d.jl"), - density=1000.0, particle_spacing=particle_spacing, file=file, - boundary_thickness=boundary_thickness, place_on_shell=true, +trixi_include(joinpath(examples_dir(), "preprocessing", "packing_2d.jl"); + density=1000.0, particle_spacing, file, + boundary_thickness, place_on_shell=true, save_intervals=false) From c8ddbf05eb51fc2c99692aecf98cd2dd5aee409b Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Thu, 23 Apr 2026 12:45:07 +0200 Subject: [PATCH 11/56] even more unreq named keyword use --- docs/literate/src/tut_custom_kernel.jl | 8 +- docs/literate/src/tut_packing.jl | 48 +++++------ docs/literate/src/tut_rigid_body_fsi.jl | 32 +++---- docs/literate/src/tut_setup.jl | 14 ++-- src/callbacks/info.jl | 12 +-- src/callbacks/solution_saving.jl | 4 +- src/general/interpolation.jl | 8 +- src/general/semidiscretization.jl | 2 +- src/io/write_vtk.jl | 4 +- src/preprocessing/geometries/io.jl | 4 +- .../particle_packing/signed_distance.jl | 4 +- src/schemes/boundary/open_boundary/system.jl | 18 ++-- .../boundary/wall_boundary/dummy_particles.jl | 6 +- .../fluid/entropically_damped_sph/system.jl | 4 +- .../fluid/weakly_compressible_sph/system.jl | 2 +- src/setups/complex_shape.jl | 4 +- src/setups/extrude_geometry.jl | 4 +- src/setups/rectangular_shape.jl | 8 +- src/setups/rectangular_tank.jl | 4 +- test/count_allocations.jl | 4 +- test/examples/dam_break_2d_corrections.jl | 20 ++--- test/examples/examples_fluid.jl | 28 +++---- test/examples/gpu.jl | 30 +++---- test/general/custom_quantities.jl | 4 +- test/general/density_calculator.jl | 4 +- test/general/initial_condition.jl | 8 +- test/general/interpolation.jl | 68 +++++++-------- test/io/read_vtk.jl | 2 +- test/rectangular_patch.jl | 4 +- .../dummy_particles/dummy_particles.jl | 32 +++---- test/schemes/boundary/dummy_particles/rhs.jl | 2 +- .../open_boundary/dynamical_pressure.jl | 6 +- .../boundary/open_boundary/mirroring.jl | 2 +- .../boundary/open_boundary/open_boundary.jl | 2 +- .../boundary/open_boundary/pressure_model.jl | 4 +- test/schemes/fluid/rhs.jl | 6 +- test/schemes/fluid/surface_normal_sph.jl | 58 ++++++------- test/schemes/fluid/surface_tension.jl | 8 +- test/schemes/fluid/viscosity.jl | 18 ++-- .../weakly_compressible_sph/state_equation.jl | 6 +- test/setups/rectangular_shape.jl | 24 +++--- test/systems/edac_system.jl | 6 +- test/systems/iisph_system.jl | 10 +-- test/systems/rigid_system.jl | 84 +++++++++---------- test/systems/tlsph_system.jl | 10 +-- test/systems/wcsph_system.jl | 12 +-- validation/dam_break_2d/setup_marrone_2011.jl | 12 +-- .../dam_break_2d/validation_dam_break_2d.jl | 8 +- .../hydrostatic_water_column_2d/validation.jl | 10 +-- .../validation_lid_driven_cavity_2d.jl | 16 ++-- .../plot_oscillating_beam_results.jl | 2 +- .../validation_oscillating_beam_2d.jl | 4 +- .../validation_taylor_green_vortex_2d.jl | 16 ++-- 53 files changed, 360 insertions(+), 360 deletions(-) diff --git a/docs/literate/src/tut_custom_kernel.jl b/docs/literate/src/tut_custom_kernel.jl index 053f0c74a0..103a2780e6 100644 --- a/docs/literate/src/tut_custom_kernel.jl +++ b/docs/literate/src/tut_custom_kernel.jl @@ -117,13 +117,13 @@ nothing # hide # `examples/fluid/dam_break_2d.jl` with our custom kernel and the corresponding # smoothing length. # ```@cast @__NAME__; width=100, height=50, delay=0, loop=true, loop_delay=5 -# trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), +# trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); # smoothing_kernel=MyGaussianKernel(), -# smoothing_length=smoothing_length); +# smoothing_length); # ``` -trixi_include(joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), #!md +trixi_include(joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); #!md smoothing_kernel=MyGaussianKernel(), #!md - smoothing_length=smoothing_length) #!md + smoothing_length) #!md # See [Visualization](@ref) for how to visualize the final solution. # For the simplest visualization, we can use [Plots.jl](https://docs.juliaplots.org/stable/): diff --git a/docs/literate/src/tut_packing.jl b/docs/literate/src/tut_packing.jl index b7d492779b..c44291e26d 100644 --- a/docs/literate/src/tut_packing.jl +++ b/docs/literate/src/tut_packing.jl @@ -49,7 +49,7 @@ signed_distance_field = SignedDistanceField(geometry, particle_spacing; # We can also visualize the SDF by simply creating an `InitialCondition` from the sampled points and plot it. # The color coding represents the signed distance to the geometry surface. sdf_ic = InitialCondition(; coordinates=stack(signed_distance_field.positions), - density=1.0, particle_spacing=particle_spacing) + density=1.0, particle_spacing) plot(sdf_ic, zcolor=signed_distance_field.distances, label=nothing, color=:coolwarm) plot!(geometry, linestyle=:dash, label=nothing, showaxis=false, color=:black, @@ -64,7 +64,7 @@ signed_distance_field = SignedDistanceField(geometry, particle_spacing; # We can see in the plot that the SDF has been extended outwards to twice `max_signed_distance`. sdf_ic = InitialCondition(; coordinates=stack(signed_distance_field.positions), - density=1.0, particle_spacing=particle_spacing) + density=1.0, particle_spacing) plot(sdf_ic, zcolor=signed_distance_field.distances, label=nothing, color=:coolwarm) @@ -105,7 +105,7 @@ point_in_geometry_algorithm = WindingNumberJacobson(; geometry) # This function creates an [`InitialCondition`](@ref InitialCondition) for the interior particles. # Here, we need to specify `particle_spacing` and `density`. For further arguments, please refer to # the documentation of [ComplexShape](@ref ComplexShape) or [InitialCondition](@ref InitialCondition). -shape_sampled = ComplexShape(geometry; particle_spacing, density=density, +shape_sampled = ComplexShape(geometry; particle_spacing, density, point_in_geometry_algorithm) # If we want to assign the mass of each sampled particle consistently with its density, @@ -147,8 +147,8 @@ smoothing_length = 0.8 * particle_spacing # Now we can create the packing system. For learning purposes, let’s first try # passing no signed distance field (SDF) and see what happens. packing_system = ParticlePackingSystem(shape_sampled; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, + smoothing_length, signed_distance_field=nothing, background_pressure) # We now proceed with the familiar steps @@ -164,7 +164,7 @@ callbacks = CallbackSet(UpdateCallback()) time_integrator = RDPK3SpFSAL35() sol = solve(ode, time_integrator; - abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters=maxiters, + abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters, callback=callbacks) packed_ic = InitialCondition(sol, packing_system, semi) @@ -177,8 +177,8 @@ plot!(geometry, seriestype=:path, linewidth=2, color=:black, label=nothing) # We therefore add an SDF for the geometry and repeat the same procedure. packing_system = ParticlePackingSystem(shape_sampled; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, + smoothing_length, signed_distance_field, background_pressure) @@ -193,7 +193,7 @@ callbacks = CallbackSet(UpdateCallback()) time_integrator = RDPK3SpFSAL35() sol = solve(ode, time_integrator; - abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters=maxiters, + abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters, callback=callbacks) packed_ic = InitialCondition(sol, packing_system, semi) @@ -216,8 +216,8 @@ plot!(geometry, seriestype=:path, color=:black, label=nothing, linewidth=2) # geometry size in this example, we will choose `0.7`. boundary_system = ParticlePackingSystem(boundary_sampled; is_boundary=true, - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, + smoothing_length, boundary_compress_factor=0.7, signed_distance_field, background_pressure) @@ -232,7 +232,7 @@ callbacks = CallbackSet(UpdateCallback()) time_integrator = RDPK3SpFSAL35() sol = solve(ode, time_integrator; - abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters=maxiters, + abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters, callback=callbacks) packed_ic = InitialCondition(sol, packing_system, semi) @@ -255,8 +255,8 @@ plot!(geometry, seriestype=:path, color=:black, linestyle=:dash, linewidth=2, la # Therefore, we set `fixed_system=true` so that this system is not integrated further # but instead serves as a static boundary for the packing of other domains. fixed_system = ParticlePackingSystem(packed_ic; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, + smoothing_length, signed_distance_field=nothing, background_pressure, fixed_system=true) @@ -274,8 +274,8 @@ plot(sampled_outer_domain, packed_ic) # Next, we create a packing system for the outer domain. packing_system = ParticlePackingSystem(sampled_outer_domain; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, + smoothing_length, signed_distance_field=nothing, background_pressure) @@ -294,7 +294,7 @@ callbacks = CallbackSet(UpdateCallback()) time_integrator = RDPK3SpFSAL35() sol_1 = solve(ode, time_integrator; abstol=1e-7, reltol=1e-4, - save_everystep=false, maxiters=maxiters, callback=callbacks) + save_everystep=false, maxiters, callback=callbacks) packed_outer_domain = InitialCondition(sol_1, packing_system, semi) @@ -324,21 +324,21 @@ plot(pack_domain, fixed_domain, packed_ic) # We can now treat the particles outside the window, along with the already # finalized configuration of the complex geometry, as fixed systems: fixed_system_1 = ParticlePackingSystem(fixed_domain; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, + smoothing_length, signed_distance_field=nothing, background_pressure, fixed_system=true) fixed_system_2 = ParticlePackingSystem(packed_ic; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, + smoothing_length, signed_distance_field=nothing, background_pressure, fixed_system=true) # The window that we want to pack is passed to a moving packing system: packing_system = ParticlePackingSystem(pack_domain; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, + smoothing_length, signed_distance_field=nothing, background_pressure) @@ -352,7 +352,7 @@ callbacks = CallbackSet(UpdateCallback()) time_integrator = RDPK3SpFSAL35() sol_2 = solve(ode, time_integrator; abstol=1e-7, reltol=1e-4, - save_everystep=false, maxiters=maxiters, callback=callbacks) + save_everystep=false, maxiters, callback=callbacks) packed_fluid_domain = InitialCondition(sol_2, packing_system, semi) diff --git a/docs/literate/src/tut_rigid_body_fsi.jl b/docs/literate/src/tut_rigid_body_fsi.jl index 80badfe6b5..09ad054f1d 100644 --- a/docs/literate/src/tut_rigid_body_fsi.jl +++ b/docs/literate/src/tut_rigid_body_fsi.jl @@ -42,10 +42,10 @@ sound_speed = 100.0 state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation=state_equation) + acceleration=(0.0, -gravity), state_equation) nothing # hide # ## Rigid body geometry @@ -101,9 +101,9 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, - density_diffusion=density_diffusion, + state_equation, + viscosity, + density_diffusion, acceleration=(0.0, -gravity)) nothing # hide @@ -169,10 +169,10 @@ nothing # hide boundary_density_calculator = AdamiPressureExtrapolation() tank_boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, boundary_density_calculator, fluid_smoothing_kernel, - fluid_smoothing_length) + fluid_smoothing_length; + state_equation) boundary_system = WallBoundarySystem(tank.boundary, tank_boundary_model) nothing # hide @@ -183,10 +183,10 @@ function rigid_body_boundary_model(shape) structure_particle_spacing^ndims(fluid_system) return BoundaryModelDummyParticles(hydrodynamic_densities, hydrodynamic_masses, - state_equation=state_equation, boundary_density_calculator, fluid_smoothing_kernel, - fluid_smoothing_length) + fluid_smoothing_length; + state_equation) end square1_boundary_model = rigid_body_boundary_model(square1) @@ -239,12 +239,12 @@ nothing # hide rigid_body_system_1_step3 = RigidBodySystem(square1; boundary_model=square1_boundary_model, - contact_model=contact_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) rigid_body_system_2_step3 = RigidBodySystem(square2; boundary_model=square2_boundary_model, - contact_model=contact_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) nothing # hide @@ -306,12 +306,12 @@ nothing # hide rigid_body_system_1_step4 = RigidBodySystem(circle1; boundary_model=circle1_boundary_model, - contact_model=contact_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) rigid_body_system_2_step4 = RigidBodySystem(circle2; boundary_model=circle2_boundary_model, - contact_model=contact_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) nothing # hide @@ -364,7 +364,7 @@ small_sphere_systems = [begin sphere_boundary_model = rigid_body_boundary_model(sphere) RigidBodySystem(sphere; boundary_model=sphere_boundary_model, - contact_model=contact_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) end @@ -423,7 +423,7 @@ hexagon_boundary_model = rigid_body_boundary_model(hexagon_shape) hexagon_system = RigidBodySystem(hexagon_shape; boundary_model=hexagon_boundary_model, - contact_model=contact_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) # diff --git a/docs/literate/src/tut_setup.jl b/docs/literate/src/tut_setup.jl index 7c3dcbc9bc..a115b63599 100644 --- a/docs/literate/src/tut_setup.jl +++ b/docs/literate/src/tut_setup.jl @@ -80,8 +80,8 @@ nothing # hide # fluid inside a rectangular tank, and supports a hydrostatic pressure gradient # by passing a gravitational acceleration and a state equation (see above). tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, - fluid_density, n_layers=boundary_layers, - acceleration=(0.0, -gravity), state_equation=state_equation) + fluid_density; n_layers=boundary_layers, + acceleration=(0.0, -gravity), state_equation) nothing # hide # A `RectangularTank` consists of two [`InitialCondition`](@ref)s, `tank.fluid` and `tank.boundary`. # We can plot these initial conditions to visualize the initial setup. @@ -123,9 +123,9 @@ density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation=state_equation, - viscosity=viscosity, - density_diffusion=density_diffusion, + state_equation, + viscosity, + density_diffusion, acceleration=(0.0, -gravity)) nothing # hide @@ -138,9 +138,9 @@ nothing # hide # We will use the [`BoundaryModelDummyParticles`](@ref) with [`AdamiPressureExtrapolation`](@ref). # See [here](@ref boundary_models) for a comprehensive overview over boundary models. boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass, - state_equation=state_equation, AdamiPressureExtrapolation(), - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation) boundary_system = WallBoundarySystem(tank.boundary, boundary_model) nothing # hide diff --git a/src/callbacks/info.jl b/src/callbacks/info.jl index 59b6d3454e..968476fee0 100644 --- a/src/callbacks/info.jl +++ b/src/callbacks/info.jl @@ -40,9 +40,9 @@ function InfoCallback(; interval=0, reset_threads=true) reset_threads) end - DiscreteCallback(info_callback, info_callback, + DiscreteCallback(info_callback, info_callback; save_positions=(false, false), - initialize=initialize) + initialize) end # condition @@ -163,7 +163,7 @@ function format_key_value_line(key::AbstractString, value::AbstractString, key_w # Indent the key as requested (or not at all if `indentation_level == 0`) indentation = prefix^indentation_level reduced_key_width = key_width - length(indentation) - squeezed_key = indentation * squeeze(key, reduced_key_width, filler=filler) + squeezed_key = indentation * squeeze(key, reduced_key_width; filler) line *= squeezed_key line *= ": " short = key_width - length(squeezed_key) @@ -173,7 +173,7 @@ function format_key_value_line(key::AbstractString, value::AbstractString, key_w line *= guide^(short - 1) * " " end value_width = total_width - length(prefix) - length(suffix) - key_width - 2 - squeezed_value = squeeze(value, value_width, filler=filler) + squeezed_value = squeeze(value, value_width; filler) line *= squeezed_value short = value_width - length(squeezed_value) line *= " "^short @@ -239,8 +239,8 @@ function summary_line(io, key, value; key_width=30, total_width=100, indentation total_width = get(io, :total_width, total_width) indentation_level = get(io, :indentation_level, indentation_level) - s = format_key_value_line(key, value, key_width, total_width, - indentation_level=indentation_level) + s = format_key_value_line(key, value, key_width, total_width; + indentation_level) println(io, s) end diff --git a/src/callbacks/solution_saving.jl b/src/callbacks/solution_saving.jl index 1fbdae547a..523af063e2 100644 --- a/src/callbacks/solution_saving.jl +++ b/src/callbacks/solution_saving.jl @@ -158,8 +158,8 @@ end function (solution_callback::SolutionSavingCallback)(u, t, integrator) (; interval, save_final_solution) = solution_callback - return condition_integrator_interval(integrator, interval, - save_final_solution=save_final_solution) + return condition_integrator_interval(integrator, interval; + save_final_solution) end # `affect!` diff --git a/src/general/interpolation.jl b/src/general/interpolation.jl index 58b171d0f7..e8ba54ed97 100644 --- a/src/general/interpolation.jl +++ b/src/general/interpolation.jl @@ -405,8 +405,8 @@ function interpolate_line(start, end_, n_points, semi, ref_system, v_ode, u_ode; points_coords_ = collect(reinterpret(reshape, eltype(start_svector), points_coords)) return interpolate_points(points_coords_, semi, ref_system, v_ode, u_ode; - smoothing_length=smoothing_length, include_wall_velocity, - cut_off_bnd=cut_off_bnd, clip_negative_pressure) + smoothing_length, include_wall_velocity, + cut_off_bnd, clip_negative_pressure) end @doc raw""" @@ -637,8 +637,8 @@ end end end - return (; computed_density=computed_density, point_coords=point_coords, - neighbor_count=neighbor_count, cache...) + return (; computed_density, point_coords, + neighbor_count, cache...) end @inline function create_cache_interpolation(ref_system::AbstractFluidSystem, n_points, semi) diff --git a/src/general/semidiscretization.jl b/src/general/semidiscretization.jl index b2d7a20b04..740b6044a9 100644 --- a/src/general/semidiscretization.jl +++ b/src/general/semidiscretization.jl @@ -711,7 +711,7 @@ function system_interaction!(dv_ode, v_ode, u_ode, semi) timer_str = "" end - interact!(dv_ode, v_ode, u_ode, system, neighbor, semi, timer_str=timer_str) + interact!(dv_ode, v_ode, u_ode, system, neighbor, semi; timer_str) end end diff --git a/src/io/write_vtk.jl b/src/io/write_vtk.jl index 2ac9c0694b..6f3a9bfdf6 100644 --- a/src/io/write_vtk.jl +++ b/src/io/write_vtk.jl @@ -310,10 +310,10 @@ function trixi2vtk(initial_condition::InitialCondition; output_directory="out", (; coordinates, velocity, density, mass, pressure) = initial_condition return trixi2vtk(coordinates; output_directory, prefix, filename, - density=density, initial_velocity=velocity, mass=mass, + density, initial_velocity=velocity, mass, particle_spacing=(initial_condition.particle_spacing .* ones(nparticles(initial_condition))), - pressure=pressure, custom_quantities...) + pressure, custom_quantities...) end function write2vtk!(vtk, v, u, t, system) diff --git a/src/preprocessing/geometries/io.jl b/src/preprocessing/geometries/io.jl index ea97f6dcf1..eb5b48148e 100644 --- a/src/preprocessing/geometries/io.jl +++ b/src/preprocessing/geometries/io.jl @@ -279,7 +279,7 @@ function trixi2vtk(geometry::Polygon; output_directory="out", prefix="", end return trixi2vtk(stack(vertices); output_directory, filename, prefix, - vertex_normals=vertex_normals, custom_quantities...) + vertex_normals, custom_quantities...) end function trixi2vtk(geometry::TriangleMesh; output_directory="out", prefix="", @@ -288,5 +288,5 @@ function trixi2vtk(geometry::TriangleMesh; output_directory="out", prefix="", for face in eachindex(geometry.vertices)]) return trixi2vtk(stack(geometry.vertices); output_directory, filename, prefix, - vertex_normals=vertex_normals, custom_quantities...) + vertex_normals, custom_quantities...) end diff --git a/src/preprocessing/particle_packing/signed_distance.jl b/src/preprocessing/particle_packing/signed_distance.jl index e6bbc6891f..33818e83c7 100644 --- a/src/preprocessing/particle_packing/signed_distance.jl +++ b/src/preprocessing/particle_packing/signed_distance.jl @@ -103,8 +103,8 @@ function trixi2vtk(signed_distance_field::SignedDistanceField; (; positions, distances, normals) = signed_distance_field positions = stack(signed_distance_field.positions) - trixi2vtk(positions, signed_distances=distances, normals=normals, - filename=filename, output_directory=output_directory) + trixi2vtk(positions; signed_distances=distances, normals, + filename, output_directory) end delete_positions_in_empty_cells!(positions, nhs::TrivialNeighborhoodSearch) = positions diff --git a/src/schemes/boundary/open_boundary/system.jl b/src/schemes/boundary/open_boundary/system.jl index 16f4dd7910..f2bb5416e0 100644 --- a/src/schemes/boundary/open_boundary/system.jl +++ b/src/schemes/boundary/open_boundary/system.jl @@ -143,9 +143,9 @@ function create_cache_open_boundary(boundary_model, fluid_system, initial_condit density_reference_values = map(ref -> ref.reference_density, reference_values) velocity_reference_values = map(ref -> ref.reference_velocity, reference_values) - cache = (; pressure_reference_values=pressure_reference_values, - density_reference_values=density_reference_values, - velocity_reference_values=velocity_reference_values) + cache = (; pressure_reference_values, + density_reference_values, + velocity_reference_values) if calculate_flow_rate || any(pr -> isa(pr, RCRWindkesselModel), cache.pressure_reference_values) @@ -164,8 +164,8 @@ function create_cache_open_boundary(boundary_model, fluid_system, initial_condit characteristics = zeros(ELTYPE, 3, nparticles(initial_condition)) previous_characteristics = zeros(ELTYPE, 3, nparticles(initial_condition)) - return (; characteristics=characteristics, - previous_characteristics=previous_characteristics, + return (; characteristics, + previous_characteristics, pressure=copy(initial_condition.pressure), density=copy(initial_condition.density), cache...) @@ -178,10 +178,10 @@ function create_cache_open_boundary(boundary_model, fluid_system, initial_condit # as it was already verified in `allocate_buffer` that the density array is constant. density_rest = first(initial_condition.density) - cache = (; density_diffusion=density_diffusion, + cache = (; density_diffusion, create_cache_density_diffusion(initial_condition, density_diffusion)..., - pressure_boundary=pressure_boundary, - density_rest=density_rest, cache...) + pressure_boundary, + density_rest, cache...) if fluid_system isa EntropicallyDampedSPHSystem # Density and pressure is stored in `v` @@ -654,7 +654,7 @@ function interpolate_velocity!(system::OpenBoundarySystem, boundary_zone, # We can do this because we require the neighborhood search to support querying neighbors # of arbitrary positions (see `PointNeighbors.requires_update` and `check_configuration`). foreach_point_neighbor(system, neighbor_system, sample_points, neighbor_coords, - semi, points=points) do point, neighbor, pos_diff, distance + semi; points) do point, neighbor, pos_diff, distance m_b = @inbounds hydrodynamic_mass(neighbor_system, neighbor) rho_b = @inbounds current_density(v_neighbor, neighbor_system, neighbor) volume_b = m_b / rho_b diff --git a/src/schemes/boundary/wall_boundary/dummy_particles.jl b/src/schemes/boundary/wall_boundary/dummy_particles.jl index 6927e0d7e5..79e9328f6d 100644 --- a/src/schemes/boundary/wall_boundary/dummy_particles.jl +++ b/src/schemes/boundary/wall_boundary/dummy_particles.jl @@ -74,7 +74,7 @@ function BoundaryModelDummyParticles(initial_density, hydrodynamic_mass, # `reference_particle_spacing` has to be set for surface normals to be determined cache = (; cache..., # Existing cache fields - reference_particle_spacing=reference_particle_spacing, + reference_particle_spacing, initial_colorfield=zeros(ELTYPE, n_particles), colorfield=zeros(ELTYPE, n_particles), neighbor_count=zeros(ELTYPE, n_particles)) @@ -201,7 +201,7 @@ struct PressureBoundaries{ELTYPE} return new{eltype(time_step)}(time_step, omega) end end -@inline create_cache_model(correction, density, NDIMS, nparticles) = (;) +@inline create_cache_model(correction, density, NDIMS, nparticles) = (; ) function create_cache_model(::ShepardKernelCorrection, density, NDIMS, n_particles) return (; kernel_correction_coefficient=similar(density)) @@ -267,7 +267,7 @@ function create_cache_model(initial_density, return (; density, volume) end -@inline create_cache_model(viscosity::Nothing, n_particles, n_dims) = (;) +@inline create_cache_model(viscosity::Nothing, n_particles, n_dims) = (; ) function create_cache_model(viscosity, n_particles, n_dims) ELTYPE = eltype(viscosity.epsilon) diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index c55b8374bf..ec4aa45bed 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -176,7 +176,7 @@ function EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, # `reference_particle_spacing` has to be set for surface normals to be determined cache = (; cache..., # Existing cache fields - reference_particle_spacing=reference_particle_spacing) + reference_particle_spacing) end EntropicallyDampedSPHSystem{NDIMS, ELTYPE, typeof(initial_condition), typeof(mass), @@ -196,7 +196,7 @@ function EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, particle_refinement, cache) end -create_cache_avg_pressure_reduction(initial_condition, ::Val{false}) = (;) +create_cache_avg_pressure_reduction(initial_condition, ::Val{false}) = (; ) function create_cache_avg_pressure_reduction(initial_condition, ::Val{true}) pressure_average = copy(initial_condition.pressure) diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index bc0def9fde..b2cd9dd5f0 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -176,7 +176,7 @@ function WeaklyCompressibleSPHSystem(initial_condition, density_calculator, stat # `reference_particle_spacing` has to be set for surface normals to be determined cache = (; cache..., # Existing cache fields - reference_particle_spacing=reference_particle_spacing) + reference_particle_spacing) end return WeaklyCompressibleSPHSystem(initial_condition, mass, pressure, diff --git a/src/setups/complex_shape.jl b/src/setups/complex_shape.jl index 55d3c996af..911badb17c 100644 --- a/src/setups/complex_shape.jl +++ b/src/setups/complex_shape.jl @@ -70,8 +70,8 @@ function ComplexShape(geometry; particle_spacing, density, # This is most likely only useful for debugging. Note that this is not public API. if store_winding_number - return (; initial_condition=initial_condition, winding_numbers=winding_numbers, - grid=grid) + return (; initial_condition, winding_numbers, + grid) end return initial_condition diff --git a/src/setups/extrude_geometry.jl b/src/setups/extrude_geometry.jl index 3ff618205f..460583c38e 100644 --- a/src/setups/extrude_geometry.jl +++ b/src/setups/extrude_geometry.jl @@ -103,7 +103,7 @@ function extrude_geometry(geometry; particle_spacing=-1, direction, n_extrude::I geometry = shift_plane_corners(geometry, direction_, particle_spacing, place_on_shell) - face_coords = sample_plane(geometry, particle_spacing; place_on_shell=place_on_shell) + face_coords = sample_plane(geometry, particle_spacing; place_on_shell) coords = (face_coords .+ i * particle_spacing * direction_ for i in 0:(n_extrude - 1)) @@ -115,7 +115,7 @@ function extrude_geometry(geometry; particle_spacing=-1, direction, n_extrude::I end return InitialCondition(; coordinates, velocity, density, mass, pressure, - particle_spacing=particle_spacing) + particle_spacing) end # For corners/endpoints of a plane/line, sample the plane/line with particles. diff --git a/src/setups/rectangular_shape.jl b/src/setups/rectangular_shape.jl index ff7c9d9b26..4fb97b2020 100644 --- a/src/setups/rectangular_shape.jl +++ b/src/setups/rectangular_shape.jl @@ -59,8 +59,8 @@ rectangular = RectangularShape(particle_spacing, (5, 4), (1.0, 2.0), density=100 # 2D with hydrostatic pressure gradient. # `state_equation` has to be the same as for the WCSPH system. state_equation = StateEquationCole(sound_speed=20.0, exponent=7, reference_density=1000.0) -rectangular = RectangularShape(particle_spacing, (5, 4), (1.0, 2.0), - acceleration=(0.0, -9.81), state_equation=state_equation) +rectangular = RectangularShape(particle_spacing, (5, 4), (1.0, 2.0); + acceleration=(0.0, -9.81), state_equation) # 3D rectangular = RectangularShape(particle_spacing, (5, 4, 7), (1.0, 2.0, 3.0), density=1000.0) @@ -103,8 +103,8 @@ function RectangularShape(particle_spacing, n_particles_per_dimension, min_coord # The type of the particle spacing determines the eltype of the coordinates coordinates = rectangular_shape_coords(convert(coordinates_eltype, particle_spacing), n_particles_per_dimension, - min_coordinates, place_on_shell=place_on_shell, - loop_order=loop_order) + min_coordinates; place_on_shell, + loop_order) if !isnothing(coordinates_perturbation) seed!(1) diff --git a/src/setups/rectangular_tank.jl b/src/setups/rectangular_tank.jl index 768f4723bd..2b59bbc8b0 100644 --- a/src/setups/rectangular_tank.jl +++ b/src/setups/rectangular_tank.jl @@ -70,8 +70,8 @@ setup = RectangularTank(particle_spacing, (water_width, water_height), # `state_equation` has to be the same as for the WCSPH system. state_equation = StateEquationCole(sound_speed=10.0, exponent=1, reference_density=1000.0) setup = RectangularTank(particle_spacing, (water_width, water_height), - (container_width, container_height), fluid_density, - acceleration=(0.0, -9.81), state_equation=state_equation) + (container_width, container_height), fluid_density; + acceleration=(0.0, -9.81), state_equation) # 3D setup = RectangularTank(particle_spacing, (water_width, water_height, water_depth), diff --git a/test/count_allocations.jl b/test/count_allocations.jl index 8303616e91..c96ddd8eda 100644 --- a/test/count_allocations.jl +++ b/test/count_allocations.jl @@ -22,8 +22,8 @@ end particle; search_radius=PointNeighbors.search_radius(neighborhood_search.nhs)) PointNeighbors.foreach_neighbor(f, system_coords, neighbor_coords, - neighborhood_search.nhs, particle, - search_radius=search_radius) + neighborhood_search.nhs, particle; + search_radius) end # No update diff --git a/test/examples/dam_break_2d_corrections.jl b/test/examples/dam_break_2d_corrections.jl index 9c3e29fbe7..03691e8d70 100644 --- a/test/examples/dam_break_2d_corrections.jl +++ b/test/examples/dam_break_2d_corrections.jl @@ -63,14 +63,14 @@ @testset "continuity_reinit" begin @trixi_test_nowarn trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", - "dam_break_2d.jl"), + "dam_break_2d.jl"); fluid_particle_spacing=particle_spacing, smoothing_length=1.5 * particle_spacing, boundary_density_calculator=ContinuityDensity(), fluid_density_calculator=ContinuityDensity(), correction=nothing, use_reinit=true, - prefix="continuity_reinit", tspan=tspan, - fluid_density=fluid_density, + prefix="continuity_reinit", tspan, + fluid_density, density_diffusion=nothing) @test sol.retcode == ReturnCode.Success @@ -88,17 +88,17 @@ @trixi_test_nowarn trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", - "dam_break_2d.jl"), + "dam_break_2d.jl"); fluid_particle_spacing=particle_spacing, - smoothing_length=smoothing_length, + smoothing_length, boundary_density_calculator=SummationDensity(), - fluid_density_calculator=fluid_density_calculator, - correction=correction, use_reinit=false, + fluid_density_calculator, + correction, use_reinit=false, clip_negative_pressure=(fluid_density_calculator isa SummationDensity), - smoothing_kernel=smoothing_kernel, - prefix="$(correction_name)", tspan=tspan, - fluid_density=fluid_density, + smoothing_kernel, + prefix="$(correction_name)", tspan, + fluid_density, density_diffusion=nothing, boundary_layers=5, sol=nothing) diff --git a/test/examples/examples_fluid.jl b/test/examples/examples_fluid.jl index 00827e0048..56e0869aa4 100644 --- a/test/examples/examples_fluid.jl +++ b/test/examples/examples_fluid.jl @@ -52,33 +52,33 @@ smoothing_kernel=WendlandC6Kernel{2}()), "EDAC with source term damping" => (source_terms=SourceTermDamping(damping_coefficient=1e-4), fluid_system=EntropicallyDampedSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed, + smoothing_kernel, + smoothing_length, + sound_speed, viscosity=viscosity_fluid, density_calculator=ContinuityDensity(), acceleration=(0.0, -gravity))), "EDAC with SummationDensity" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed, + smoothing_kernel, + smoothing_length, + sound_speed, viscosity=viscosity_fluid, density_calculator=SummationDensity(), acceleration=(0.0, -gravity)),), "EDAC with ViscosityAdami" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed, + smoothing_kernel, + smoothing_length, + sound_speed, viscosity=ViscosityAdami(nu=0.0015), density_calculator=ContinuityDensity(), acceleration=(0.0, -gravity)),), "EDAC with ViscosityMorris" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed, + smoothing_kernel, + smoothing_length, + sound_speed, viscosity=ViscosityMorris(nu=0.0015), density_calculator=ContinuityDensity(), acceleration=(0.0, @@ -593,7 +593,7 @@ # Prepare keyword arguments kwargs = model_name == "SurfaceTensionNone" ? (surface_tension=nothing,) : - (surface_tension=surface_tension,) + (surface_tensionn,) # Execute the example script with the current surface tension model @trixi_test_nowarn trixi_include(@__MODULE__, @@ -626,7 +626,7 @@ # Prepare keyword arguments kwargs = model_name == "SurfaceTensionNone" ? (surface_tension=nothing,) : - (surface_tension=surface_tension,) + (surface_tensionn,) # Execute the example script with the current surface tension model @trixi_test_nowarn trixi_include(@__MODULE__, diff --git a/test/examples/gpu.jl b/test/examples/gpu.jl index 7b8ef18504..5109f22a3c 100644 --- a/test/examples/gpu.jl +++ b/test/examples/gpu.jl @@ -229,7 +229,7 @@ end coordinates_eltype=Float32, boundary_layers=1, spacing_ratio=3, - boundary_model=boundary_model, + boundary_model, parallelization_backend=Main.parallelization_backend) [ r"\[ Info: To move data to the GPU, `semidiscretize` creates a deep copy.*\n", r"┌ Info: The desired tank length in y-direction.*\n", @@ -267,12 +267,12 @@ end @trixi_test_nowarn trixi_include_changeprecision(Float32, @__MODULE__, joinpath(examples_dir(), "fluid", - "dam_break_3d.jl"), + "dam_break_3d.jl"); tspan=(0.0f0, 0.1f0), coordinates_eltype=Float32, fluid_particle_spacing=0.1, semi=semi_fullgrid, - maxiters=maxiters) [ + maxiters) [ r"\[ Info: To move data to the GPU, `semidiscretize` creates a deep copy.*\n" ] @test sol.retcode == ReturnCode.Success @@ -309,9 +309,9 @@ end # Create tank with Float32 coordinates tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, - tank_size, fluid_density, n_layers=boundary_layers, + tank_size, fluid_density; n_layers=boundary_layers, acceleration=(0.0f0, -gravity), - state_equation=state_equation, + state_equation, coordinates_eltype=Float32) hydrostatic_water_column_tests = Dict( @@ -343,17 +343,17 @@ end smoothing_kernel=WendlandC6Kernel{2}()), "EDAC with source term damping" => (source_terms=SourceTermDamping(damping_coefficient=1.0f-4), fluid_system=EntropicallyDampedSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed, + smoothing_kernel, + smoothing_length, + sound_speed, viscosity=viscosity_fluid, density_calculator=ContinuityDensity(), acceleration=(0.0, -gravity))), "EDAC with SummationDensity" => (fluid_system=EntropicallyDampedSPHSystem(tank.fluid; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed, + smoothing_kernel, + smoothing_length, + sound_speed, viscosity=viscosity_fluid, density_calculator=SummationDensity(), acceleration=(0.0, @@ -369,7 +369,7 @@ end trixi_include_changeprecision(Float32, @__MODULE__, joinpath(examples_dir(), "fluid", "hydrostatic_water_column_2d.jl"); - sol=nothing, ode=nothing, tank=tank, + sol=nothing, ode=nothing, tank, kwargs...) # Neighborhood search with `FullGridCellList` for GPU compatibility @@ -388,7 +388,7 @@ end "fluid", "hydrostatic_water_column_2d.jl"); semi=semi_fullgrid, - tank=tank, + tank, tspan=(0.0f0, 0.1f0), kwargs...) [ r"\[ Info: To move data to the GPU, `semidiscretize` creates a deep copy.*\n", @@ -667,10 +667,10 @@ end @trixi_test_nowarn trixi_include_changeprecision(Float32, @__MODULE__, joinpath(examples_dir(), "dem", - "rectangular_tank_2d.jl"), + "rectangular_tank_2d.jl"); tspan=(0.0f0, 0.05f0), coordinates_eltype=Float32, - neighborhood_search=neighborhood_search, + neighborhood_search, parallelization_backend=Main.parallelization_backend) [ r"\[ Info: To move data to the GPU, `semidiscretize` creates a deep copy.*\n" ] diff --git a/test/general/custom_quantities.jl b/test/general/custom_quantities.jl index d5ebc21a1c..b7cbcb132d 100644 --- a/test/general/custom_quantities.jl +++ b/test/general/custom_quantities.jl @@ -13,8 +13,8 @@ smoothing_length = 1.2 * particle_spacing fluid_system = EntropicallyDampedSPHSystem(initial_condition; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, + smoothing_kernel, + smoothing_length, sound_speed=1.0) fluid_system.cache.density .= initial_condition.density diff --git a/test/general/density_calculator.jl b/test/general/density_calculator.jl index 6bf895f7be..93b6ff188e 100644 --- a/test/general/density_calculator.jl +++ b/test/general/density_calculator.jl @@ -15,8 +15,8 @@ fluid_system = WeaklyCompressibleSPHSystem(initial_condition, SummationDensity(), state_equation, - smoothing_kernel, smoothing_length, - viscosity=viscosity) + smoothing_kernel, smoothing_length; + viscosity) (; cache) = fluid_system (; density) = cache # Density is in the cache for SummationDensity diff --git a/test/general/initial_condition.jl b/test/general/initial_condition.jl index 2d16828274..f94f2184c9 100644 --- a/test/general/initial_condition.jl +++ b/test/general/initial_condition.jl @@ -394,8 +394,8 @@ density = [10.0, 20.0, 30.0, 40.0, 50.0] pressure = [100.0, 200.0, 300.0, 400.0, 500.0] - ic = InitialCondition(coordinates=coordinates, velocity=velocity, - mass=mass, density=density, pressure=pressure) + ic = InitialCondition(coordinatess, velocity, + mass, density, pressure) # Move particles 2 and 4 to the end particle_ids_to_move = [2, 4] @@ -423,8 +423,8 @@ mass = [1.1, 2.2, 3.3, 4.4] density = [10.0, 20.0, 30.0, 40.0] - ic = InitialCondition(coordinates=coordinates, velocity=velocity, - mass=mass, density=density) + ic = InitialCondition(coordinatess, velocity, + mass, density) # Move particle 2 multiple times (should only move once) TrixiParticles.move_particles_to_end!(ic, [2, 2, 3]) diff --git a/test/general/interpolation.jl b/test/general/interpolation.jl index e620c8a7ac..9689d00fd4 100644 --- a/test/general/interpolation.jl +++ b/test/general/interpolation.jl @@ -102,14 +102,14 @@ fluid_system = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity, + smoothing_length; viscosity, acceleration=(0.0, -9.81)) boundary_model = BoundaryModelDummyParticles(bnd.density, bnd.mass, - state_equation=state_equation, - viscosity=viscosity, AdamiPressureExtrapolation(), - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation, + viscosity) boundary_system = WallBoundarySystem(bnd, boundary_model) @@ -141,8 +141,8 @@ semi_no_boundary, fluid_system, v_no_bnd, - u_no_bnd, - cut_off_bnd=cut_off_bnd) + u_no_bnd; + cut_off_bnd) # Top outside distance_top_outside = binary_search_outside(ny * particle_spacing, @@ -206,8 +206,8 @@ result_multipoint = TrixiParticles.interpolate_points(multi_point_coords, semi_no_boundary, fluid_system, - v_no_bnd, u_no_bnd, - cut_off_bnd=cut_off_bnd) + v_no_bnd, u_no_bnd; + cut_off_bnd) expected_multi = (density=[666.0, 666.0000000000001, 666.0], neighbor_count=[2, 6, 5], @@ -222,15 +222,15 @@ result_endpoint = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], 5, semi_no_boundary, fluid_system, - v_no_bnd, u_no_bnd, + v_no_bnd, u_no_bnd; endpoint=true, - cut_off_bnd=cut_off_bnd) + cut_off_bnd) result = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], 5, semi_no_boundary, - fluid_system, v_no_bnd, u_no_bnd, + fluid_system, v_no_bnd, u_no_bnd; endpoint=false, - cut_off_bnd=cut_off_bnd) + cut_off_bnd) expected_res = (density=[666.0, 666.0, 666.0], neighbor_count=[2, 2, 1], point_coords=[1.0 1.0 1.0; @@ -354,8 +354,8 @@ semi_boundary, fluid_system, v_bnd, - u_bnd, - cut_off_bnd=cut_off_bnd) + u_bnd; + cut_off_bnd) # Top outside distance_top_outside = binary_search_outside(ny * particle_spacing, @@ -441,8 +441,8 @@ result_multipoint = TrixiParticles.interpolate_points(multi_point_coords, semi_boundary, fluid_system, - v_bnd, u_bnd, - cut_off_bnd=cut_off_bnd) + v_bnd, u_bnd; + cut_off_bnd) if cut_off_bnd expected_multi = (density=[666.0, 666.0000000000001, 666.0], neighbor_count=[4, 6, 5], @@ -475,15 +475,15 @@ result_endpoint = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], 5, semi_boundary, fluid_system, - v_bnd, u_bnd, + v_bnd, u_bnd; endpoint=true, - cut_off_bnd=cut_off_bnd) + cut_off_bnd) result = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], 5, semi_no_boundary, - fluid_system, v_no_bnd, u_no_bnd, + fluid_system, v_no_bnd, u_no_bnd; endpoint=false, - cut_off_bnd=cut_off_bnd) + cut_off_bnd) if cut_off_bnd expected_res = (density=[666.0, 666.0, 666.0], neighbor_count=[2, 2, 1], point_coords=[1.0 1.0 1.0; @@ -618,8 +618,8 @@ const_pressure = [2 * new_wall_distance] const_velocity = [5; 0.1 * new_wall_distance^2+0.1; 0.0;;] - return (density=const_density, - neighbor_count=neighbor_count, + return (; density=const_density, + neighbor_count, point_coords=[0.0; wall_distance; 0.0;;], velocity=const_velocity, pressure=const_pressure) @@ -653,14 +653,14 @@ fluid_system = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity, + smoothing_length; viscosity, acceleration=(0.0, -9.81, 0.0)) boundary_model = BoundaryModelDummyParticles(bnd.density, bnd.mass, - state_equation=state_equation, - viscosity=viscosity, AdamiPressureExtrapolation(), - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation, + viscosity) boundary_system = WallBoundarySystem(bnd, boundary_model) @@ -694,8 +694,8 @@ semi_no_boundary, fluid_system, v_no_bnd, - u_no_bnd, - cut_off_bnd=cut_off_bnd) + u_no_bnd; + cut_off_bnd) # Top outside distance_top_outside = binary_search_outside(ny * particle_spacing, @@ -763,8 +763,8 @@ result_multipoint = TrixiParticles.interpolate_points(multi_point_coords, semi_no_boundary, fluid_system, - v_no_bnd, u_no_bnd, - cut_off_bnd=cut_off_bnd) + v_no_bnd, u_no_bnd; + cut_off_bnd) expected_multi = (density=[666.0, 666.0, 666.0], neighbor_count=[4, 4, 9], point_coords=multi_point_coords, @@ -785,8 +785,8 @@ semi_boundary, fluid_system, v_no_bnd, - u_no_bnd, - cut_off_bnd=cut_off_bnd) + u_no_bnd; + cut_off_bnd) # Top outside distance_top_outside = binary_search_outside(ny * particle_spacing, @@ -871,8 +871,8 @@ result_multipoint = TrixiParticles.interpolate_points(multi_point_coords, semi_no_boundary, fluid_system, - v_no_bnd, u_no_bnd, - cut_off_bnd=cut_off_bnd) + v_no_bnd, u_no_bnd; + cut_off_bnd) expected_multi = (density=[666.0, 666.0, 666.0], neighbor_count=[4, 4, 9], point_coords=multi_point_coords, diff --git a/test/io/read_vtk.jl b/test/io/read_vtk.jl index c6fab0cd79..f19a0554c6 100644 --- a/test/io/read_vtk.jl +++ b/test/io/read_vtk.jl @@ -3,7 +3,7 @@ coordinates = fill(1.0, 2, 12) velocity = fill(2.0, 2, 12) - expected_data = InitialCondition(coordinates=coordinates, velocity=velocity, + expected_data = InitialCondition(coordinatess, velocity, density=1000.0, pressure=900.0, particle_spacing=0.1) diff --git a/test/rectangular_patch.jl b/test/rectangular_patch.jl index 42e3ef2e9a..32b59d2e59 100644 --- a/test/rectangular_patch.jl +++ b/test/rectangular_patch.jl @@ -7,8 +7,8 @@ function rectangular_patch(particle_spacing, size; density=1000.0, pressure=0.0, # Center particle at the origin (assuming odd size) min_corner = -particle_spacing / 2 .* size - ic = RectangularShape(particle_spacing, size, min_corner, - density=density, pressure=pressure) + ic = RectangularShape(particle_spacing, size, min_corner; + density, pressure) perturb!(ic.coordinates, perturbation_factor_position * 0.5 * particle_spacing) diff --git a/test/schemes/boundary/dummy_particles/dummy_particles.jl b/test/schemes/boundary/dummy_particles/dummy_particles.jl index 37d41ddab6..69cb64d901 100644 --- a/test/schemes/boundary/dummy_particles/dummy_particles.jl +++ b/test/schemes/boundary/dummy_particles/dummy_particles.jl @@ -52,28 +52,28 @@ # Define pressure extrapolation methods to test boundary_model_adami = BoundaryModelDummyParticles(boundary.density, boundary.mass, - state_equation=state_equation, AdamiPressureExtrapolation(), smoothing_kernel, - smoothing_length, - viscosity=viscosity) + smoothing_length; + state_equation, + viscosity) boundary_model_bernoulli = BoundaryModelDummyParticles(boundary.density, boundary.mass, - state_equation=state_equation, BernoulliPressureExtrapolation(), smoothing_kernel, - smoothing_length, - viscosity=viscosity) + smoothing_length; + state_equation, + viscosity) boundary_systems = [ WallBoundarySystem(boundary, boundary_model_adami), WallBoundarySystem(boundary, boundary_model_bernoulli), RigidBodySystem(boundary; boundary_model=boundary_model_adami, - particle_spacing=particle_spacing), + particle_spacing), RigidBodySystem(boundary; boundary_model=boundary_model_bernoulli, - particle_spacing=particle_spacing), + particle_spacing), TotalLagrangianSPHSystem(boundary; smoothing_kernel, smoothing_length, @@ -237,14 +237,14 @@ exponent=7) tank1 = RectangularTank(particle_spacing, (width, height), (width, height), - density, n_layers=n_layers, + density; n_layers, faces=(true, true, true, false)) boundary_model = BoundaryModelDummyParticles(tank1.boundary.density, tank1.boundary.mass, - state_equation=state_equation, AdamiPressureExtrapolation(), - smoothing_kernel, smoothing_length) + smoothing_kernel, smoothing_length; + state_equation) boundary_system = WallBoundarySystem(tank1.boundary, boundary_model) viscosity = boundary_system.boundary_model.viscosity @@ -291,7 +291,7 @@ @testset "Constant Non-Zero Pressure" begin density = 260 tank2 = RectangularTank(particle_spacing, (width, height), (width, height), - density, n_layers=n_layers, + density; n_layers, faces=(true, true, true, false)) fluid_system2 = WeaklyCompressibleSPHSystem(tank2.fluid, SummationDensity(), @@ -332,8 +332,8 @@ @testset "Hydrostatic Pressure Gradient" begin for flipped_condition in (Val(true), Val(false)) tank3 = RectangularTank(particle_spacing, (width, height), (width, height), - density, acceleration=[0.0, -9.81], - state_equation=state_equation, n_layers=n_layers, + density; acceleration=[0.0, -9.81], + state_equation, n_layers, faces=(true, true, true, false)) fluid_system3 = WeaklyCompressibleSPHSystem(tank3.fluid, SummationDensity(), @@ -375,8 +375,8 @@ tank_reference = RectangularTank(particle_spacing, (width_reference, height_reference), (width_reference, height_reference), - density, acceleration=[0.0, -9.81], - state_equation=state_equation, n_layers=0, + density; acceleration=[0.0, -9.81], + state_equation, n_layers=0, faces=(true, true, true, false)) # Because it is a pain to deal with the linear indices of the pressure arrays, diff --git a/test/schemes/boundary/dummy_particles/rhs.jl b/test/schemes/boundary/dummy_particles/rhs.jl index 43e4a89767..7dfe3e871b 100644 --- a/test/schemes/boundary/dummy_particles/rhs.jl +++ b/test/schemes/boundary/dummy_particles/rhs.jl @@ -129,7 +129,7 @@ for seed in 1:3 # A larger number of particles will increase accumulated errors in the # summation. A larger tolerance will have to be used for the tests below. - ic = rectangular_patch(particle_spacing, (3, 3), seed=seed) + ic = rectangular_patch(particle_spacing, (3, 3); seed) # Split initial condition at center particle into two systems center_particle = ceil(Int, TrixiParticles.nparticles(ic) / 2) diff --git a/test/schemes/boundary/open_boundary/dynamical_pressure.jl b/test/schemes/boundary/open_boundary/dynamical_pressure.jl index 1baee305cd..4e400ecd1b 100644 --- a/test/schemes/boundary/open_boundary/dynamical_pressure.jl +++ b/test/schemes/boundary/open_boundary/dynamical_pressure.jl @@ -21,7 +21,7 @@ for seed in 1:3 # A larger number of particles will increase accumulated errors in the # summation. A larger tolerance has to be used for the tests below. - ic = rectangular_patch(particle_spacing, (3, 3), seed=seed) + ic = rectangular_patch(particle_spacing, (3, 3); seed) min_coords = vec(minimum(ic.coordinates, dims=2)) .- particle_spacing max_coords = vec(maximum(ic.coordinates, dims=2)) .+ particle_spacing @@ -36,9 +36,9 @@ smoothing_length) system_edac = EntropicallyDampedSPHSystem(ic, smoothing_kernel, + smoothing_length, 0.0; pressure_acceleration=nothing, - density_calculator=density_calculator, - smoothing_length, 0.0) + density_calculator) open_boundary_wcsph = OpenBoundarySystem(bz; fluid_system=system_wcsph, buffer_size=0, diff --git a/test/schemes/boundary/open_boundary/mirroring.jl b/test/schemes/boundary/open_boundary/mirroring.jl index be8228ad6d..bd54e25871 100644 --- a/test/schemes/boundary/open_boundary/mirroring.jl +++ b/test/schemes/boundary/open_boundary/mirroring.jl @@ -226,7 +226,7 @@ inflow = BoundaryZone(; boundary_face=face_in, boundary_type=InFlow(), face_normal=(i == 2 ? [1.0, 0.0] : [1.0, 0.0, 0.0]), - open_boundary_layers=open_boundary_layers, density=1000.0, + open_boundary_layers, density=1000.0, particle_spacing, average_inflow_velocity=true) open_boundary_in = OpenBoundarySystem(inflow; fluid_system, boundary_model=BoundaryModelMirroringTafuni(), diff --git a/test/schemes/boundary/open_boundary/open_boundary.jl b/test/schemes/boundary/open_boundary/open_boundary.jl index 3500490263..4b1f8d47cf 100644 --- a/test/schemes/boundary/open_boundary/open_boundary.jl +++ b/test/schemes/boundary/open_boundary/open_boundary.jl @@ -28,7 +28,7 @@ include("pressure_model.jl") zone = BoundaryZone(; boundary_face=([0.0, 0.0], [0.0, 2.0]), face_normal=(-1.0, 0.0), open_boundary_layers=10, density=1000.0, - particle_spacing, sample_points=sample_points, + particle_spacing, sample_points, reference_velocity=(pos, t) -> velocity_function(pos)) open_boundary = OpenBoundarySystem(zone; fluid_system, diff --git a/test/schemes/boundary/open_boundary/pressure_model.jl b/test/schemes/boundary/open_boundary/pressure_model.jl index c0e1baffe7..9d348e5627 100644 --- a/test/schemes/boundary/open_boundary/pressure_model.jl +++ b/test/schemes/boundary/open_boundary/pressure_model.jl @@ -129,9 +129,9 @@ # # The solution is obtained using simple Euler integration over the time interval `tspan`. # Reference pressure values are evaluated at discrete time points (`validation_times`): - # params_RCR = (R_2=R2, R_1=R1, C=C, q_func=pulsatile_flow, dt=dt) + # params_RCR = (; R_2=R2, R_1=R1, C, q_func=pulsatile_flow, dt) # sol_RCR = solve(ODEProblem(pressure_RCR_ode!, [p0], tspan, params_RCR), Euler(), - # dt=dt, adaptive=false) + # dt, adaptive=false) # validation_times = collect(range(7T, 8T, step=50 * dt)) # pressures_ref = vec(stack(sol_RCR(validation_times))) # diff --git a/test/schemes/fluid/rhs.jl b/test/schemes/fluid/rhs.jl index af5bcb7333..48297a0b8a 100644 --- a/test/schemes/fluid/rhs.jl +++ b/test/schemes/fluid/rhs.jl @@ -130,15 +130,15 @@ for seed in 1:3 # A larger number of particles will increase accumulated errors in the # summation. A larger tolerance has to be used for the tests below. - fluid = rectangular_patch(particle_spacing, (3, 3), seed=seed) + fluid = rectangular_patch(particle_spacing, (3, 3); seed) system_wcsph = WeaklyCompressibleSPHSystem(fluid, density_calculator, state_equation, smoothing_kernel, smoothing_length) system_edac = EntropicallyDampedSPHSystem(fluid, smoothing_kernel, + smoothing_length, 0.0; pressure_acceleration=nothing, - density_calculator=density_calculator, - smoothing_length, 0.0) + density_calculator) system_iisph = ImplicitIncompressibleSPHSystem(fluid; smoothing_kernel, diff --git a/test/schemes/fluid/surface_normal_sph.jl b/test/schemes/fluid/surface_normal_sph.jl index 2c761253a4..e2c846e475 100644 --- a/test/schemes/fluid/surface_normal_sph.jl +++ b/test/schemes/fluid/surface_normal_sph.jl @@ -29,10 +29,10 @@ function create_boundary_system(coordinates, particle_spacing, state_equation, k boundary_model = BoundaryModelDummyParticles(wall.density, wall.mass, - state_equation=state_equation, AdamiPressureExtrapolation(), kernel, - smoothing_length, + smoothing_length; + state_equation, correction=nothing, reference_particle_spacing=particle_spacing) @@ -51,8 +51,8 @@ function create_rigid_boundary_system(coordinates, particle_spacing, state_equat wall_system.initial_condition.mass, AdamiPressureExtrapolation(), kernel, - smoothing_length, - state_equation=state_equation, + smoothing_length; + state_equation, correction=nothing, reference_particle_spacing=particle_spacing) @@ -69,11 +69,11 @@ function create_fluid_system(coordinates, velocity, mass, density, particle_spac smoothing_kernel=SchoenbergCubicSplineKernel{NDIMS}()) tspan = (0.0, 0.01) - fluid = InitialCondition(coordinates=coordinates, - velocity=velocity, - mass=mass, - density=density, - particle_spacing=particle_spacing) + fluid = InitialCondition(coordinatess, + velocity, + mass, + density, + particle_spacing) state_equation = StateEquationCole(sound_speed=10.0, reference_density=1000.0, @@ -81,9 +81,9 @@ function create_fluid_system(coordinates, velocity, mass, density, particle_spac system = WeaklyCompressibleSPHSystem(fluid, SummationDensity(), state_equation, smoothing_kernel, smoothing_length; - surface_normal_method=surface_normal_method, + surface_normal_method, reference_particle_spacing=particle_spacing, - surface_tension=surface_tension) + surface_tension) if wall boundary_system = if boundary_system_type == :wall @@ -166,9 +166,9 @@ end wall_ode = create_fluid_system(coordinates, velocity, mass, density, particle_spacing, SurfaceTensionMorris(surface_tension_coefficient=0.072); - NDIMS=NDIMS, - smoothing_length=smoothing_length, - smoothing_kernel=smoothing_kernel, + NDIMS, + smoothing_length, + smoothing_kernel, surface_normal_method=ColorfieldSurfaceNormal(interface_threshold=0.1, ideal_density_threshold=0.9), wall=true, walldistance=2.0, @@ -178,16 +178,16 @@ end rigid_ode = create_fluid_system(coordinates, velocity, mass, density, particle_spacing, SurfaceTensionMorris(surface_tension_coefficient=0.072); - NDIMS=NDIMS, - smoothing_length=smoothing_length, - smoothing_kernel=smoothing_kernel, + NDIMS, + smoothing_length, + smoothing_kernel, surface_normal_method=ColorfieldSurfaceNormal(interface_threshold=0.1, ideal_density_threshold=0.9), wall=true, walldistance=2.0, boundary_system_type=:rigid) - compute_and_test_surface_values(wall_system, wall_semi, wall_ode; NDIMS=NDIMS) - compute_and_test_surface_values(rigid_system, rigid_semi, rigid_ode; NDIMS=NDIMS) + compute_and_test_surface_values(wall_system, wall_semi, wall_ode; NDIMS) + compute_and_test_surface_values(rigid_system, rigid_semi, rigid_ode; NDIMS) @test isapprox(rigid_boundary.boundary_model.cache.initial_colorfield, wall_boundary.boundary_model.cache.initial_colorfield, @@ -231,14 +231,14 @@ end density, particle_spacing, SurfaceTensionMorris(surface_tension_coefficient=0.072); - NDIMS=NDIMS, - smoothing_length=smoothing_length, - smoothing_kernel=smoothing_kernel, + NDIMS, + smoothing_length, + smoothing_kernel, surface_normal_method=ColorfieldSurfaceNormal(interface_threshold=0.1, ideal_density_threshold=0.9), wall=true, walldistance=2.0) - compute_and_test_surface_values(system, semi, ode; NDIMS=NDIMS) + compute_and_test_surface_values(system, semi, ode; NDIMS) nparticles = size(coordinates, 2) expected_normals = zeros(NDIMS, nparticles) @@ -334,14 +334,14 @@ end density, particle_spacing, SurfaceTensionAkinci(surface_tension_coefficient=0.072); - NDIMS=NDIMS, - smoothing_length=smoothing_length, - smoothing_kernel=smoothing_kernel, + NDIMS, + smoothing_length, + smoothing_kernel, surface_normal_method=ColorfieldSurfaceNormal(interface_threshold=0.1, ideal_density_threshold=0.9), wall=true, walldistance=2.0) - compute_and_test_surface_values(system, semi, ode; NDIMS=NDIMS) + compute_and_test_surface_values(system, semi, ode; NDIMS) nparticles = size(coordinates, 2) expected_normals = zeros(NDIMS, nparticles) @@ -420,13 +420,13 @@ end ode = create_fluid_system(coordinates, velocity, mass, density, particle_spacing, SurfaceTensionMorris(surface_tension_coefficient=0.072); - NDIMS=NDIMS, + NDIMS, smoothing_length=1.5 * particle_spacing, wall=false, walldistance=0.0) # Compute surface normals - compute_and_test_surface_values(system, semi, ode; NDIMS=NDIMS) + compute_and_test_surface_values(system, semi, ode; NDIMS) # Threshold to decide if a particle is "on" a boundary # (half the spacing is typical, adjust as needed) diff --git a/test/schemes/fluid/surface_tension.jl b/test/schemes/fluid/surface_tension.jl index 5dccbdb803..e6d1d53743 100644 --- a/test/schemes/fluid/surface_tension.jl +++ b/test/schemes/fluid/surface_tension.jl @@ -98,10 +98,10 @@ mass = ones(2) density = ones(2) - ic = InitialCondition(coordinates=coords, - velocity=velocity, - mass=mass, - density=density, + ic = InitialCondition(; coordinates=coords, + velocity, + mass, + density, particle_spacing=1.0) # 2. Define Density Calculator, State Equation, and Kernel diff --git a/test/schemes/fluid/viscosity.jl b/test/schemes/fluid/viscosity.jl index d4ead2cbcc..75ee6ac15c 100644 --- a/test/schemes/fluid/viscosity.jl +++ b/test/schemes/fluid/viscosity.jl @@ -20,7 +20,7 @@ system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity) + smoothing_length; viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -41,10 +41,10 @@ end @testset verbose=true "`ViscosityMorris`" begin nu = 7e-3 - viscosity = ViscosityMorris(nu=nu) + viscosity = ViscosityMorris(nuu) system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity) + smoothing_length; viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -73,7 +73,7 @@ viscosity = ViscosityAdami(nu=7e-3) system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity) + smoothing_length; viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -100,10 +100,10 @@ end @testset verbose=true "`ViscosityMorrisSGS`" begin nu = 7e-3 - viscosity = ViscosityMorrisSGS(nu=nu) + viscosity = ViscosityMorrisSGS(nuu) system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity) + smoothing_length; viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -133,7 +133,7 @@ viscosity = ViscosityAdamiSGS(nu=7e-3) system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, - smoothing_length, viscosity=viscosity) + smoothing_length; viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -180,7 +180,7 @@ epsilon=0.01) system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, - smoothing_length; viscosity=viscosity) + smoothing_length; viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -206,7 +206,7 @@ epsilon=0.01) system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, - smoothing_length; viscosity=viscosity) + smoothing_length; viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) diff --git a/test/schemes/fluid/weakly_compressible_sph/state_equation.jl b/test/schemes/fluid/weakly_compressible_sph/state_equation.jl index f86abd47f6..e454478c37 100644 --- a/test/schemes/fluid/weakly_compressible_sph/state_equation.jl +++ b/test/schemes/fluid/weakly_compressible_sph/state_equation.jl @@ -43,9 +43,9 @@ background_pressures = [0.0, 10_000.0, 100_000.0, 200_000.0] for background_pressure in background_pressures - state_equation = StateEquationCole(sound_speed=10.0, exponent=7, + state_equation = StateEquationCole(; sound_speed=10.0, exponent=7, reference_density=1000.0, - background_pressure=background_pressure) + background_pressure) @test state_equation(1000.0) == background_pressure @test state_equation(1001.0) > background_pressure + 10 # No pressure clipping @@ -155,7 +155,7 @@ # Work with pressures in ATM ATM = 101_325.0 - state_equation = StateEquationIdealGas(; sound_speed, gamma=gamma, + state_equation = StateEquationIdealGas(; sound_speed, gamma, reference_density=rest_density, background_pressure=1ATM) diff --git a/test/setups/rectangular_shape.jl b/test/setups/rectangular_shape.jl index 7c2fd6875b..2fd5cfc96d 100644 --- a/test/setups/rectangular_shape.jl +++ b/test/setups/rectangular_shape.jl @@ -143,9 +143,9 @@ @testset "Loop Order :y_first" begin shape = RectangularShape(particle_spacing, - n_particles_per_dimension, (0.0, 0.0), + n_particles_per_dimension, (0.0, 0.0); acceleration=(0.0, -1.0), - state_equation=state_equation) + state_equation) @test shape.pressure ≈ vec(pressure) @test shape.density == @@ -156,9 +156,9 @@ @testset "Loop Order :x_first" begin shape = RectangularShape(particle_spacing, - n_particles_per_dimension, (0.0, 0.0), + n_particles_per_dimension, (0.0, 0.0); acceleration=(0.0, -1.0), - state_equation=state_equation, + state_equation, loop_order=:x_first) # Transpose `pressure` @@ -167,9 +167,9 @@ @testset "Positive Acceleration" begin shape = RectangularShape(particle_spacing, - n_particles_per_dimension, (0.0, 0.0), + n_particles_per_dimension, (0.0, 0.0); acceleration=(0.0, 1.0), - state_equation=state_equation) + state_equation) @test shape.pressure ≈ vec(reverse(pressure)) @test shape.density == @@ -182,9 +182,9 @@ @testset "Horizontal Gravity" begin n_particles_per_dimension = (5, 2) shape = RectangularShape(particle_spacing, - n_particles_per_dimension, (0.0, 0.0), + n_particles_per_dimension, (0.0, 0.0); acceleration=(-1.0, 0.0), - state_equation=state_equation) + state_equation) @test shape.pressure ≈ 1.0 * vec(pressure') @test shape.density == @@ -290,8 +290,8 @@ end shape = RectangularShape(particle_spacing, Tuple(n_particles_per_dimension_), - (0.0, 0.0, 0.0), density=1000.0, - loop_order=loop_order, acceleration=acceleration_) + (0.0, 0.0, 0.0); density=1000.0, + loop_order, acceleration=acceleration_) # Permute pressure with acceleration permutation permuted1 = permutedims(pressure, permutation) @@ -350,9 +350,9 @@ end permute!(acceleration_, permutation) shape = RectangularShape(particle_spacing, - Tuple(n_particles_per_dimension_), (0.0, 0.0, 0.0), + Tuple(n_particles_per_dimension_), (0.0, 0.0, 0.0); acceleration=acceleration_, - state_equation=state_equation) + state_equation) @test shape.pressure ≈ vec(permutedims(pressure, permutation)) density = TrixiParticles.inverse_state_equation.(Ref(state_equation), diff --git a/test/systems/edac_system.jl b/test/systems/edac_system.jl index f2166dd578..6074d9e8bf 100644 --- a/test/systems/edac_system.jl +++ b/test/systems/edac_system.jl @@ -27,9 +27,9 @@ system = EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, smoothing_length, sound_speed) system_keywords = EntropicallyDampedSPHSystem(initial_condition; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - sound_speed=sound_speed) + smoothing_kernel, + smoothing_length, + sound_speed) @test system isa EntropicallyDampedSPHSystem{NDIMS} @test system.initial_condition == initial_condition diff --git a/test/systems/iisph_system.jl b/test/systems/iisph_system.jl index e599c1a7a4..8dd3b3bd8d 100644 --- a/test/systems/iisph_system.jl +++ b/test/systems/iisph_system.jl @@ -52,11 +52,11 @@ smoothing_kernel, smoothing_length, reference_density, - omega=omega, - max_error=max_error, - min_iterations=min_iterations, - max_iterations=max_iterations, - time_step=time_step) + omega, + max_error, + min_iterations, + max_iterations, + time_step) # Constructor copies input fields, applies defaults, and respects the requested dimensionality @test system isa ImplicitIncompressibleSPHSystem{NDIMS} diff --git a/test/systems/rigid_system.jl b/test/systems/rigid_system.jl index a1ea2b6de9..32a8ca725b 100644 --- a/test/systems/rigid_system.jl +++ b/test/systems/rigid_system.jl @@ -16,7 +16,7 @@ smoothing_length) system = RigidBodySystem(initial_condition; - boundary_model=boundary_model, + boundary_model, acceleration=(0.0, -9.81), particle_spacing=0.1) @@ -60,7 +60,7 @@ smoothing_length) system = RigidBodySystem(initial_condition; - boundary_model=boundary_model, + boundary_model, acceleration=(0.0, -9.81)) @test !haskey(system.cache, :contact_manifold_count) @@ -97,7 +97,7 @@ smoothing_kernel, smoothing_length) - system = RigidBodySystem(initial_condition; boundary_model=boundary_model) + system = RigidBodySystem(initial_condition; boundary_model) v = zeros(TrixiParticles.v_nvariables(system), TrixiParticles.n_integrated_particles(system)) @@ -122,7 +122,7 @@ source_terms = (coords, velocity, density, pressure, t) -> SVector(density, pressure) - system = RigidBodySystem(initial_condition; source_terms=source_terms) + system = RigidBodySystem(initial_condition; source_terms) semi = Semidiscretization(system, neighborhood_search=nothing) system = semi.systems[1] ode = semidiscretize(semi, (0.0, 0.0); reset_threads=false) @@ -428,7 +428,7 @@ smoothing_length) rigid_system = RigidBodySystem(initial_condition; - boundary_model=boundary_model) + boundary_model) semi = Semidiscretization(rigid_system) ode = semidiscretize(semi, (0.0, 0.01)) v_ode, u_ode = ode.u0.x @@ -493,11 +493,11 @@ exponent=1.0) function run_setup(boundary_kind) - fluid_ic = InitialCondition(coordinates=reshape([0.0, 0.0], 2, 1), + fluid_ic = InitialCondition(; coordinates=reshape([0.0, 0.0], 2, 1), velocity=zeros(2, 1), mass=[particle_volume * fluid_density], density=[fluid_density], - particle_spacing=particle_spacing) + particle_spacing) fluid_system = WeaklyCompressibleSPHSystem(fluid_ic, SummationDensity(), state_equation, @@ -511,27 +511,27 @@ [particle_volume * fluid_density], AdamiPressureExtrapolation(), smoothing_kernel, - smoothing_length, - state_equation=state_equation, + smoothing_length; + state_equation, reference_particle_spacing=particle_spacing) boundary_system = if boundary_kind == :wall - wall_ic = InitialCondition(coordinates=boundary_coordinates, + wall_ic = InitialCondition(; coordinates=boundary_coordinates, velocity=zeros(2, 1), mass=[particle_volume * fluid_density], density=[fluid_density], - particle_spacing=particle_spacing) - WallBoundarySystem(wall_ic, boundary_model, - adhesion_coefficient=adhesion_coefficient) + particle_spacing) + WallBoundarySystem(wall_ic, boundary_model; + adhesion_coefficient) else - rigid_ic = InitialCondition(coordinates=boundary_coordinates, + rigid_ic = InitialCondition(; coordinates=boundary_coordinates, velocity=zeros(2, 1), mass=[particle_volume * rigid_density], density=[rigid_density], - particle_spacing=particle_spacing) + particle_spacing) RigidBodySystem(rigid_ic; - boundary_model=boundary_model, - adhesion_coefficient=adhesion_coefficient) + boundary_model, + adhesion_coefficient) end semi = Semidiscretization(fluid_system, boundary_system) @@ -598,27 +598,27 @@ 2), AdamiPressureExtrapolation(), smoothing_kernel, - smoothing_length, - state_equation=state_equation, + smoothing_length; + state_equation, reference_particle_spacing=particle_spacing) function run_setup(fluid_positions) - rigid_ic = InitialCondition(coordinates=[-0.5 0.5 + rigid_ic = InitialCondition(; coordinates=[-0.5 0.5 0.0 0.0], velocity=zeros(2, 2), mass=fill(particle_volume * rigid_density, 2), density=fill(rigid_density, 2), - particle_spacing=particle_spacing) + particle_spacing) rigid_system = RigidBodySystem(rigid_ic; - boundary_model=boundary_model, + boundary_model, acceleration=(0.0, 0.0)) fluid_systems = map(fluid_positions) do position - fluid_ic = InitialCondition(coordinates=reshape(collect(position), 2, 1), + fluid_ic = InitialCondition(; coordinates=reshape(collect(position), 2, 1), velocity=zeros(2, 1), mass=[particle_volume * fluid_density], density=[fluid_density], - particle_spacing=particle_spacing) + particle_spacing) WeaklyCompressibleSPHSystem(fluid_ic, SummationDensity(), state_equation, smoothing_kernel, smoothing_length) @@ -672,30 +672,30 @@ [particle_volume * fluid_density], AdamiPressureExtrapolation(), smoothing_kernel, - smoothing_length, - state_equation=state_equation, + smoothing_length; + state_equation, reference_particle_spacing=particle_spacing) - rigid_ic = InitialCondition(coordinates=reshape([0.0, 0.0], 2, 1), + rigid_ic = InitialCondition(; coordinates=reshape([0.0, 0.0], 2, 1), velocity=zeros(2, 1), mass=[particle_volume * rigid_density], density=[rigid_density], - particle_spacing=particle_spacing) + particle_spacing) rigid_system = RigidBodySystem(rigid_ic; - boundary_model=boundary_model, + boundary_model, acceleration=(0.0, 0.0)) - open_boundary_ic = InitialCondition(coordinates=reshape([1.5, 0.0], 2, 1), + open_boundary_ic = InitialCondition(; coordinates=reshape([1.5, 0.0], 2, 1), velocity=zeros(2, 1), mass=[particle_volume * fluid_density], density=[fluid_density], - particle_spacing=particle_spacing) + particle_spacing) - fluid_support_ic = InitialCondition(coordinates=reshape([10.0, 10.0], 2, 1), + fluid_support_ic = InitialCondition(; coordinates=reshape([10.0, 10.0], 2, 1), velocity=zeros(2, 1), mass=[particle_volume * fluid_density], density=[fluid_density], - particle_spacing=particle_spacing) + particle_spacing) fluid_system = WeaklyCompressibleSPHSystem(fluid_support_ic, SummationDensity(), state_equation, smoothing_kernel, @@ -704,7 +704,7 @@ boundary_face = ([2.0, -0.5], [2.0, 0.5]) zone = BoundaryZone(; boundary_face, face_normal=(1.0, 0.0), density=fluid_density, - particle_spacing=particle_spacing, + particle_spacing, initial_condition=open_boundary_ic, open_boundary_layers=1, boundary_type=InFlow()) @@ -965,18 +965,18 @@ rigid_system = RigidBodySystem(rigid_ic; acceleration=(0.0, 0.0), - contact_model=contact_model) + contact_model) rigid_system_with_boundary = RigidBodySystem(rigid_ic; acceleration=(0.0, 0.0), - boundary_model=boundary_model, - contact_model=contact_model) + boundary_model, + contact_model) rigid_system_custom_manifolds = RigidBodySystem(rigid_ic; acceleration=(0.0, 0.0), - contact_model=contact_model, + contact_model, max_manifolds=3) rigid_system_without_contact = RigidBodySystem(rigid_ic; acceleration=(0.0, 0.0), - boundary_model=boundary_model) + boundary_model) @test haskey(rigid_system.cache, :contact_manifold_count) @test rigid_system.contact_model.normal_stiffness ≈ contact_model.normal_stiffness @test rigid_system.contact_model.normal_damping ≈ contact_model.normal_damping @@ -1001,7 +1001,7 @@ @test iszero(TrixiParticles.compact_support(rigid_system_without_contact, boundary_system)) @test_throws ArgumentError RigidBodySystem(rigid_ic; - contact_model=contact_model, + contact_model, max_manifolds=0) system_meta_data = Dict{String, Any}() @@ -1026,7 +1026,7 @@ smoothing_length) kick_rigid_system = RigidBodySystem(rigid_ic; acceleration=(0.0, 0.0), - contact_model=contact_model) + contact_model) kick_boundary_system = WallBoundarySystem(boundary_ic, kick_boundary_model) kick_semi = Semidiscretization(kick_rigid_system, kick_boundary_system) kick_ode = semidiscretize(kick_semi, (0.0, 0.01)) @@ -1092,7 +1092,7 @@ short_support_boundary_model) far_rigid_system = RigidBodySystem(far_rigid_ic; acceleration=(0.0, 0.0), - contact_model=contact_model) + contact_model) short_support_semi = Semidiscretization(far_rigid_system, short_support_boundary) short_support_ode = semidiscretize(short_support_semi, (0.0, 0.01)) short_support_v_ode, short_support_u_ode = short_support_ode.u0.x diff --git a/test/systems/tlsph_system.jl b/test/systems/tlsph_system.jl index 71755ab712..3d935f77ba 100644 --- a/test/systems/tlsph_system.jl +++ b/test/systems/tlsph_system.jl @@ -28,7 +28,7 @@ smoothing_length, young_modulus=E, poisson_ratio=nu, - boundary_model=boundary_model) + boundary_model) @test system isa TotalLagrangianSPHSystem @test ndims(system) == NDIMS @@ -70,7 +70,7 @@ smoothing_length, young_modulus=E, poisson_ratio=nu, - boundary_model=boundary_model) + boundary_model) show_compact = "TotalLagrangianSPHSystem{2}(Val{:smoothing_kernel}(), " * "[0.0, 0.0], Val{:boundary_model}(), nothing, nothing) with 2 particles" @@ -99,7 +99,7 @@ smoothing_length, young_modulus=E, poisson_ratio=nu, - boundary_model=boundary_model) + boundary_model) show_box = """ ┌──────────────────────────────────────────────────────────────────────────────────────────────────┐ @@ -333,7 +333,7 @@ smoothing_length, young_modulus=E, poisson_ratio=nu, - boundary_model=boundary_model) + boundary_model) u0 = zeros(TrixiParticles.u_nvariables(system), TrixiParticles.n_integrated_particles(system)) @@ -363,7 +363,7 @@ smoothing_length, young_modulus=E, poisson_ratio=nu, - boundary_model=boundary_model) + boundary_model) v0 = zeros(TrixiParticles.v_nvariables(system), TrixiParticles.n_integrated_particles(system)) diff --git a/test/systems/wcsph_system.jl b/test/systems/wcsph_system.jl index 07681a37d8..a2f9b559b4 100644 --- a/test/systems/wcsph_system.jl +++ b/test/systems/wcsph_system.jl @@ -35,10 +35,10 @@ state_equation, smoothing_kernel, smoothing_length) system_keywords = WeaklyCompressibleSPHSystem(initial_condition; - smoothing_kernel=smoothing_kernel, - smoothing_length=smoothing_length, - density_calculator=density_calculator, - state_equation=state_equation) + smoothing_kernel, + smoothing_length, + density_calculator, + state_equation) @test system isa WeaklyCompressibleSPHSystem{NDIMS} @test system.initial_condition == initial_condition @@ -212,8 +212,8 @@ system = WeaklyCompressibleSPHSystem(initial_condition, density_calculator, state_equation, smoothing_kernel, - smoothing_length, - density_diffusion=density_diffusion) + smoothing_length; + density_diffusion) show_compact = "WeaklyCompressibleSPHSystem{2}(SummationDensity(), nothing, Val{:state_equation}(), Val{:smoothing_kernel}(), nothing, Val{:density_diffusion}(), nothing, nothing, nothing, [0.0, 0.0], nothing) with 2 particles" @test repr(system) == show_compact diff --git a/validation/dam_break_2d/setup_marrone_2011.jl b/validation/dam_break_2d/setup_marrone_2011.jl index ca4a88b7c3..519182b1be 100644 --- a/validation/dam_break_2d/setup_marrone_2011.jl +++ b/validation/dam_break_2d/setup_marrone_2011.jl @@ -78,8 +78,8 @@ if use_edac state_equation = nothing tank_edac = RectangularTank(particle_spacing, initial_fluid_size, tank_size, - fluid_density, - n_layers=boundary_layers, spacing_ratio=spacing_ratio, + fluid_density; + n_layers=boundary_layers, spacing_ratio, acceleration=(0.0, -gravity), state_equation=nothing) fluid_system = EntropicallyDampedSPHSystem(tank_edac.fluid, smoothing_kernel, @@ -114,12 +114,12 @@ saving_paper = SolutionSavingCallback(save_times=[0.0, 1.5, 2.36, 3.0, 5.7, 6.45 sqrt(gravity / H), prefix="marrone_times") -trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); fluid_particle_spacing=particle_spacing, - boundary_density_calculator=boundary_density_calculator, - state_equation=state_equation, + boundary_density_calculator, + state_equation, solution_prefix="validation_" * method * "_" * formatted_string, - tspan=tspan, fluid_system=fluid_system, + tspan, fluid_system, update_strategy=nothing, extra_callback=postprocessing_cb, extra_callback2=saving_paper) diff --git a/validation/dam_break_2d/validation_dam_break_2d.jl b/validation/dam_break_2d/validation_dam_break_2d.jl index 22f563e245..ec62c5ba6c 100644 --- a/validation/dam_break_2d/validation_dam_break_2d.jl +++ b/validation/dam_break_2d/validation_dam_break_2d.jl @@ -29,8 +29,8 @@ update_strategy = nothing # ==== WCSPH simulation trixi_include(@__MODULE__, joinpath(validation_dir(), "dam_break_2d", - "setup_marrone_2011.jl"), - use_edac=false, update_strategy=update_strategy, + "setup_marrone_2011.jl"); + use_edac=false, update_strategy, particles_per_height=resolution, sound_speed=50 * sqrt(9.81 * 0.6), # This is used by De Courcy et al. (2024) alpha=0.01, # This is used by De Courcy et al. (2024) @@ -58,8 +58,8 @@ error_wcsph_P2 = interpolated_mse(reference_data["pressure_P2_fluid_1"]["time"], # ==== EDAC simulation trixi_include(@__MODULE__, joinpath(validation_dir(), "dam_break_2d", - "setup_marrone_2011.jl"), - use_edac=true, update_strategy=update_strategy, + "setup_marrone_2011.jl"); + use_edac=true, update_strategy, particles_per_height=resolution, sound_speed=50 * sqrt(9.81 * 0.6), # This is used by De Courcy et al. (2024) alpha=0.01, # This is used by De Courcy et al. (2024) diff --git a/validation/hydrostatic_water_column_2d/validation.jl b/validation/hydrostatic_water_column_2d/validation.jl index 81fe978cc8..3cf60ffb34 100644 --- a/validation/hydrostatic_water_column_2d/validation.jl +++ b/validation/hydrostatic_water_column_2d/validation.jl @@ -51,11 +51,11 @@ function run_simulation(method; n_particles_plate_y, tspan) kinetic_energy) trixi_include(@__MODULE__, - joinpath(examples_dir(), "fsi", "hydrostatic_water_column_2d.jl"), + joinpath(examples_dir(), "fsi", "hydrostatic_water_column_2d.jl"); use_edac=method.use_edac, - n_particles_plate_y=n_particles_plate_y, + n_particles_plate_y, update_strategy=SerialUpdate(), - tspan=tspan, + tspan, prefix=pp_filename, extra_callback=pp) @@ -70,8 +70,8 @@ errors = Dict{Symbol, Tuple{Float64, Float64}}() for method in methods pp_filename, _ = run_simulation(method; - n_particles_plate_y=n_particles_plate_y, - tspan=tspan) + n_particles_plate_y, + tspan) # Load the run JSON file and add the analytical solution as a single point. run_filename = joinpath("out", pp_filename * ".json") diff --git a/validation/lid_driven_cavity_2d/validation_lid_driven_cavity_2d.jl b/validation/lid_driven_cavity_2d/validation_lid_driven_cavity_2d.jl index b805667d4e..d7b2c9f221 100644 --- a/validation/lid_driven_cavity_2d/validation_lid_driven_cavity_2d.jl +++ b/validation/lid_driven_cavity_2d/validation_lid_driven_cavity_2d.jl @@ -51,8 +51,8 @@ function interpolated_velocity(system::TrixiParticles.AbstractFluidSystem, TrixiParticles.CSV.write(output_directory * "/interpolated_velocities.csv", df) else - df = TrixiParticles.DataFrame(pos=collect(LinRange(0.0, 1.0, n_particles_xy)), - counter=1, vy_y=vy_y, vy_x=vy_x, vx_y=vx_y, vx_x=vx_x) + df = TrixiParticles.DataFrame(; pos=collect(LinRange(0.0, 1.0, n_particles_xy)), + counter=1, vy_y, vy_x, vx_y, vx_x) TrixiParticles.CSV.write(output_directory * "/interpolated_velocities.csv", df) CAPTURE_STARTED[] = true @@ -74,20 +74,20 @@ for reynolds_number in reynolds_numbers, name_density_calculator, "validation_run_lid_driven_cavity_2d_nparticles_$(n_particles_xy)x$(n_particles_xy)_Re_$Re") - saving_callback = SolutionSavingCallback(dt=0.02, output_directory=output_directory) + saving_callback = SolutionSavingCallback(; dt=0.02, output_directory) CAPTURE_STARTED[] = false pp_callback = PostprocessCallback(; dt=0.02, - interpolated_velocity=interpolated_velocity, + interpolated_velocity, filename="interpolated_velocities", write_file_interval=0) # Import variables into scope trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "lid_driven_cavity_2d.jl"), - wcsph=wcsph, density_calculator=density_calculator, - saving_callback=saving_callback, tspan=tspan, pp_callback=pp_callback, - particle_spacing=particle_spacing, reynolds_number=reynolds_number) + joinpath(examples_dir(), "fluid", "lid_driven_cavity_2d.jl"); + wcsph, density_calculator, + saving_callback, tspan, pp_callback, + particle_spacing, reynolds_number) file = joinpath(output_directory, "interpolated_velocities.csv") diff --git a/validation/oscillating_beam_2d/plot_oscillating_beam_results.jl b/validation/oscillating_beam_2d/plot_oscillating_beam_results.jl index 72de1a3013..1e24c633f0 100644 --- a/validation/oscillating_beam_2d/plot_oscillating_beam_results.jl +++ b/validation/oscillating_beam_2d/plot_oscillating_beam_results.jl @@ -63,7 +63,7 @@ for file_name in input_files interpolated_mse(ref.time, ref.Uy, data["time"], displacements) label = "$label_prefix dp = $(@sprintf("%.8f", particle_spacing_)) mse=$(@sprintf("%.8f", mse_results))" - lines!(ax, times, displacements, label=label) + lines!(ax, times, displacements; label) end end end diff --git a/validation/oscillating_beam_2d/validation_oscillating_beam_2d.jl b/validation/oscillating_beam_2d/validation_oscillating_beam_2d.jl index f5f96111ca..d48faff942 100644 --- a/validation/oscillating_beam_2d/validation_oscillating_beam_2d.jl +++ b/validation/oscillating_beam_2d/validation_oscillating_beam_2d.jl @@ -26,8 +26,8 @@ n_particles_beam_y = 5 # Overwrite `sol` assignment to skip time integration trixi_include(@__MODULE__, - joinpath(examples_dir(), "structure", "oscillating_beam_2d.jl"), - n_particles_y=n_particles_beam_y, sol=nothing, tspan=tspan, + joinpath(examples_dir(), "structure", "oscillating_beam_2d.jl"); + n_particles_y=n_particles_beam_y, sol=nothing, tspan, penalty_force=PenaltyForceGanzenmueller(alpha=0.01)) pp_callback = PostprocessCallback(; deflection_x, deflection_y, dt=0.01, diff --git a/validation/taylor_green_vortex_2d/validation_taylor_green_vortex_2d.jl b/validation/taylor_green_vortex_2d/validation_taylor_green_vortex_2d.jl index 20292524da..3f0c10a896 100644 --- a/validation/taylor_green_vortex_2d/validation_taylor_green_vortex_2d.jl +++ b/validation/taylor_green_vortex_2d/validation_taylor_green_vortex_2d.jl @@ -91,22 +91,22 @@ for density_calculator in density_calculators, perturbation in perturb_coordinat output_directory = joinpath("out_tgv", name_density_calculator * name_perturbation, wcsph ? "wcsph" : "edac", "validation_run_taylor_green_vortex_2d_nparticles_$(n_particles_xy)x$(n_particles_xy)") - saving_callback = SolutionSavingCallback(dt=0.02, - output_directory=output_directory, + saving_callback = SolutionSavingCallback(; dt=0.02, + output_directory, p_avg=diff_p_loc_p_avg) pp_callback = PostprocessCallback(; dt=0.02, L1v=compute_l1v_error, L1p=compute_l1p_error, - output_directory=output_directory, + output_directory, filename="errors", write_csv=true, write_file_interval=1) # Import variables into scope trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "taylor_green_vortex_2d.jl"), - density_calculator=density_calculator, - perturb_coordinates=perturbation, wcsph=wcsph, - particle_spacing=particle_spacing, reynolds_number=reynolds_number, - tspan=tspan, saving_callback=saving_callback, pp_callback=pp_callback) + joinpath(examples_dir(), "fluid", "taylor_green_vortex_2d.jl"); + density_calculator, + perturb_coordinates=perturbation, wcsph, + particle_spacing, reynolds_number, + tspan, saving_callback, pp_callback) end From e0c612436370e502fcfcc644fcf4d767f5baa3ff Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Thu, 23 Apr 2026 12:50:12 +0200 Subject: [PATCH 12/56] format --- src/schemes/boundary/wall_boundary/dummy_particles.jl | 4 ++-- src/schemes/fluid/entropically_damped_sph/system.jl | 2 +- test/systems/rigid_system.jl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/schemes/boundary/wall_boundary/dummy_particles.jl b/src/schemes/boundary/wall_boundary/dummy_particles.jl index 79e9328f6d..d339b7ba54 100644 --- a/src/schemes/boundary/wall_boundary/dummy_particles.jl +++ b/src/schemes/boundary/wall_boundary/dummy_particles.jl @@ -201,7 +201,7 @@ struct PressureBoundaries{ELTYPE} return new{eltype(time_step)}(time_step, omega) end end -@inline create_cache_model(correction, density, NDIMS, nparticles) = (; ) +@inline create_cache_model(correction, density, NDIMS, nparticles) = (;) function create_cache_model(::ShepardKernelCorrection, density, NDIMS, n_particles) return (; kernel_correction_coefficient=similar(density)) @@ -267,7 +267,7 @@ function create_cache_model(initial_density, return (; density, volume) end -@inline create_cache_model(viscosity::Nothing, n_particles, n_dims) = (; ) +@inline create_cache_model(viscosity::Nothing, n_particles, n_dims) = (;) function create_cache_model(viscosity, n_particles, n_dims) ELTYPE = eltype(viscosity.epsilon) diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index ec4aa45bed..0fc774d84c 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -196,7 +196,7 @@ function EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, particle_refinement, cache) end -create_cache_avg_pressure_reduction(initial_condition, ::Val{false}) = (; ) +create_cache_avg_pressure_reduction(initial_condition, ::Val{false}) = (;) function create_cache_avg_pressure_reduction(initial_condition, ::Val{true}) pressure_average = copy(initial_condition.pressure) diff --git a/test/systems/rigid_system.jl b/test/systems/rigid_system.jl index 32a8ca725b..81b9277f50 100644 --- a/test/systems/rigid_system.jl +++ b/test/systems/rigid_system.jl @@ -604,7 +604,7 @@ function run_setup(fluid_positions) rigid_ic = InitialCondition(; coordinates=[-0.5 0.5 - 0.0 0.0], + 0.0 0.0], velocity=zeros(2, 2), mass=fill(particle_volume * rigid_density, 2), density=fill(rigid_density, 2), From d7eafc26dab766d987edd93c03db3be8db12bd70 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Thu, 23 Apr 2026 12:53:00 +0200 Subject: [PATCH 13/56] typo --- test/general/initial_condition.jl | 4 ++-- test/io/read_vtk.jl | 2 +- test/schemes/fluid/surface_normal_sph.jl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/general/initial_condition.jl b/test/general/initial_condition.jl index f94f2184c9..da643da297 100644 --- a/test/general/initial_condition.jl +++ b/test/general/initial_condition.jl @@ -394,7 +394,7 @@ density = [10.0, 20.0, 30.0, 40.0, 50.0] pressure = [100.0, 200.0, 300.0, 400.0, 500.0] - ic = InitialCondition(coordinatess, velocity, + ic = InitialCondition(coordinates, velocity, mass, density, pressure) # Move particles 2 and 4 to the end @@ -423,7 +423,7 @@ mass = [1.1, 2.2, 3.3, 4.4] density = [10.0, 20.0, 30.0, 40.0] - ic = InitialCondition(coordinatess, velocity, + ic = InitialCondition(coordinates, velocity, mass, density) # Move particle 2 multiple times (should only move once) diff --git a/test/io/read_vtk.jl b/test/io/read_vtk.jl index f19a0554c6..87aa8bd645 100644 --- a/test/io/read_vtk.jl +++ b/test/io/read_vtk.jl @@ -3,7 +3,7 @@ coordinates = fill(1.0, 2, 12) velocity = fill(2.0, 2, 12) - expected_data = InitialCondition(coordinatess, velocity, + expected_data = InitialCondition(coordinates, velocity, density=1000.0, pressure=900.0, particle_spacing=0.1) diff --git a/test/schemes/fluid/surface_normal_sph.jl b/test/schemes/fluid/surface_normal_sph.jl index e2c846e475..891d81f179 100644 --- a/test/schemes/fluid/surface_normal_sph.jl +++ b/test/schemes/fluid/surface_normal_sph.jl @@ -69,7 +69,7 @@ function create_fluid_system(coordinates, velocity, mass, density, particle_spac smoothing_kernel=SchoenbergCubicSplineKernel{NDIMS}()) tspan = (0.0, 0.01) - fluid = InitialCondition(coordinatess, + fluid = InitialCondition(coordinates, velocity, mass, density, From c979bce731a03a89c2a4f2cff80b3908ad9e47ca Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Thu, 23 Apr 2026 13:43:07 +0200 Subject: [PATCH 14/56] fix tests --- test/general/initial_condition.jl | 4 ++-- test/io/read_vtk.jl | 2 +- test/schemes/fluid/surface_normal_sph.jl | 2 +- test/schemes/fluid/viscosity.jl | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/general/initial_condition.jl b/test/general/initial_condition.jl index da643da297..f65d2d241d 100644 --- a/test/general/initial_condition.jl +++ b/test/general/initial_condition.jl @@ -394,7 +394,7 @@ density = [10.0, 20.0, 30.0, 40.0, 50.0] pressure = [100.0, 200.0, 300.0, 400.0, 500.0] - ic = InitialCondition(coordinates, velocity, + ic = InitialCondition(; coordinates, velocity, mass, density, pressure) # Move particles 2 and 4 to the end @@ -423,7 +423,7 @@ mass = [1.1, 2.2, 3.3, 4.4] density = [10.0, 20.0, 30.0, 40.0] - ic = InitialCondition(coordinates, velocity, + ic = InitialCondition(; coordinates, velocity, mass, density) # Move particle 2 multiple times (should only move once) diff --git a/test/io/read_vtk.jl b/test/io/read_vtk.jl index 87aa8bd645..1e573db104 100644 --- a/test/io/read_vtk.jl +++ b/test/io/read_vtk.jl @@ -3,7 +3,7 @@ coordinates = fill(1.0, 2, 12) velocity = fill(2.0, 2, 12) - expected_data = InitialCondition(coordinates, velocity, + expected_data = InitialCondition(; coordinates, velocity, density=1000.0, pressure=900.0, particle_spacing=0.1) diff --git a/test/schemes/fluid/surface_normal_sph.jl b/test/schemes/fluid/surface_normal_sph.jl index 891d81f179..1c39bd2097 100644 --- a/test/schemes/fluid/surface_normal_sph.jl +++ b/test/schemes/fluid/surface_normal_sph.jl @@ -69,7 +69,7 @@ function create_fluid_system(coordinates, velocity, mass, density, particle_spac smoothing_kernel=SchoenbergCubicSplineKernel{NDIMS}()) tspan = (0.0, 0.01) - fluid = InitialCondition(coordinates, + fluid = InitialCondition(; coordinates, velocity, mass, density, diff --git a/test/schemes/fluid/viscosity.jl b/test/schemes/fluid/viscosity.jl index 75ee6ac15c..cd2bd30257 100644 --- a/test/schemes/fluid/viscosity.jl +++ b/test/schemes/fluid/viscosity.jl @@ -41,7 +41,7 @@ end @testset verbose=true "`ViscosityMorris`" begin nu = 7e-3 - viscosity = ViscosityMorris(nuu) + viscosity = ViscosityMorris(; nu) system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, smoothing_length; viscosity) @@ -100,7 +100,7 @@ end @testset verbose=true "`ViscosityMorrisSGS`" begin nu = 7e-3 - viscosity = ViscosityMorrisSGS(nuu) + viscosity = ViscosityMorrisSGS(; nu) system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), state_equation, smoothing_kernel, smoothing_length; viscosity) From c8ead74b22d12c83c10f0197da0de3cc93dcdc62 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Thu, 23 Apr 2026 22:09:45 +0200 Subject: [PATCH 15/56] fix tests --- examples/fluid/falling_water_spheres_2d.jl | 6 ++++-- examples/fluid/falling_water_spheres_3d.jl | 4 +++- test/examples/examples_fluid.jl | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index 2b86a88811..dc890b136c 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -58,6 +58,7 @@ nu = 0.005 alpha = 8 * nu / (fluid_smoothing_length * sound_speed) viscosity = ArtificialViscosityMonaghan(; alpha, beta=0.0) density_diffusion = DensityDiffusionAntuono(delta=0.1) +surface_tension = SurfaceTensionAkinci(surface_tension_coefficient=0.05) sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1; smoothing_kernel=fluid_smoothing_kernel, @@ -65,7 +66,7 @@ sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1; sound_speed, viscosity, density_calculator=ContinuityDensity(), acceleration=(0.0, -gravity), - surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.05), + surface_tension, reference_particle_spacing=fluid_particle_spacing) sphere = WeaklyCompressibleSPHSystem(sphere2; @@ -86,8 +87,9 @@ boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundar viscosity=ViscosityAdami(nu=wall_viscosity), reference_particle_spacing=fluid_particle_spacing) +adhesion_coefficient = 1.0 boundary_system = WallBoundarySystem(tank.boundary, boundary_model, - adhesion_coefficient=1.0) + adhesion_coefficient) # ========================================================================================== # ==== Simulation diff --git a/examples/fluid/falling_water_spheres_3d.jl b/examples/fluid/falling_water_spheres_3d.jl index 7727acf9a4..1215cf4ae8 100644 --- a/examples/fluid/falling_water_spheres_3d.jl +++ b/examples/fluid/falling_water_spheres_3d.jl @@ -33,6 +33,8 @@ sphere2 = SphereShape(fluid_particle_spacing, sphere1_radius, sphere2_center, # `compact_support` needs to be `2.0 * particle_spacing` to be correct fluid_smoothing_length = 1.0 * fluid_particle_spacing +surface_tension = SurfaceTensionAkinci(surface_tension_coefficient=0.05) + trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); fluid_particle_spacing, tspan=(0.0, 0.1), @@ -43,4 +45,4 @@ trixi_include(@__MODULE__, fluid_smoothing_length, fluid_smoothing_kernel=SchoenbergCubicSplineKernel{3}(), nu, alpha=10 * nu / (fluid_smoothing_length * sound_speed), - surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.05)) + surface_tension) diff --git a/test/examples/examples_fluid.jl b/test/examples/examples_fluid.jl index 56e0869aa4..ef2f5ba04b 100644 --- a/test/examples/examples_fluid.jl +++ b/test/examples/examples_fluid.jl @@ -593,7 +593,7 @@ # Prepare keyword arguments kwargs = model_name == "SurfaceTensionNone" ? (surface_tension=nothing,) : - (surface_tensionn,) + (surface_tension=surface_tension,) # Execute the example script with the current surface tension model @trixi_test_nowarn trixi_include(@__MODULE__, @@ -626,7 +626,7 @@ # Prepare keyword arguments kwargs = model_name == "SurfaceTensionNone" ? (surface_tension=nothing,) : - (surface_tensionn,) + (surface_tension=surface_tension,) # Execute the example script with the current surface tension model @trixi_test_nowarn trixi_include(@__MODULE__, From 69688289581b74b0fac8cf410c2db05770fdbfa9 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Fri, 24 Apr 2026 00:32:58 +0200 Subject: [PATCH 16/56] fix tests --- examples/fluid/falling_water_spheres_2d.jl | 17 ++++++++++------- .../fluid/sphere_surface_tension_wall_2d.jl | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index dc890b136c..d845f27659 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -20,10 +20,12 @@ spacing_ratio = 1 # ==== Experiment Setup gravity = 9.81 tspan = (0.0, 0.3) +acceleration = (0.0, -gravity) # Boundary geometry and initial fluid particle positions initial_fluid_size = (0.0, 0.0) tank_size = (2.0, 0.5) +faces = (true, true, true, false) fluid_density = 1000.0 sound_speed = 100 @@ -32,8 +34,7 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; n_layers=boundary_layers, spacing_ratio, - faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation) + faces, acceleration, state_equation) sphere_radius = 0.05 @@ -58,14 +59,15 @@ nu = 0.005 alpha = 8 * nu / (fluid_smoothing_length * sound_speed) viscosity = ArtificialViscosityMonaghan(; alpha, beta=0.0) density_diffusion = DensityDiffusionAntuono(delta=0.1) -surface_tension = SurfaceTensionAkinci(surface_tension_coefficient=0.05) +surface_tension_coefficient = 0.05 +surface_tension = SurfaceTensionAkinci(; surface_tension_coefficient) sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, sound_speed, viscosity, density_calculator=ContinuityDensity(), - acceleration=(0.0, -gravity), + acceleration, surface_tension, reference_particle_spacing=fluid_particle_spacing) @@ -74,7 +76,7 @@ sphere = WeaklyCompressibleSPHSystem(sphere2; smoothing_length=fluid_smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, density_diffusion, - acceleration=(0.0, -gravity)) + acceleration) # ========================================================================================== # ==== Boundary @@ -88,7 +90,7 @@ boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundar reference_particle_spacing=fluid_particle_spacing) adhesion_coefficient = 1.0 -boundary_system = WallBoundarySystem(tank.boundary, boundary_model, +boundary_system = WallBoundarySystem(tank.boundary, boundary_model; adhesion_coefficient) # ========================================================================================== @@ -96,7 +98,8 @@ boundary_system = WallBoundarySystem(tank.boundary, boundary_model, semi = Semidiscretization(sphere_surface_tension, sphere, boundary_system) ode = semidiscretize(semi, tspan) -info_callback = InfoCallback(interval=1000) +interval = 1000 +info_callback = InfoCallback(interval) saving_callback = SolutionSavingCallback(dt=0.01, output_directory="out", prefix="") diff --git a/examples/fluid/sphere_surface_tension_wall_2d.jl b/examples/fluid/sphere_surface_tension_wall_2d.jl index 88f0adbc81..79420c1e8f 100644 --- a/examples/fluid/sphere_surface_tension_wall_2d.jl +++ b/examples/fluid/sphere_surface_tension_wall_2d.jl @@ -65,7 +65,7 @@ sphere_surface_tension = WeaklyCompressibleSPHSystem(sphere1; trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); sphere=nothing, sphere1, adhesion_coefficient=0.001, - wall_viscosity=4.0 * nu, surface_tension_coefficient=0.9, alpha, + wall_viscosity=4.0 * nu, alpha, sound_speed, fluid_density, nu, fluid_particle_spacing, tspan, tank_size, fluid_smoothing_length, From c69985381302f59549eb5ee9b369e0da1be75825 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Fri, 24 Apr 2026 01:57:28 +0200 Subject: [PATCH 17/56] fix tests --- examples/fluid/falling_water_spheres_2d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index d845f27659..392f95e26d 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -99,7 +99,7 @@ semi = Semidiscretization(sphere_surface_tension, sphere, boundary_system) ode = semidiscretize(semi, tspan) interval = 1000 -info_callback = InfoCallback(interval) +info_callback = InfoCallback(; interval) saving_callback = SolutionSavingCallback(dt=0.01, output_directory="out", prefix="") From ae2c7b091dd06fd19259b6f6ac31f8db10479415 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Mon, 27 Apr 2026 16:15:52 +0200 Subject: [PATCH 18/56] format --- docs/literate/src/tut_custom_kernel.jl | 3 +- docs/literate/src/tut_packing.jl | 84 ++++++-------- docs/literate/src/tut_rigid_body_fsi.jl | 44 +++----- docs/literate/src/tut_setup.jl | 13 +-- examples/dem/collapsing_sand_pile_3d.jl | 5 +- examples/fluid/accelerated_tank_2d.jl | 5 +- examples/fluid/dam_break_2d.jl | 6 +- examples/fluid/dam_break_2d_gpu.jl | 11 +- examples/fluid/dam_break_2d_iisph.jl | 30 ++--- .../dam_break_2d_iisph_pressure_boundaries.jl | 23 ++-- examples/fluid/dam_break_2phase_2d.jl | 7 +- examples/fluid/dam_break_3d.jl | 3 +- examples/fluid/dam_break_oil_film_2d.jl | 7 +- examples/fluid/falling_water_column_2d.jl | 3 +- examples/fluid/falling_water_spheres_2d.jl | 7 +- examples/fluid/falling_water_spheres_3d.jl | 15 +-- examples/fluid/lid_driven_cavity_2d.jl | 25 ++--- examples/fluid/moving_wall_2d.jl | 3 +- examples/fluid/oscillating_drop_2d.jl | 6 +- .../fluid/periodic_array_of_cylinders_2d.jl | 15 +-- examples/fluid/periodic_channel_2d.jl | 3 +- examples/fluid/pipe_flow_2d.jl | 17 ++- examples/fluid/pipe_flow_3d.jl | 8 +- examples/fluid/poiseuille_flow_2d.jl | 12 +- examples/fluid/poiseuille_flow_3d.jl | 14 +-- examples/fluid/pulsative_channel_flow_3d.jl | 6 +- examples/fluid/sphere_surface_tension_2d.jl | 15 +-- examples/fluid/sphere_surface_tension_3d.jl | 7 +- .../fluid/sphere_surface_tension_wall_2d.jl | 11 +- examples/fluid/taylor_green_vortex_2d.jl | 3 +- examples/fsi/dam_break_gate_2d.jl | 3 +- examples/fsi/dam_break_plate_2d.jl | 3 +- examples/fsi/falling_rigid_spheres_2d.jl | 16 +-- .../fsi/falling_rotating_rigid_squares_2d.jl | 4 +- examples/fsi/falling_spheres_2d.jl | 4 +- examples/fsi/falling_water_column_2d.jl | 13 +-- examples/fsi/hydrostatic_water_column_2d.jl | 15 +-- examples/preprocessing/packing_2d.jl | 3 +- examples/preprocessing/packing_3d.jl | 5 +- .../structure/colliding_rigid_spheres_2d.jl | 8 +- examples/structure/oscillating_beam_2d.jl | 3 +- src/callbacks/info.jl | 6 +- src/callbacks/solution_saving.jl | 3 +- src/general/interpolation.jl | 7 +- src/io/write_vtk.jl | 8 +- src/preprocessing/geometries/io.jl | 4 +- .../particle_packing/signed_distance.jl | 3 +- src/schemes/boundary/open_boundary/system.jl | 9 +- .../boundary/wall_boundary/dummy_particles.jl | 5 +- .../fluid/entropically_damped_sph/system.jl | 5 +- .../fluid/weakly_compressible_sph/system.jl | 5 +- src/setups/complex_shape.jl | 3 +- src/setups/rectangular_shape.jl | 8 +- src/setups/rectangular_tank.jl | 4 +- test/count_allocations.jl | 3 +- test/examples/dam_break_2d_corrections.jl | 13 +-- test/examples/gpu.jl | 13 +-- test/general/density_calculator.jl | 5 +- test/general/initial_condition.jl | 6 +- test/general/interpolation.jl | 43 +++----- test/io/read_vtk.jl | 5 +- test/rectangular_patch.jl | 3 +- .../dummy_particles/dummy_particles.jl | 28 ++--- .../boundary/open_boundary/mirroring.jl | 4 +- .../boundary/open_boundary/open_boundary.jl | 6 +- test/schemes/fluid/surface_normal_sph.jl | 52 +++------ test/schemes/fluid/surface_tension.jl | 5 +- test/setups/rectangular_shape.jl | 35 +++--- test/systems/iisph_system.jl | 13 +-- test/systems/rigid_system.jl | 103 ++++++------------ test/systems/tlsph_system.jl | 45 +++----- test/systems/wcsph_system.jl | 6 +- validation/dam_break_2d/setup_marrone_2011.jl | 12 +- .../dam_break_2d/validation_dam_break_2d.jl | 24 ++-- .../hydrostatic_water_column_2d/validation.jl | 11 +- .../validation_lid_driven_cavity_2d.jl | 9 +- .../validation_oscillating_beam_2d.jl | 3 +- .../validation_taylor_green_vortex_2d.jl | 19 ++-- 78 files changed, 360 insertions(+), 664 deletions(-) diff --git a/docs/literate/src/tut_custom_kernel.jl b/docs/literate/src/tut_custom_kernel.jl index 103a2780e6..c5360c3477 100644 --- a/docs/literate/src/tut_custom_kernel.jl +++ b/docs/literate/src/tut_custom_kernel.jl @@ -122,8 +122,7 @@ nothing # hide # smoothing_length); # ``` trixi_include(joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); #!md - smoothing_kernel=MyGaussianKernel(), #!md - smoothing_length) #!md + smoothing_kernel=MyGaussianKernel(), smoothing_length) #!md # See [Visualization](@ref) for how to visualize the final solution. # For the simplest visualization, we can use [Plots.jl](https://docs.juliaplots.org/stable/): diff --git a/docs/literate/src/tut_packing.jl b/docs/literate/src/tut_packing.jl index c44291e26d..8e6e08f8f0 100644 --- a/docs/literate/src/tut_packing.jl +++ b/docs/literate/src/tut_packing.jl @@ -48,8 +48,8 @@ signed_distance_field = SignedDistanceField(geometry, particle_spacing; # We can also visualize the SDF by simply creating an `InitialCondition` from the sampled points and plot it. # The color coding represents the signed distance to the geometry surface. -sdf_ic = InitialCondition(; coordinates=stack(signed_distance_field.positions), - density=1.0, particle_spacing) +sdf_ic = InitialCondition(; coordinates=stack(signed_distance_field.positions), density=1.0, + particle_spacing) plot(sdf_ic, zcolor=signed_distance_field.distances, label=nothing, color=:coolwarm) plot!(geometry, linestyle=:dash, label=nothing, showaxis=false, color=:black, @@ -63,8 +63,8 @@ signed_distance_field = SignedDistanceField(geometry, particle_spacing; max_signed_distance=boundary_thickness) # We can see in the plot that the SDF has been extended outwards to twice `max_signed_distance`. -sdf_ic = InitialCondition(; coordinates=stack(signed_distance_field.positions), - density=1.0, particle_spacing) +sdf_ic = InitialCondition(; coordinates=stack(signed_distance_field.positions), density=1.0, + particle_spacing) plot(sdf_ic, zcolor=signed_distance_field.distances, label=nothing, color=:coolwarm) @@ -146,9 +146,7 @@ smoothing_length = 0.8 * particle_spacing # Now we can create the packing system. For learning purposes, let’s first try # passing no signed distance field (SDF) and see what happens. -packing_system = ParticlePackingSystem(shape_sampled; - smoothing_kernel, - smoothing_length, +packing_system = ParticlePackingSystem(shape_sampled; smoothing_kernel, smoothing_length, signed_distance_field=nothing, background_pressure) # We now proceed with the familiar steps @@ -163,8 +161,7 @@ maxiters = 100 callbacks = CallbackSet(UpdateCallback()) time_integrator = RDPK3SpFSAL35() -sol = solve(ode, time_integrator; - abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters, +sol = solve(ode, time_integrator; abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters, callback=callbacks) packed_ic = InitialCondition(sol, packing_system, semi) @@ -176,11 +173,8 @@ plot!(geometry, seriestype=:path, linewidth=2, color=:black, label=nothing) # geometric surface. # We therefore add an SDF for the geometry and repeat the same procedure. -packing_system = ParticlePackingSystem(shape_sampled; - smoothing_kernel, - smoothing_length, - signed_distance_field, - background_pressure) +packing_system = ParticlePackingSystem(shape_sampled; smoothing_kernel, smoothing_length, + signed_distance_field, background_pressure) # Again, we follow the same steps for semidiscretization and time integration. semi = Semidiscretization(packing_system) @@ -192,8 +186,7 @@ maxiters = 1000 callbacks = CallbackSet(UpdateCallback()) time_integrator = RDPK3SpFSAL35() -sol = solve(ode, time_integrator; - abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters, +sol = solve(ode, time_integrator; abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters, callback=callbacks) packed_ic = InitialCondition(sol, packing_system, semi) @@ -214,12 +207,10 @@ plot!(geometry, seriestype=:path, color=:black, label=nothing, linewidth=2) # A `boundary_compress_factor` of `0.8` or `0.9` works well for most shapes. # Since we have a relatively large particle spacing compared to the # geometry size in this example, we will choose `0.7`. -boundary_system = ParticlePackingSystem(boundary_sampled; - is_boundary=true, - smoothing_kernel, - smoothing_length, - boundary_compress_factor=0.7, - signed_distance_field, background_pressure) +boundary_system = ParticlePackingSystem(boundary_sampled; is_boundary=true, + smoothing_kernel, smoothing_length, + boundary_compress_factor=0.7, signed_distance_field, + background_pressure) # We can now couple the boundary system with the interior system: semi = Semidiscretization(packing_system, boundary_system) @@ -231,8 +222,7 @@ maxiters = 1000 callbacks = CallbackSet(UpdateCallback()) time_integrator = RDPK3SpFSAL35() -sol = solve(ode, time_integrator; - abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters, +sol = solve(ode, time_integrator; abstol=1e-7, reltol=1e-4, save_everystep=false, maxiters, callback=callbacks) packed_ic = InitialCondition(sol, packing_system, semi) @@ -254,11 +244,8 @@ plot!(geometry, seriestype=:path, color=:black, linestyle=:dash, linewidth=2, la # Because we are satisfied with this particle distribution, we want it to remain unchanged. # Therefore, we set `fixed_system=true` so that this system is not integrated further # but instead serves as a static boundary for the packing of other domains. -fixed_system = ParticlePackingSystem(packed_ic; - smoothing_kernel, - smoothing_length, - signed_distance_field=nothing, - background_pressure, +fixed_system = ParticlePackingSystem(packed_ic; smoothing_kernel, smoothing_length, + signed_distance_field=nothing, background_pressure, fixed_system=true) # Now we define a rectangular domain that we want to pack. @@ -273,10 +260,8 @@ sampled_outer_domain = setdiff(tank_domain.fluid, packed_ic) plot(sampled_outer_domain, packed_ic) # Next, we create a packing system for the outer domain. -packing_system = ParticlePackingSystem(sampled_outer_domain; - smoothing_kernel, - smoothing_length, - signed_distance_field=nothing, +packing_system = ParticlePackingSystem(sampled_outer_domain; smoothing_kernel, + smoothing_length, signed_distance_field=nothing, background_pressure) # Since we do not want to sample a boundary for the outer domain, @@ -293,8 +278,8 @@ maxiters = 1000 callbacks = CallbackSet(UpdateCallback()) time_integrator = RDPK3SpFSAL35() -sol_1 = solve(ode, time_integrator; abstol=1e-7, reltol=1e-4, - save_everystep=false, maxiters, callback=callbacks) +sol_1 = solve(ode, time_integrator; abstol=1e-7, reltol=1e-4, save_everystep=false, + maxiters, callback=callbacks) packed_outer_domain = InitialCondition(sol_1, packing_system, semi) @@ -323,24 +308,17 @@ plot(pack_domain, fixed_domain, packed_ic) # We can now treat the particles outside the window, along with the already # finalized configuration of the complex geometry, as fixed systems: -fixed_system_1 = ParticlePackingSystem(fixed_domain; - smoothing_kernel, - smoothing_length, - signed_distance_field=nothing, - background_pressure, fixed_system=true) - -fixed_system_2 = ParticlePackingSystem(packed_ic; - smoothing_kernel, - smoothing_length, - signed_distance_field=nothing, - background_pressure, fixed_system=true) +fixed_system_1 = ParticlePackingSystem(fixed_domain; smoothing_kernel, smoothing_length, + signed_distance_field=nothing, background_pressure, + fixed_system=true) + +fixed_system_2 = ParticlePackingSystem(packed_ic; smoothing_kernel, smoothing_length, + signed_distance_field=nothing, background_pressure, + fixed_system=true) # The window that we want to pack is passed to a moving packing system: -packing_system = ParticlePackingSystem(pack_domain; - smoothing_kernel, - smoothing_length, - signed_distance_field=nothing, - background_pressure) +packing_system = ParticlePackingSystem(pack_domain; smoothing_kernel, smoothing_length, + signed_distance_field=nothing, background_pressure) semi = Semidiscretization(packing_system, fixed_system_1, fixed_system_2) @@ -351,8 +329,8 @@ maxiters = 1000 callbacks = CallbackSet(UpdateCallback()) time_integrator = RDPK3SpFSAL35() -sol_2 = solve(ode, time_integrator; abstol=1e-7, reltol=1e-4, - save_everystep=false, maxiters, callback=callbacks) +sol_2 = solve(ode, time_integrator; abstol=1e-7, reltol=1e-4, save_everystep=false, + maxiters, callback=callbacks) packed_fluid_domain = InitialCondition(sol_2, packing_system, semi) diff --git a/docs/literate/src/tut_rigid_body_fsi.jl b/docs/literate/src/tut_rigid_body_fsi.jl index 09ad054f1d..65b5d9ec38 100644 --- a/docs/literate/src/tut_rigid_body_fsi.jl +++ b/docs/literate/src/tut_rigid_body_fsi.jl @@ -44,8 +44,8 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; n_layers=boundary_layers, spacing_ratio, - faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation) + faces=(true, true, true, false), acceleration=(0.0, -gravity), + state_equation) nothing # hide # ## Rigid body geometry @@ -101,9 +101,7 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, density_calculator=fluid_density_calculator, - state_equation, - viscosity, - density_diffusion, + state_equation, viscosity, density_diffusion, acceleration=(0.0, -gravity)) nothing # hide @@ -237,15 +235,11 @@ contact_model = RigidContactModel(; normal_stiffness=2.0e5, contact_distance=2.0 * structure_particle_spacing) nothing # hide -rigid_body_system_1_step3 = RigidBodySystem(square1; - boundary_model=square1_boundary_model, - contact_model, - acceleration=(0.0, -gravity), +rigid_body_system_1_step3 = RigidBodySystem(square1; boundary_model=square1_boundary_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) -rigid_body_system_2_step3 = RigidBodySystem(square2; - boundary_model=square2_boundary_model, - contact_model, - acceleration=(0.0, -gravity), +rigid_body_system_2_step3 = RigidBodySystem(square2; boundary_model=square2_boundary_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) nothing # hide @@ -304,15 +298,11 @@ circle1_boundary_model = rigid_body_boundary_model(circle1) circle2_boundary_model = rigid_body_boundary_model(circle2) nothing # hide -rigid_body_system_1_step4 = RigidBodySystem(circle1; - boundary_model=circle1_boundary_model, - contact_model, - acceleration=(0.0, -gravity), +rigid_body_system_1_step4 = RigidBodySystem(circle1; boundary_model=circle1_boundary_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) -rigid_body_system_2_step4 = RigidBodySystem(circle2; - boundary_model=circle2_boundary_model, - contact_model, - acceleration=(0.0, -gravity), +rigid_body_system_2_step4 = RigidBodySystem(circle2; boundary_model=circle2_boundary_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) nothing # hide @@ -362,10 +352,8 @@ small_spheres = [SphereShape(structure_particle_spacing, small_sphere_radius, small_sphere_systems = [begin sphere_boundary_model = rigid_body_boundary_model(sphere) - RigidBodySystem(sphere; - boundary_model=sphere_boundary_model, - contact_model, - acceleration=(0.0, -gravity), + RigidBodySystem(sphere; boundary_model=sphere_boundary_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) end for sphere in small_spheres] @@ -421,10 +409,8 @@ hexagon_shape = TrixiParticles.@set hexagon_shape.particle_spacing = structure_p # just like the other shapes in this tutorial. hexagon_boundary_model = rigid_body_boundary_model(hexagon_shape) -hexagon_system = RigidBodySystem(hexagon_shape; - boundary_model=hexagon_boundary_model, - contact_model, - acceleration=(0.0, -gravity), +hexagon_system = RigidBodySystem(hexagon_shape; boundary_model=hexagon_boundary_model, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) # # You can then create a semidiscretization with this new system. diff --git a/docs/literate/src/tut_setup.jl b/docs/literate/src/tut_setup.jl index a115b63599..cd9f2b7068 100644 --- a/docs/literate/src/tut_setup.jl +++ b/docs/literate/src/tut_setup.jl @@ -79,9 +79,9 @@ nothing # hide # Here, we use the [`RectangularTank`](@ref) setup, which generates a rectangular # fluid inside a rectangular tank, and supports a hydrostatic pressure gradient # by passing a gravitational acceleration and a state equation (see above). -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, - fluid_density; n_layers=boundary_layers, - acceleration=(0.0, -gravity), state_equation) +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, acceleration=(0.0, -gravity), + state_equation) nothing # hide # A `RectangularTank` consists of two [`InitialCondition`](@ref)s, `tank.fluid` and `tank.boundary`. # We can plot these initial conditions to visualize the initial setup. @@ -120,12 +120,9 @@ nothing # hide # The simulation quality greatly benefits from using [density diffusion](@ref density_diffusion). fluid_density_calculator = ContinuityDensity() density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation, - viscosity, - density_diffusion, + state_equation, viscosity, density_diffusion, acceleration=(0.0, -gravity)) nothing # hide diff --git a/examples/dem/collapsing_sand_pile_3d.jl b/examples/dem/collapsing_sand_pile_3d.jl index 1c5b7087be..a768219bf3 100644 --- a/examples/dem/collapsing_sand_pile_3d.jl +++ b/examples/dem/collapsing_sand_pile_3d.jl @@ -64,9 +64,8 @@ boundary_particles = floor_particles contact_model = LinearContactModel(1e6) damping_coefficient = 0.00001 -sand_system = DEMSystem(sand_particles; contact_model, - damping_coefficient, - acceleration, radius=0.4 * particle_spacing) +sand_system = DEMSystem(sand_particles; contact_model, damping_coefficient, acceleration, + radius=0.4 * particle_spacing) boundary_stiffness = 1.0e5 boundary_system = BoundaryDEMSystem(boundary_particles; normal_stiffness=boundary_stiffness) diff --git a/examples/fluid/accelerated_tank_2d.jl b/examples/fluid/accelerated_tank_2d.jl index 92b3289c14..228436f009 100644 --- a/examples/fluid/accelerated_tank_2d.jl +++ b/examples/fluid/accelerated_tank_2d.jl @@ -20,6 +20,5 @@ boundary_movement = PrescribedMotion(movement_function, is_moving) trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "hydrostatic_water_column_2d.jl"); - fluid_particle_spacing, - prescribed_motion=boundary_movement, - tspan=(0.0, 1.0), system_acceleration=(0.0, 0.0)); + fluid_particle_spacing, prescribed_motion=boundary_movement, tspan=(0.0, 1.0), + system_acceleration=(0.0, 0.0)); diff --git a/examples/fluid/dam_break_2d.jl b/examples/fluid/dam_break_2d.jl index e825044618..62c1f1bfc9 100644 --- a/examples/fluid/dam_break_2d.jl +++ b/examples/fluid/dam_break_2d.jl @@ -65,13 +65,11 @@ viscosity_fluid = ArtificialViscosityMonaghan(; alpha, beta=0.0) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) # density_diffusion = DensityDiffusionAntuono(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity=viscosity_fluid, density_diffusion, acceleration=(0.0, -gravity), - correction=nothing, - surface_tension=nothing, + correction=nothing, surface_tension=nothing, reference_particle_spacing=0) # ========================================================================================== diff --git a/examples/fluid/dam_break_2d_gpu.jl b/examples/fluid/dam_break_2d_gpu.jl index 35ebaf4f66..54b31e59c2 100644 --- a/examples/fluid/dam_break_2d_gpu.jl +++ b/examples/fluid/dam_break_2d_gpu.jl @@ -40,11 +40,6 @@ cell_list = FullGridCellList(; min_corner, max_corner) neighborhood_search = GridNeighborhoodSearch{2}(; cell_list) # Run the dam break simulation with this neighborhood search -trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); - neighborhood_search, - fluid_particle_spacing, - tspan, - boundary_layers, spacing_ratio, - parallelization_backend=PolyesterBackend(), - coordinates_eltype) +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + neighborhood_search, fluid_particle_spacing, tspan, boundary_layers, + spacing_ratio, parallelization_backend=PolyesterBackend(), coordinates_eltype) diff --git a/examples/fluid/dam_break_2d_iisph.jl b/examples/fluid/dam_break_2d_iisph.jl index 03c19409ee..3606f2e0aa 100644 --- a/examples/fluid/dam_break_2d_iisph.jl +++ b/examples/fluid/dam_break_2d_iisph.jl @@ -5,11 +5,8 @@ fluid_particle_spacing = 0.6 / 40 tspan = (0.0, 5.7 / sqrt(9.81 / 0.6)) # Load setup from dam break example -trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); - fluid_particle_spacing, - tspan, - sol=nothing, ode=nothing) +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + fluid_particle_spacing, tspan, sol=nothing, ode=nothing) # IISPH doesn't require a large compact support like WCSPH and performs worse with a typical # smoothing length used for WCSPH. @@ -28,26 +25,17 @@ viscosity = ViscosityAdami(; nu) # Use IISPH as fluid system time_step = 1e-3 -fluid_system = ImplicitIncompressibleSPHSystem(tank.fluid; - smoothing_kernel, +fluid_system = ImplicitIncompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, - reference_density=fluid_density, - viscosity, + reference_density=fluid_density, viscosity, acceleration=(0.0, -gravity), - min_iterations=2, - max_iterations=30, + min_iterations=2, max_iterations=30, time_step) # Run the dam break simulation with these changes -trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); - neighborhood_search=GridNeighborhoodSearch{2}(), - viscosity_fluid=viscosity, - smoothing_kernel, - smoothing_length, - fluid_system, - boundary_density_calculator=PressureZeroing(), - tspan, - state_equation=nothing, +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + neighborhood_search=GridNeighborhoodSearch{2}(), viscosity_fluid=viscosity, + smoothing_kernel, smoothing_length, fluid_system, + boundary_density_calculator=PressureZeroing(), tspan, state_equation=nothing, callbacks=CallbackSet(info_callback, saving_callback), time_integration_scheme=SymplecticEuler(), dt=time_step) diff --git a/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl b/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl index d853155f98..cd2fb35809 100644 --- a/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl +++ b/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl @@ -22,26 +22,17 @@ time_step = 1e-3 # Reduce omega when using pressure boundaries to ensure numerical stability omega = 0.4 -iisph_system = ImplicitIncompressibleSPHSystem(tank.fluid; - smoothing_kernel, +iisph_system = ImplicitIncompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, - reference_density=fluid_density, - viscosity, + reference_density=fluid_density, viscosity, acceleration=(0.0, -gravity), - min_iterations=2, - max_iterations=30, - omega, + min_iterations=2, max_iterations=30, omega, time_step) # Run the dam break simulation with these changes -trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); - viscosity_fluid=viscosity, - smoothing_kernel, - smoothing_length, +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); + viscosity_fluid=viscosity, smoothing_kernel, smoothing_length, fluid_system=iisph_system, - boundary_density_calculator=PressureBoundaries(; time_step, omega), - tspan, - state_equation=nothing, - callbacks=CallbackSet(info_callback, saving_callback), + boundary_density_calculator=PressureBoundaries(; time_step, omega), tspan, + state_equation=nothing, callbacks=CallbackSet(info_callback, saving_callback), time_integration_scheme=SymplecticEuler(), dt=time_step) diff --git a/examples/fluid/dam_break_2phase_2d.jl b/examples/fluid/dam_break_2phase_2d.jl index be86bdbc3a..bb54d095c7 100644 --- a/examples/fluid/dam_break_2phase_2d.jl +++ b/examples/fluid/dam_break_2phase_2d.jl @@ -41,10 +41,9 @@ air_viscosity = ViscosityMorris(nu=nu_sim_air) water_viscosity = ViscosityMorris(nu=nu_sim_water) trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); - sol=nothing, fluid_particle_spacing, - viscosity_fluid=water_viscosity, smoothing_length, - gravity, tspan, density_diffusion=nothing, - sound_speed, exponent=7, + sol=nothing, fluid_particle_spacing, viscosity_fluid=water_viscosity, + smoothing_length, gravity, tspan, density_diffusion=nothing, sound_speed, + exponent=7, tank_size=(floor(5.366 * H / fluid_particle_spacing) * fluid_particle_spacing, 2.6 * H)) diff --git a/examples/fluid/dam_break_3d.jl b/examples/fluid/dam_break_3d.jl index 4282b69a20..75f0b91d96 100644 --- a/examples/fluid/dam_break_3d.jl +++ b/examples/fluid/dam_break_3d.jl @@ -47,8 +47,7 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, density_diffusion, acceleration=(0.0, -gravity, 0.0)) diff --git a/examples/fluid/dam_break_oil_film_2d.jl b/examples/fluid/dam_break_oil_film_2d.jl index 3bbd292f57..93f68021df 100644 --- a/examples/fluid/dam_break_oil_film_2d.jl +++ b/examples/fluid/dam_break_oil_film_2d.jl @@ -36,10 +36,9 @@ oil_viscosity = ViscosityMorris(nu=nu_sim_oil) # TODO: broken if both systems use surface tension trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); sol=nothing, fluid_particle_spacing, tspan, - viscosity_fluid=ViscosityMorris(nu=nu_sim_water), - smoothing_length, - gravity, density_diffusion=nothing, sound_speed, - prefix="", reference_particle_spacing=fluid_particle_spacing) + viscosity_fluid=ViscosityMorris(nu=nu_sim_water), smoothing_length, gravity, + density_diffusion=nothing, sound_speed, prefix="", + reference_particle_spacing=fluid_particle_spacing) # ========================================================================================== # ==== Setup oil layer diff --git a/examples/fluid/falling_water_column_2d.jl b/examples/fluid/falling_water_column_2d.jl index f845f1ec5f..d78a5eb231 100644 --- a/examples/fluid/falling_water_column_2d.jl +++ b/examples/fluid/falling_water_column_2d.jl @@ -45,8 +45,7 @@ smoothing_kernel = SchoenbergCubicSplineKernel{2}() fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, acceleration=(0.0, -gravity)) diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index 2b86a88811..9218168e55 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -32,8 +32,8 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; n_layers=boundary_layers, spacing_ratio, - faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation) + faces=(true, true, true, false), acceleration=(0.0, -gravity), + state_equation) sphere_radius = 0.05 @@ -68,8 +68,7 @@ sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1; surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.05), reference_particle_spacing=fluid_particle_spacing) -sphere = WeaklyCompressibleSPHSystem(sphere2; - smoothing_kernel=fluid_smoothing_kernel, +sphere = WeaklyCompressibleSPHSystem(sphere2; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, density_diffusion, diff --git a/examples/fluid/falling_water_spheres_3d.jl b/examples/fluid/falling_water_spheres_3d.jl index 7727acf9a4..42396899df 100644 --- a/examples/fluid/falling_water_spheres_3d.jl +++ b/examples/fluid/falling_water_spheres_3d.jl @@ -33,14 +33,11 @@ sphere2 = SphereShape(fluid_particle_spacing, sphere1_radius, sphere2_center, # `compact_support` needs to be `2.0 * particle_spacing` to be correct fluid_smoothing_length = 1.0 * fluid_particle_spacing -trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); - fluid_particle_spacing, tspan=(0.0, 0.1), - initial_fluid_size=(0.0, 0.0, 0.0), interval=100, - tank_size=(2.0, 1.0, 0.1), sound_speed, +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); + fluid_particle_spacing, tspan=(0.0, 0.1), initial_fluid_size=(0.0, 0.0, 0.0), + interval=100, tank_size=(2.0, 1.0, 0.1), sound_speed, faces=(true, true, true, true, true, false), - acceleration=(0.0, 0.0, -gravity), sphere1, sphere2, - fluid_smoothing_length, - fluid_smoothing_kernel=SchoenbergCubicSplineKernel{3}(), - nu, alpha=10 * nu / (fluid_smoothing_length * sound_speed), + acceleration=(0.0, 0.0, -gravity), sphere1, sphere2, fluid_smoothing_length, + fluid_smoothing_kernel=SchoenbergCubicSplineKernel{3}(), nu, + alpha=10 * nu / (fluid_smoothing_length * sound_speed), surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.05)) diff --git a/examples/fluid/lid_driven_cavity_2d.jl b/examples/fluid/lid_driven_cavity_2d.jl index 78b31034aa..b01dea22b1 100644 --- a/examples/fluid/lid_driven_cavity_2d.jl +++ b/examples/fluid/lid_driven_cavity_2d.jl @@ -42,8 +42,8 @@ pressure = sound_speed^2 * fluid_density viscosity = ViscosityAdami(; nu=VELOCITY_LID / reynolds_number) cavity = RectangularTank(particle_spacing, cavity_size, cavity_size, fluid_density; - n_layers=boundary_layers, - faces=(true, true, true, false), pressure) + n_layers=boundary_layers, faces=(true, true, true, false), + pressure) lid_position = 0.0 - particle_spacing * boundary_layers lid_length = cavity.n_particles_per_dimension[1] + 2boundary_layers @@ -61,21 +61,18 @@ if wcsph density_calculator = ContinuityDensity() state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) - fluid_system = WeaklyCompressibleSPHSystem(cavity.fluid; - smoothing_kernel, smoothing_length, - density_calculator, state_equation, + fluid_system = WeaklyCompressibleSPHSystem(cavity.fluid; smoothing_kernel, + smoothing_length, density_calculator, + state_equation, pressure_acceleration=TrixiParticles.inter_particle_averaged_pressure, viscosity, shifting_technique=TransportVelocityAdami(background_pressure=pressure)) else state_equation = nothing density_calculator = ContinuityDensity() - fluid_system = EntropicallyDampedSPHSystem(cavity.fluid; - smoothing_kernel, - smoothing_length, - density_calculator, - sound_speed, - viscosity, + fluid_system = EntropicallyDampedSPHSystem(cavity.fluid; smoothing_kernel, + smoothing_length, density_calculator, + sound_speed, viscosity, shifting_technique=TransportVelocityAdami(background_pressure=pressure)) end @@ -92,14 +89,12 @@ boundary_model_cavity = BoundaryModelDummyParticles(cavity.boundary.density, cavity.boundary.mass, AdamiPressureExtrapolation(), smoothing_kernel, smoothing_length; - viscosity, - state_equation) + viscosity, state_equation) boundary_model_lid = BoundaryModelDummyParticles(lid.density, lid.mass, AdamiPressureExtrapolation(), smoothing_kernel, smoothing_length; - viscosity, - state_equation) + viscosity, state_equation) boundary_system_cavity = WallBoundarySystem(cavity.boundary, boundary_model_cavity) diff --git a/examples/fluid/moving_wall_2d.jl b/examples/fluid/moving_wall_2d.jl index 44f0de9892..67e5eef882 100644 --- a/examples/fluid/moving_wall_2d.jl +++ b/examples/fluid/moving_wall_2d.jl @@ -51,8 +51,7 @@ smoothing_kernel = SchoenbergCubicSplineKernel{2}() fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.1, beta=0.0) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, acceleration=(0.0, -gravity)) diff --git a/examples/fluid/oscillating_drop_2d.jl b/examples/fluid/oscillating_drop_2d.jl index d2cec27a26..d35e996cc3 100644 --- a/examples/fluid/oscillating_drop_2d.jl +++ b/examples/fluid/oscillating_drop_2d.jl @@ -42,8 +42,7 @@ Q = (sigma^2 + OMEGA^2) * fluid_density / 2 pressure = coords -> Q * (1 - coords[1]^2 - coords[2]^2) density = coords -> TrixiParticles.inverse_state_equation(state_equation, pressure(coords)) -fluid = SphereShape(fluid_particle_spacing, radius, (0.0, 0.0), - density; pressure, +fluid = SphereShape(fluid_particle_spacing, radius, (0.0, 0.0), density; pressure, sphere_type=RoundSphere(), velocity=coords -> sigma .* (coords[1], -coords[2])) @@ -56,8 +55,7 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) density_diffusion = DensityDiffusionAntuono(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(fluid; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, density_diffusion, source_terms) diff --git a/examples/fluid/periodic_array_of_cylinders_2d.jl b/examples/fluid/periodic_array_of_cylinders_2d.jl index c3441176ee..c277596025 100644 --- a/examples/fluid/periodic_array_of_cylinders_2d.jl +++ b/examples/fluid/periodic_array_of_cylinders_2d.jl @@ -46,9 +46,8 @@ pressure = sound_speed^2 * fluid_density particle_spacing = tank_size[1] / n_particles_x -box = RectangularTank(particle_spacing, fluid_size, tank_size, - fluid_density; n_layers=boundary_layers, - pressure, faces=(false, false, true, true)) +box = RectangularTank(particle_spacing, fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, pressure, faces=(false, false, true, true)) cylinder = SphereShape(particle_spacing, cylinder_radius, tank_size ./ 2, fluid_density, sphere_type=RoundSphere()) @@ -64,8 +63,7 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit exponent=1, clip_negative_pressure=false) density_diffusion = DensityDiffusionAntuono(delta=0.1) -fluid_system = WeaklyCompressibleSPHSystem(fluid; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, smoothing_length, density_calculator=ContinuityDensity(), state_equation, density_diffusion, viscosity=ViscosityAdami(; nu), @@ -76,10 +74,9 @@ fluid_system = WeaklyCompressibleSPHSystem(fluid; # ========================================================================================== # ==== Boundary boundary_model = BoundaryModelDummyParticles(boundary.density, boundary.mass, - AdamiPressureExtrapolation(), - smoothing_kernel, smoothing_length; - viscosity=ViscosityAdami(; nu), - state_equation) + AdamiPressureExtrapolation(), smoothing_kernel, + smoothing_length; + viscosity=ViscosityAdami(; nu), state_equation) boundary_system = WallBoundarySystem(boundary, boundary_model) diff --git a/examples/fluid/periodic_channel_2d.jl b/examples/fluid/periodic_channel_2d.jl index 3b85e54124..0bb9609596 100644 --- a/examples/fluid/periodic_channel_2d.jl +++ b/examples/fluid/periodic_channel_2d.jl @@ -46,8 +46,7 @@ fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) # `pressure_acceleration=nothing` is the default and can be overwritten with `trixi_include` -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, shifting_technique=nothing, diff --git a/examples/fluid/pipe_flow_2d.jl b/examples/fluid/pipe_flow_2d.jl index 20ea499a24..0f345fd2f4 100644 --- a/examples/fluid/pipe_flow_2d.jl +++ b/examples/fluid/pipe_flow_2d.jl @@ -82,20 +82,18 @@ if wcsph exponent=1) density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) - fluid_system = WeaklyCompressibleSPHSystem(pipe.fluid; - smoothing_kernel, smoothing_length, + fluid_system = WeaklyCompressibleSPHSystem(pipe.fluid; smoothing_kernel, + smoothing_length, density_calculator=fluid_density_calculator, - state_equation, density_diffusion, - viscosity, + state_equation, density_diffusion, viscosity, shifting_technique=ParticleShiftingTechnique(v_max_factor=1.5), buffer_size=n_buffer_particles) else # Alternatively the EDAC scheme can be used state_equation = nothing - fluid_system = EntropicallyDampedSPHSystem(pipe.fluid; - smoothing_kernel, smoothing_length, - sound_speed, viscosity, + fluid_system = EntropicallyDampedSPHSystem(pipe.fluid; smoothing_kernel, + smoothing_length, sound_speed, viscosity, density_calculator=fluid_density_calculator, shifting_technique=ParticleShiftingTechnique(), buffer_size=n_buffer_particles) @@ -146,9 +144,8 @@ open_boundary = OpenBoundarySystem(inflow, outflow; fluid_system, wall = union(pipe.boundary, inlet.boundary, outlet.boundary) viscosity_boundary = viscosity boundary_model = BoundaryModelDummyParticles(wall.density, wall.mass, - AdamiPressureExtrapolation(), - smoothing_kernel, smoothing_length; - state_equation, + AdamiPressureExtrapolation(), smoothing_kernel, + smoothing_length; state_equation, viscosity=viscosity_boundary) boundary_system = WallBoundarySystem(wall, boundary_model) diff --git a/examples/fluid/pipe_flow_3d.jl b/examples/fluid/pipe_flow_3d.jl index fad9b580f3..dc0e401531 100644 --- a/examples/fluid/pipe_flow_3d.jl +++ b/examples/fluid/pipe_flow_3d.jl @@ -35,11 +35,9 @@ min_coords_outlet = (-open_boundary_layers * particle_spacing, 0.0, 0.0) # setup simulation trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "pipe_flow_2d.jl"); - domain_size, open_boundary_size, - flow_direction, faces=(false, false, true, true, true, true), - tspan, prescribed_velocity, - open_boundary_layers, min_coords_inlet, - min_coords_outlet, + domain_size, open_boundary_size, flow_direction, + faces=(false, false, true, true, true, true), tspan, prescribed_velocity, + open_boundary_layers, min_coords_inlet, min_coords_outlet, face_in=([0.0, 0.0, 0.0], [0.0, domain_size[2], 0.0], [0.0, 0.0, domain_size[3]]), face_out=([domain_size[1], 0.0, 0.0], [domain_size[1], domain_size[2], 0.0], diff --git a/examples/fluid/poiseuille_flow_2d.jl b/examples/fluid/poiseuille_flow_2d.jl index 7ee58ae923..fc2a4185b4 100644 --- a/examples/fluid/poiseuille_flow_2d.jl +++ b/examples/fluid/poiseuille_flow_2d.jl @@ -96,8 +96,7 @@ shifting_technique = TransportVelocityAdami(; background_pressure) if use_wcsph state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) - fluid_system = WeaklyCompressibleSPHSystem(fluid; - smoothing_kernel, smoothing_length, + fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation, buffer_size=n_buffer_particles, @@ -107,8 +106,7 @@ if use_wcsph else state_equation = nothing - fluid_system = EntropicallyDampedSPHSystem(fluid; - smoothing_kernel, smoothing_length, + fluid_system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel, smoothing_length, sound_speed, viscosity, density_calculator=fluid_density_calculator, shifting_technique, @@ -156,10 +154,8 @@ open_boundary = OpenBoundarySystem(inlet_boundary_zone, outlet_boundary_zone; fl wall_boundary = union(channel.boundary) boundary_model = BoundaryModelDummyParticles(wall_boundary.density, wall_boundary.mass, - AdamiPressureExtrapolation(), - smoothing_kernel, smoothing_length; - state_equation, - viscosity) + AdamiPressureExtrapolation(), smoothing_kernel, + smoothing_length; state_equation, viscosity) boundary_system = WallBoundarySystem(wall_boundary, boundary_model) diff --git a/examples/fluid/poiseuille_flow_3d.jl b/examples/fluid/poiseuille_flow_3d.jl index 4fe9a5a2c0..5a05b2704b 100644 --- a/examples/fluid/poiseuille_flow_3d.jl +++ b/examples/fluid/poiseuille_flow_3d.jl @@ -113,8 +113,8 @@ shifting_technique = TransportVelocityAdami(; background_pressure) state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) -fluid_system = WeaklyCompressibleSPHSystem(fluid_particles; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(fluid_particles; smoothing_kernel, + smoothing_length, density_calculator=fluid_density_calculator, state_equation, buffer_size=n_buffer_particles, shifting_technique, @@ -169,10 +169,8 @@ open_boundary = OpenBoundarySystem(inlet_zone, outlet_zone; fluid_system, # ========================================================================================== # ==== Boundary boundary_model = BoundaryModelDummyParticles(wall_boundary.density, wall_boundary.mass, - AdamiPressureExtrapolation(), - smoothing_kernel, smoothing_length; - state_equation, - viscosity) + AdamiPressureExtrapolation(), smoothing_kernel, + smoothing_length; state_equation, viscosity) boundary_system = WallBoundarySystem(wall_boundary, boundary_model) @@ -186,9 +184,7 @@ neighborhood_search = GridNeighborhoodSearch{3}(; max_corner), update_strategy=ParallelUpdate()) -semi = Semidiscretization(fluid_system, open_boundary, - boundary_system; - neighborhood_search, +semi = Semidiscretization(fluid_system, open_boundary, boundary_system; neighborhood_search, parallelization_backend=PolyesterBackend()) ode_problem = semidiscretize(semi, tspan) diff --git a/examples/fluid/pulsative_channel_flow_3d.jl b/examples/fluid/pulsative_channel_flow_3d.jl index cb11c1194b..82d9e10b66 100644 --- a/examples/fluid/pulsative_channel_flow_3d.jl +++ b/examples/fluid/pulsative_channel_flow_3d.jl @@ -39,8 +39,6 @@ extra_callback = nothing # a more full pulse is seen with a runtime of 3.0, which takes around 30m at particle_spacing_factor = 15 and around 6h at particle_spacing_factor = 30 simulation_end_time = 0.5 trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "poiseuille_flow_3d.jl"); - tspan=(0.0, simulation_end_time), - particle_spacing_factor, - extra_callback, saving_callback, v_max, - inlet_reference_pressure=dynamic_pressure_drop, + tspan=(0.0, simulation_end_time), particle_spacing_factor, extra_callback, + saving_callback, v_max, inlet_reference_pressure=dynamic_pressure_drop, outlet_reference_pressure=dynamic_pressure_drop) diff --git a/examples/fluid/sphere_surface_tension_2d.jl b/examples/fluid/sphere_surface_tension_2d.jl index b64cbea4ab..8279d7bb3d 100644 --- a/examples/fluid/sphere_surface_tension_2d.jl +++ b/examples/fluid/sphere_surface_tension_2d.jl @@ -38,21 +38,10 @@ fluid = RectangularShape(particle_spacing, round.(Int, fluid_size ./ particle_sp alpha = 8 * nu / (smoothing_length * sound_speed) source_terms = SourceTermDamping(; damping_coefficient=0.5) -# fluid_system = WeaklyCompressibleSPHSystem(fluid; -# smoothing_kernel=fluid_smoothing_kernel, -# smoothing_length, -# density_calculator=SummationDensity(), -# state_equation, -# reference_particle_spacing=particle_spacing, -# viscosity=ArtificialViscosityMonaghan(; alpha, -# beta=0.0), -# surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.02), -# correction=AkinciFreeSurfaceCorrection(fluid_density), -# source_terms) +# fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length, density_calculator=SummationDensity(), state_equation, reference_particle_spacing=particle_spacing, viscosity=ArtificialViscosityMonaghan(; alpha, beta=0.0), surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.02), correction=AkinciFreeSurfaceCorrection(fluid_density), source_terms) # Alternatively can also be used with surface_tension=SurfaceTensionMomentumMorris(surface_tension_coefficient=1.0) -fluid_system = EntropicallyDampedSPHSystem(fluid; - smoothing_kernel=fluid_smoothing_kernel, +fluid_system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length, sound_speed, viscosity=ViscosityMorris(; nu), density_calculator=ContinuityDensity(), diff --git a/examples/fluid/sphere_surface_tension_3d.jl b/examples/fluid/sphere_surface_tension_3d.jl index 7683e4057a..5c3cec6c0d 100644 --- a/examples/fluid/sphere_surface_tension_3d.jl +++ b/examples/fluid/sphere_surface_tension_3d.jl @@ -24,8 +24,7 @@ nu = 0.04 trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "sphere_surface_tension_2d.jl"); - surface_tension_coefficient=0.5, dt=0.25, - tspan=(0.0, 100.0), nu, smoothing_length=1.5 * particle_spacing, - fluid_smoothing_kernel=WendlandC2Kernel{3}(), - particle_spacing, sound_speed, + surface_tension_coefficient=0.5, dt=0.25, tspan=(0.0, 100.0), nu, + smoothing_length=1.5 * particle_spacing, + fluid_smoothing_kernel=WendlandC2Kernel{3}(), particle_spacing, sound_speed, fluid_density, fluid_size) diff --git a/examples/fluid/sphere_surface_tension_wall_2d.jl b/examples/fluid/sphere_surface_tension_wall_2d.jl index 88f0adbc81..6d9bcd45e3 100644 --- a/examples/fluid/sphere_surface_tension_wall_2d.jl +++ b/examples/fluid/sphere_surface_tension_wall_2d.jl @@ -62,11 +62,8 @@ sphere_surface_tension = WeaklyCompressibleSPHSystem(sphere1; correction=AkinciFreeSurfaceCorrection(fluid_density), reference_particle_spacing=fluid_particle_spacing) -trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); - sphere=nothing, sphere1, adhesion_coefficient=0.001, - wall_viscosity=4.0 * nu, surface_tension_coefficient=0.9, alpha, - sound_speed, fluid_density, nu, - fluid_particle_spacing, tspan, - tank_size, fluid_smoothing_length, +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); + sphere=nothing, sphere1, adhesion_coefficient=0.001, wall_viscosity=4.0 * nu, + surface_tension_coefficient=0.9, alpha, sound_speed, fluid_density, nu, + fluid_particle_spacing, tspan, tank_size, fluid_smoothing_length, sphere_surface_tension) diff --git a/examples/fluid/taylor_green_vortex_2d.jl b/examples/fluid/taylor_green_vortex_2d.jl index 06fe942150..1e038d7b8f 100644 --- a/examples/fluid/taylor_green_vortex_2d.jl +++ b/examples/fluid/taylor_green_vortex_2d.jl @@ -90,8 +90,7 @@ if wcsph background_pressure)) else density_calculator = SummationDensity() - fluid_system = EntropicallyDampedSPHSystem(fluid; - smoothing_kernel, smoothing_length, + fluid_system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel, smoothing_length, sound_speed, density_calculator, shifting_technique=TransportVelocityAdami(; background_pressure), diff --git a/examples/fsi/dam_break_gate_2d.jl b/examples/fsi/dam_break_gate_2d.jl index 3aa0f92479..3ebef03623 100644 --- a/examples/fsi/dam_break_gate_2d.jl +++ b/examples/fsi/dam_break_gate_2d.jl @@ -110,8 +110,7 @@ smoothing_kernel = WendlandC2Kernel{2}() fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.1, beta=0.0) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, acceleration=(0.0, -gravity)) diff --git a/examples/fsi/dam_break_plate_2d.jl b/examples/fsi/dam_break_plate_2d.jl index bb2e2ec1dc..7ec4ffcc37 100644 --- a/examples/fsi/dam_break_plate_2d.jl +++ b/examples/fsi/dam_break_plate_2d.jl @@ -80,8 +80,7 @@ smoothing_kernel = WendlandC2Kernel{2}() fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) -fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel, smoothing_length, +fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, acceleration=(0.0, -gravity)) diff --git a/examples/fsi/falling_rigid_spheres_2d.jl b/examples/fsi/falling_rigid_spheres_2d.jl index 83afe80286..ad24f120fe 100644 --- a/examples/fsi/falling_rigid_spheres_2d.jl +++ b/examples/fsi/falling_rigid_spheres_2d.jl @@ -32,8 +32,8 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; n_layers=boundary_layers, spacing_ratio, - faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation) + faces=(true, true, true, false), acceleration=(0.0, -gravity), + state_equation) sphere1_radius = 0.3 sphere2_radius = 0.2 @@ -106,15 +106,11 @@ contact_model = RigidContactModel(; normal_stiffness=2.0e5, contact_distance=2.0 * structure_particle_spacing) -structure_system_1 = RigidBodySystem(sphere1; - boundary_model=boundary_model_structure_1, - contact_model, - acceleration=(0.0, -gravity), +structure_system_1 = RigidBodySystem(sphere1; boundary_model=boundary_model_structure_1, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) -structure_system_2 = RigidBodySystem(sphere2; - boundary_model=boundary_model_structure_2, - contact_model, - acceleration=(0.0, -gravity), +structure_system_2 = RigidBodySystem(sphere2; boundary_model=boundary_model_structure_2, + contact_model, acceleration=(0.0, -gravity), particle_spacing=structure_particle_spacing) # ========================================================================================== diff --git a/examples/fsi/falling_rotating_rigid_squares_2d.jl b/examples/fsi/falling_rotating_rigid_squares_2d.jl index 517e8f672f..2f2d286518 100644 --- a/examples/fsi/falling_rotating_rigid_squares_2d.jl +++ b/examples/fsi/falling_rotating_rigid_squares_2d.jl @@ -33,8 +33,8 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; n_layers=boundary_layers, spacing_ratio, - faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation) + faces=(true, true, true, false), acceleration=(0.0, -gravity), + state_equation) square1_side_length = 0.4 square2_side_length = 0.3 diff --git a/examples/fsi/falling_spheres_2d.jl b/examples/fsi/falling_spheres_2d.jl index 2e6397ada8..4cf4fed379 100644 --- a/examples/fsi/falling_spheres_2d.jl +++ b/examples/fsi/falling_spheres_2d.jl @@ -33,8 +33,8 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; n_layers=boundary_layers, spacing_ratio, - faces=(true, true, true, false), - acceleration=(0.0, -gravity), state_equation) + faces=(true, true, true, false), acceleration=(0.0, -gravity), + state_equation) sphere1_radius = 0.3 sphere2_radius = 0.2 diff --git a/examples/fsi/falling_water_column_2d.jl b/examples/fsi/falling_water_column_2d.jl index 1c2a89351c..77c508c7d6 100644 --- a/examples/fsi/falling_water_column_2d.jl +++ b/examples/fsi/falling_water_column_2d.jl @@ -15,8 +15,7 @@ n_particles_y = 5 # Load setup from oscillating beam example trixi_include(@__MODULE__, joinpath(examples_dir(), "structure", "oscillating_beam_2d.jl"); - thickness=0.05, n_particles_y, - sol=nothing) # Don't run simulation, only include the setup part + thickness=0.05, n_particles_y, sol=nothing) # Don't run simulation, only include the setup part # Fluid resolution fluid_particle_spacing = 3 * particle_spacing @@ -47,8 +46,7 @@ fluid_smoothing_kernel = SchoenbergCubicSplineKernel{2}() fluid_density_calculator = ContinuityDensity() viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) -fluid_system = WeaklyCompressibleSPHSystem(fluid; - smoothing_kernel=fluid_smoothing_kernel, +fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length=fluid_smoothing_length, density_calculator=fluid_density_calculator, state_equation, viscosity, @@ -66,12 +64,9 @@ hydrodynamic_masses = hydrodynamic_densites * particle_spacing^2 boundary_model = BoundaryModelMonaghanKajtar(k, spacing_ratio, particle_spacing, hydrodynamic_masses) -structure_system = TotalLagrangianSPHSystem(structure; - smoothing_kernel, - smoothing_length, +structure_system = TotalLagrangianSPHSystem(structure; smoothing_kernel, smoothing_length, young_modulus=material.E, - poisson_ratio=material.nu, - boundary_model, + poisson_ratio=material.nu, boundary_model, clamped_particles=1:nparticles(clamped_particles), acceleration=(0.0, -gravity)) diff --git a/examples/fsi/hydrostatic_water_column_2d.jl b/examples/fsi/hydrostatic_water_column_2d.jl index e07e31c249..b8d3ca63df 100644 --- a/examples/fsi/hydrostatic_water_column_2d.jl +++ b/examples/fsi/hydrostatic_water_column_2d.jl @@ -86,12 +86,9 @@ state_equation = use_edac ? nothing : exponent=7, clip_negative_pressure=false) tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, (plate_size[1], 3.0), - fluid_density; - min_coordinates=(0.0, fluid_particle_spacing / 2), - n_layers=boundary_layers, - spacing_ratio, - faces=(true, true, false, false), - acceleration=(0.0, -gravity), + fluid_density; min_coordinates=(0.0, fluid_particle_spacing / 2), + n_layers=boundary_layers, spacing_ratio, + faces=(true, true, false, false), acceleration=(0.0, -gravity), state_equation) if use_edac @@ -107,8 +104,7 @@ else fluid_density_calculator = ContinuityDensity() density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1) # density_diffusion = DensityDiffusionAntuono(delta=0.1) - fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; - smoothing_kernel, + fluid_system = WeaklyCompressibleSPHSystem(tank.fluid; smoothing_kernel, smoothing_length=smoothing_length_fluid, density_calculator=fluid_density_calculator, state_equation, density_diffusion, @@ -148,8 +144,7 @@ cell_list = FullGridCellList(; min_corner, max_corner) neighborhood_search = GridNeighborhoodSearch{2}(; update_strategy=ParallelUpdate(), cell_list) semi = Semidiscretization(structure_system, fluid_system, boundary_system; - neighborhood_search, - parallelization_backend=PolyesterBackend()) + neighborhood_search, parallelization_backend=PolyesterBackend()) ode = semidiscretize(semi, tspan) split_integration = SplitIntegrationCallback(CarpenterKennedy2N54(williamson_condition=false), diff --git a/examples/preprocessing/packing_2d.jl b/examples/preprocessing/packing_2d.jl index 15ab94dc81..223f4af347 100644 --- a/examples/preprocessing/packing_2d.jl +++ b/examples/preprocessing/packing_2d.jl @@ -71,8 +71,7 @@ packing_system = ParticlePackingSystem(shape_sampled; smoothing_length, boundary_system = ParticlePackingSystem(boundary_sampled; smoothing_length, is_boundary=true, signed_distance_field, - place_on_shell, - boundary_compress_factor=0.8, + place_on_shell, boundary_compress_factor=0.8, background_pressure) # ========================================================================================== diff --git a/examples/preprocessing/packing_3d.jl b/examples/preprocessing/packing_3d.jl index c16d1211f6..bf03355969 100644 --- a/examples/preprocessing/packing_3d.jl +++ b/examples/preprocessing/packing_3d.jl @@ -22,7 +22,6 @@ particle_spacing = 0.1 # how many rows of boundary particles will be sampled. boundary_thickness = 8 * particle_spacing -trixi_include(joinpath(examples_dir(), "preprocessing", "packing_2d.jl"); - density=1000.0, particle_spacing, file, - boundary_thickness, place_on_shell=true, +trixi_include(joinpath(examples_dir(), "preprocessing", "packing_2d.jl"); density=1000.0, + particle_spacing, file, boundary_thickness, place_on_shell=true, save_intervals=false) diff --git a/examples/structure/colliding_rigid_spheres_2d.jl b/examples/structure/colliding_rigid_spheres_2d.jl index 90927d0cb3..9a5f961a4f 100644 --- a/examples/structure/colliding_rigid_spheres_2d.jl +++ b/examples/structure/colliding_rigid_spheres_2d.jl @@ -36,13 +36,9 @@ contact_model = RigidContactModel(; normal_stiffness=2.0e4, normal_damping=120.0, contact_distance=2.0 * particle_spacing) -structure_system_1 = RigidBodySystem(sphere_1; - contact_model, - acceleration=(0.0, 0.0), +structure_system_1 = RigidBodySystem(sphere_1; contact_model, acceleration=(0.0, 0.0), particle_spacing) -structure_system_2 = RigidBodySystem(sphere_2; - contact_model, - acceleration=(0.0, 0.0), +structure_system_2 = RigidBodySystem(sphere_2; contact_model, acceleration=(0.0, 0.0), particle_spacing) # ========================================================================================== diff --git a/examples/structure/oscillating_beam_2d.jl b/examples/structure/oscillating_beam_2d.jl index 11395a4688..78d4f98041 100644 --- a/examples/structure/oscillating_beam_2d.jl +++ b/examples/structure/oscillating_beam_2d.jl @@ -99,8 +99,7 @@ function deflection_y(system, data, t) return data.coordinates[2, middle_particle_id] - STARTPOSITION_Y end -saving_callback = SolutionSavingCallback(dt=0.02, prefix=""; - deflection_x, deflection_y) +saving_callback = SolutionSavingCallback(dt=0.02, prefix=""; deflection_x, deflection_y) callbacks = CallbackSet(info_callback, saving_callback) diff --git a/src/callbacks/info.jl b/src/callbacks/info.jl index 968476fee0..811f01146d 100644 --- a/src/callbacks/info.jl +++ b/src/callbacks/info.jl @@ -40,8 +40,7 @@ function InfoCallback(; interval=0, reset_threads=true) reset_threads) end - DiscreteCallback(info_callback, info_callback; - save_positions=(false, false), + DiscreteCallback(info_callback, info_callback; save_positions=(false, false), initialize) end @@ -239,8 +238,7 @@ function summary_line(io, key, value; key_width=30, total_width=100, indentation total_width = get(io, :total_width, total_width) indentation_level = get(io, :indentation_level, indentation_level) - s = format_key_value_line(key, value, key_width, total_width; - indentation_level) + s = format_key_value_line(key, value, key_width, total_width; indentation_level) println(io, s) end diff --git a/src/callbacks/solution_saving.jl b/src/callbacks/solution_saving.jl index 523af063e2..a3ac18b604 100644 --- a/src/callbacks/solution_saving.jl +++ b/src/callbacks/solution_saving.jl @@ -158,8 +158,7 @@ end function (solution_callback::SolutionSavingCallback)(u, t, integrator) (; interval, save_final_solution) = solution_callback - return condition_integrator_interval(integrator, interval; - save_final_solution) + return condition_integrator_interval(integrator, interval; save_final_solution) end # `affect!` diff --git a/src/general/interpolation.jl b/src/general/interpolation.jl index e8ba54ed97..8ab74d5e73 100644 --- a/src/general/interpolation.jl +++ b/src/general/interpolation.jl @@ -405,8 +405,8 @@ function interpolate_line(start, end_, n_points, semi, ref_system, v_ode, u_ode; points_coords_ = collect(reinterpret(reshape, eltype(start_svector), points_coords)) return interpolate_points(points_coords_, semi, ref_system, v_ode, u_ode; - smoothing_length, include_wall_velocity, - cut_off_bnd, clip_negative_pressure) + smoothing_length, include_wall_velocity, cut_off_bnd, + clip_negative_pressure) end @doc raw""" @@ -637,8 +637,7 @@ end end end - return (; computed_density, point_coords, - neighbor_count, cache...) + return (; computed_density, point_coords, neighbor_count, cache...) end @inline function create_cache_interpolation(ref_system::AbstractFluidSystem, n_points, semi) diff --git a/src/io/write_vtk.jl b/src/io/write_vtk.jl index 6f3a9bfdf6..6747af2763 100644 --- a/src/io/write_vtk.jl +++ b/src/io/write_vtk.jl @@ -309,11 +309,11 @@ function trixi2vtk(initial_condition::InitialCondition; output_directory="out", prefix="", filename="initial_condition", custom_quantities...) (; coordinates, velocity, density, mass, pressure) = initial_condition - return trixi2vtk(coordinates; output_directory, prefix, filename, - density, initial_velocity=velocity, mass, + return trixi2vtk(coordinates; output_directory, prefix, filename, density, + initial_velocity=velocity, mass, particle_spacing=(initial_condition.particle_spacing .* - ones(nparticles(initial_condition))), - pressure, custom_quantities...) + ones(nparticles(initial_condition))), pressure, + custom_quantities...) end function write2vtk!(vtk, v, u, t, system) diff --git a/src/preprocessing/geometries/io.jl b/src/preprocessing/geometries/io.jl index eb5b48148e..bbccc276ec 100644 --- a/src/preprocessing/geometries/io.jl +++ b/src/preprocessing/geometries/io.jl @@ -278,8 +278,8 @@ function trixi2vtk(geometry::Polygon; output_directory="out", prefix="", push!(vertices, geometry.vertices[geometry.edge_vertices_ids[edge][2]]) end - return trixi2vtk(stack(vertices); output_directory, filename, prefix, - vertex_normals, custom_quantities...) + return trixi2vtk(stack(vertices); output_directory, filename, prefix, vertex_normals, + custom_quantities...) end function trixi2vtk(geometry::TriangleMesh; output_directory="out", prefix="", diff --git a/src/preprocessing/particle_packing/signed_distance.jl b/src/preprocessing/particle_packing/signed_distance.jl index 33818e83c7..01e862365f 100644 --- a/src/preprocessing/particle_packing/signed_distance.jl +++ b/src/preprocessing/particle_packing/signed_distance.jl @@ -103,8 +103,7 @@ function trixi2vtk(signed_distance_field::SignedDistanceField; (; positions, distances, normals) = signed_distance_field positions = stack(signed_distance_field.positions) - trixi2vtk(positions; signed_distances=distances, normals, - filename, output_directory) + trixi2vtk(positions; signed_distances=distances, normals, filename, output_directory) end delete_positions_in_empty_cells!(positions, nhs::TrivialNeighborhoodSearch) = positions diff --git a/src/schemes/boundary/open_boundary/system.jl b/src/schemes/boundary/open_boundary/system.jl index f2bb5416e0..3e4754d4ad 100644 --- a/src/schemes/boundary/open_boundary/system.jl +++ b/src/schemes/boundary/open_boundary/system.jl @@ -143,8 +143,7 @@ function create_cache_open_boundary(boundary_model, fluid_system, initial_condit density_reference_values = map(ref -> ref.reference_density, reference_values) velocity_reference_values = map(ref -> ref.reference_velocity, reference_values) - cache = (; pressure_reference_values, - density_reference_values, + cache = (; pressure_reference_values, density_reference_values, velocity_reference_values) if calculate_flow_rate || @@ -164,8 +163,7 @@ function create_cache_open_boundary(boundary_model, fluid_system, initial_condit characteristics = zeros(ELTYPE, 3, nparticles(initial_condition)) previous_characteristics = zeros(ELTYPE, 3, nparticles(initial_condition)) - return (; characteristics, - previous_characteristics, + return (; characteristics, previous_characteristics, pressure=copy(initial_condition.pressure), density=copy(initial_condition.density), cache...) @@ -180,8 +178,7 @@ function create_cache_open_boundary(boundary_model, fluid_system, initial_condit cache = (; density_diffusion, create_cache_density_diffusion(initial_condition, density_diffusion)..., - pressure_boundary, - density_rest, cache...) + pressure_boundary, density_rest, cache...) if fluid_system isa EntropicallyDampedSPHSystem # Density and pressure is stored in `v` diff --git a/src/schemes/boundary/wall_boundary/dummy_particles.jl b/src/schemes/boundary/wall_boundary/dummy_particles.jl index d339b7ba54..2ae821917a 100644 --- a/src/schemes/boundary/wall_boundary/dummy_particles.jl +++ b/src/schemes/boundary/wall_boundary/dummy_particles.jl @@ -72,9 +72,8 @@ function BoundaryModelDummyParticles(initial_density, hydrodynamic_mass, # If the `reference_density_spacing` is set calculate the `ideal_neighbor_count` if reference_particle_spacing > 0 # `reference_particle_spacing` has to be set for surface normals to be determined - cache = (; - cache..., # Existing cache fields - reference_particle_spacing, + # Existing cache fields + cache = (; cache..., reference_particle_spacing, initial_colorfield=zeros(ELTYPE, n_particles), colorfield=zeros(ELTYPE, n_particles), neighbor_count=zeros(ELTYPE, n_particles)) diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index 0fc774d84c..4762c99397 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -174,9 +174,8 @@ function EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, # If the `reference_density_spacing` is set calculate the `ideal_neighbor_count` if reference_particle_spacing > 0 # `reference_particle_spacing` has to be set for surface normals to be determined - cache = (; - cache..., # Existing cache fields - reference_particle_spacing) + # Existing cache fields + cache = (; cache..., reference_particle_spacing) end EntropicallyDampedSPHSystem{NDIMS, ELTYPE, typeof(initial_condition), typeof(mass), diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index b2cd9dd5f0..f2db9ed326 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -174,9 +174,8 @@ function WeaklyCompressibleSPHSystem(initial_condition, density_calculator, stat # If the `reference_density_spacing` is set calculate the `ideal_neighbor_count` if reference_particle_spacing > 0 # `reference_particle_spacing` has to be set for surface normals to be determined - cache = (; - cache..., # Existing cache fields - reference_particle_spacing) + # Existing cache fields + cache = (; cache..., reference_particle_spacing) end return WeaklyCompressibleSPHSystem(initial_condition, mass, pressure, diff --git a/src/setups/complex_shape.jl b/src/setups/complex_shape.jl index 911badb17c..6a78b412e2 100644 --- a/src/setups/complex_shape.jl +++ b/src/setups/complex_shape.jl @@ -70,8 +70,7 @@ function ComplexShape(geometry; particle_spacing, density, # This is most likely only useful for debugging. Note that this is not public API. if store_winding_number - return (; initial_condition, winding_numbers, - grid) + return (; initial_condition, winding_numbers, grid) end return initial_condition diff --git a/src/setups/rectangular_shape.jl b/src/setups/rectangular_shape.jl index 4fb97b2020..c9043a35e6 100644 --- a/src/setups/rectangular_shape.jl +++ b/src/setups/rectangular_shape.jl @@ -59,8 +59,7 @@ rectangular = RectangularShape(particle_spacing, (5, 4), (1.0, 2.0), density=100 # 2D with hydrostatic pressure gradient. # `state_equation` has to be the same as for the WCSPH system. state_equation = StateEquationCole(sound_speed=20.0, exponent=7, reference_density=1000.0) -rectangular = RectangularShape(particle_spacing, (5, 4), (1.0, 2.0); - acceleration=(0.0, -9.81), state_equation) +rectangular = RectangularShape(particle_spacing, (5, 4), (1.0, 2.0); acceleration=(0.0, -9.81), state_equation) # 3D rectangular = RectangularShape(particle_spacing, (5, 4, 7), (1.0, 2.0, 3.0), density=1000.0) @@ -102,9 +101,8 @@ function RectangularShape(particle_spacing, n_particles_per_dimension, min_coord # The type of the particle spacing determines the eltype of the coordinates coordinates = rectangular_shape_coords(convert(coordinates_eltype, particle_spacing), - n_particles_per_dimension, - min_coordinates; place_on_shell, - loop_order) + n_particles_per_dimension, min_coordinates; + place_on_shell, loop_order) if !isnothing(coordinates_perturbation) seed!(1) diff --git a/src/setups/rectangular_tank.jl b/src/setups/rectangular_tank.jl index 2b59bbc8b0..b04090d88c 100644 --- a/src/setups/rectangular_tank.jl +++ b/src/setups/rectangular_tank.jl @@ -69,9 +69,7 @@ setup = RectangularTank(particle_spacing, (water_width, water_height), # 2D with hydrostatic pressure gradient. # `state_equation` has to be the same as for the WCSPH system. state_equation = StateEquationCole(sound_speed=10.0, exponent=1, reference_density=1000.0) -setup = RectangularTank(particle_spacing, (water_width, water_height), - (container_width, container_height), fluid_density; - acceleration=(0.0, -9.81), state_equation) +setup = RectangularTank(particle_spacing, (water_width, water_height), (container_width, container_height), fluid_density; acceleration=(0.0, -9.81), state_equation) # 3D setup = RectangularTank(particle_spacing, (water_width, water_height, water_depth), diff --git a/test/count_allocations.jl b/test/count_allocations.jl index c96ddd8eda..2fdc3e3721 100644 --- a/test/count_allocations.jl +++ b/test/count_allocations.jl @@ -22,8 +22,7 @@ end particle; search_radius=PointNeighbors.search_radius(neighborhood_search.nhs)) PointNeighbors.foreach_neighbor(f, system_coords, neighbor_coords, - neighborhood_search.nhs, particle; - search_radius) + neighborhood_search.nhs, particle; search_radius) end # No update diff --git a/test/examples/dam_break_2d_corrections.jl b/test/examples/dam_break_2d_corrections.jl index 03691e8d70..f31db69bfa 100644 --- a/test/examples/dam_break_2d_corrections.jl +++ b/test/examples/dam_break_2d_corrections.jl @@ -69,8 +69,7 @@ boundary_density_calculator=ContinuityDensity(), fluid_density_calculator=ContinuityDensity(), correction=nothing, use_reinit=true, - prefix="continuity_reinit", tspan, - fluid_density, + prefix="continuity_reinit", tspan, fluid_density, density_diffusion=nothing) @test sol.retcode == ReturnCode.Success @@ -92,14 +91,12 @@ fluid_particle_spacing=particle_spacing, smoothing_length, boundary_density_calculator=SummationDensity(), - fluid_density_calculator, - correction, use_reinit=false, + fluid_density_calculator, correction, + use_reinit=false, clip_negative_pressure=(fluid_density_calculator isa SummationDensity), - smoothing_kernel, - prefix="$(correction_name)", tspan, - fluid_density, - density_diffusion=nothing, + smoothing_kernel, prefix="$(correction_name)", + tspan, fluid_density, density_diffusion=nothing, boundary_layers=5, sol=nothing) # Some correction methods require very small time steps at the beginning of the simulation. diff --git a/test/examples/gpu.jl b/test/examples/gpu.jl index 5109f22a3c..b895d9d665 100644 --- a/test/examples/gpu.jl +++ b/test/examples/gpu.jl @@ -271,8 +271,7 @@ end tspan=(0.0f0, 0.1f0), coordinates_eltype=Float32, fluid_particle_spacing=0.1, - semi=semi_fullgrid, - maxiters) [ + semi=semi_fullgrid, maxiters) [ r"\[ Info: To move data to the GPU, `semidiscretize` creates a deep copy.*\n" ] @test sol.retcode == ReturnCode.Success @@ -308,10 +307,9 @@ end sol=nothing, ode=nothing) # Create tank with Float32 coordinates - tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, - tank_size, fluid_density; n_layers=boundary_layers, - acceleration=(0.0f0, -gravity), - state_equation, + tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, + fluid_density; n_layers=boundary_layers, + acceleration=(0.0f0, -gravity), state_equation, coordinates_eltype=Float32) hydrostatic_water_column_tests = Dict( @@ -369,8 +367,7 @@ end trixi_include_changeprecision(Float32, @__MODULE__, joinpath(examples_dir(), "fluid", "hydrostatic_water_column_2d.jl"); - sol=nothing, ode=nothing, tank, - kwargs...) + sol=nothing, ode=nothing, tank, kwargs...) # Neighborhood search with `FullGridCellList` for GPU compatibility min_corner = minimum(tank.boundary.coordinates, dims=2) diff --git a/test/general/density_calculator.jl b/test/general/density_calculator.jl index 93b6ff188e..1d61c79819 100644 --- a/test/general/density_calculator.jl +++ b/test/general/density_calculator.jl @@ -14,9 +14,8 @@ viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) fluid_system = WeaklyCompressibleSPHSystem(initial_condition, SummationDensity(), - state_equation, - smoothing_kernel, smoothing_length; - viscosity) + state_equation, smoothing_kernel, + smoothing_length; viscosity) (; cache) = fluid_system (; density) = cache # Density is in the cache for SummationDensity diff --git a/test/general/initial_condition.jl b/test/general/initial_condition.jl index f65d2d241d..0c2949adef 100644 --- a/test/general/initial_condition.jl +++ b/test/general/initial_condition.jl @@ -394,8 +394,7 @@ density = [10.0, 20.0, 30.0, 40.0, 50.0] pressure = [100.0, 200.0, 300.0, 400.0, 500.0] - ic = InitialCondition(; coordinates, velocity, - mass, density, pressure) + ic = InitialCondition(; coordinates, velocity, mass, density, pressure) # Move particles 2 and 4 to the end particle_ids_to_move = [2, 4] @@ -423,8 +422,7 @@ mass = [1.1, 2.2, 3.3, 4.4] density = [10.0, 20.0, 30.0, 40.0] - ic = InitialCondition(; coordinates, velocity, - mass, density) + ic = InitialCondition(; coordinates, velocity, mass, density) # Move particle 2 multiple times (should only move once) TrixiParticles.move_particles_to_end!(ic, [2, 2, 3]) diff --git a/test/general/interpolation.jl b/test/general/interpolation.jl index 9689d00fd4..0687f51b82 100644 --- a/test/general/interpolation.jl +++ b/test/general/interpolation.jl @@ -221,15 +221,13 @@ @testset verbose=true "Interpolation Line no boundary - cut_off_bnd = $(cut_off_bnd)" begin result_endpoint = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], 5, semi_no_boundary, - fluid_system, - v_no_bnd, u_no_bnd; - endpoint=true, + fluid_system, v_no_bnd, + u_no_bnd; endpoint=true, cut_off_bnd) - result = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], - 5, semi_no_boundary, - fluid_system, v_no_bnd, u_no_bnd; - endpoint=false, + result = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], 5, + semi_no_boundary, fluid_system, + v_no_bnd, u_no_bnd; endpoint=false, cut_off_bnd) expected_res = (density=[666.0, 666.0, 666.0], neighbor_count=[2, 2, 1], @@ -440,9 +438,8 @@ result_multipoint = TrixiParticles.interpolate_points(multi_point_coords, semi_boundary, - fluid_system, - v_bnd, u_bnd; - cut_off_bnd) + fluid_system, v_bnd, + u_bnd; cut_off_bnd) if cut_off_bnd expected_multi = (density=[666.0, 666.0000000000001, 666.0], neighbor_count=[4, 6, 5], @@ -474,15 +471,13 @@ @testset verbose=true "Interpolation Line boundary - cut_off_bnd = $(cut_off_bnd)" begin result_endpoint = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], 5, semi_boundary, - fluid_system, - v_bnd, u_bnd; - endpoint=true, + fluid_system, v_bnd, + u_bnd; endpoint=true, cut_off_bnd) - result = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], - 5, semi_no_boundary, - fluid_system, v_no_bnd, u_no_bnd; - endpoint=false, + result = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], 5, + semi_no_boundary, fluid_system, + v_no_bnd, u_no_bnd; endpoint=false, cut_off_bnd) if cut_off_bnd expected_res = (density=[666.0, 666.0, 666.0], neighbor_count=[2, 2, 1], @@ -618,10 +613,8 @@ const_pressure = [2 * new_wall_distance] const_velocity = [5; 0.1 * new_wall_distance^2+0.1; 0.0;;] - return (; density=const_density, - neighbor_count, - point_coords=[0.0; wall_distance; 0.0;;], - velocity=const_velocity, + return (; density=const_density, neighbor_count, + point_coords=[0.0; wall_distance; 0.0;;], velocity=const_velocity, pressure=const_pressure) end @@ -688,9 +681,7 @@ for cut_off_bnd in [true, false] @testset verbose=true "Interpolation Point no boundary - cut_off_bnd = $(cut_off_bnd)" begin - interpolation_walldistance(y) = TrixiParticles.interpolate_points([0.0; - y; - 0.0;;], + interpolation_walldistance(y) = TrixiParticles.interpolate_points([0.0; y; 0.0;;], semi_no_boundary, fluid_system, v_no_bnd, @@ -779,9 +770,7 @@ for cut_off_bnd in [true, false] @testset verbose=true "Interpolation Point boundary - cut_off_bnd = $(cut_off_bnd)" begin - interpolation_walldistance(y) = TrixiParticles.interpolate_points([0.0; - y; - 0.0;;], + interpolation_walldistance(y) = TrixiParticles.interpolate_points([0.0; y; 0.0;;], semi_boundary, fluid_system, v_no_bnd, diff --git a/test/io/read_vtk.jl b/test/io/read_vtk.jl index 1e573db104..456a0bbc2c 100644 --- a/test/io/read_vtk.jl +++ b/test/io/read_vtk.jl @@ -3,9 +3,8 @@ coordinates = fill(1.0, 2, 12) velocity = fill(2.0, 2, 12) - expected_data = InitialCondition(; coordinates, velocity, - density=1000.0, pressure=900.0, - particle_spacing=0.1) + expected_data = InitialCondition(; coordinates, velocity, density=1000.0, + pressure=900.0, particle_spacing=0.1) expected_scalar = 3.0 expected_vector = fill(expected_scalar, nparticles(expected_data)) diff --git a/test/rectangular_patch.jl b/test/rectangular_patch.jl index 32b59d2e59..179c453496 100644 --- a/test/rectangular_patch.jl +++ b/test/rectangular_patch.jl @@ -7,8 +7,7 @@ function rectangular_patch(particle_spacing, size; density=1000.0, pressure=0.0, # Center particle at the origin (assuming odd size) min_corner = -particle_spacing / 2 .* size - ic = RectangularShape(particle_spacing, size, min_corner; - density, pressure) + ic = RectangularShape(particle_spacing, size, min_corner; density, pressure) perturb!(ic.coordinates, perturbation_factor_position * 0.5 * particle_spacing) diff --git a/test/schemes/boundary/dummy_particles/dummy_particles.jl b/test/schemes/boundary/dummy_particles/dummy_particles.jl index 69cb64d901..cf468f107a 100644 --- a/test/schemes/boundary/dummy_particles/dummy_particles.jl +++ b/test/schemes/boundary/dummy_particles/dummy_particles.jl @@ -50,29 +50,24 @@ exponent=7) # Define pressure extrapolation methods to test - boundary_model_adami = BoundaryModelDummyParticles(boundary.density, - boundary.mass, + boundary_model_adami = BoundaryModelDummyParticles(boundary.density, boundary.mass, AdamiPressureExtrapolation(), smoothing_kernel, - smoothing_length; - state_equation, + smoothing_length; state_equation, viscosity) boundary_model_bernoulli = BoundaryModelDummyParticles(boundary.density, boundary.mass, BernoulliPressureExtrapolation(), smoothing_kernel, smoothing_length; - state_equation, - viscosity) + state_equation, viscosity) boundary_systems = [ WallBoundarySystem(boundary, boundary_model_adami), WallBoundarySystem(boundary, boundary_model_bernoulli), - RigidBodySystem(boundary; - boundary_model=boundary_model_adami, + RigidBodySystem(boundary; boundary_model=boundary_model_adami, particle_spacing), - RigidBodySystem(boundary; - boundary_model=boundary_model_bernoulli, + RigidBodySystem(boundary; boundary_model=boundary_model_bernoulli, particle_spacing), TotalLagrangianSPHSystem(boundary; smoothing_kernel, @@ -236,9 +231,8 @@ state_equation = StateEquationCole(sound_speed=10, reference_density=257, exponent=7) - tank1 = RectangularTank(particle_spacing, (width, height), (width, height), - density; n_layers, - faces=(true, true, true, false)) + tank1 = RectangularTank(particle_spacing, (width, height), (width, height), density; + n_layers, faces=(true, true, true, false)) boundary_model = BoundaryModelDummyParticles(tank1.boundary.density, tank1.boundary.mass, @@ -291,8 +285,7 @@ @testset "Constant Non-Zero Pressure" begin density = 260 tank2 = RectangularTank(particle_spacing, (width, height), (width, height), - density; n_layers, - faces=(true, true, true, false)) + density; n_layers, faces=(true, true, true, false)) fluid_system2 = WeaklyCompressibleSPHSystem(tank2.fluid, SummationDensity(), state_equation, @@ -332,9 +325,8 @@ @testset "Hydrostatic Pressure Gradient" begin for flipped_condition in (Val(true), Val(false)) tank3 = RectangularTank(particle_spacing, (width, height), (width, height), - density; acceleration=[0.0, -9.81], - state_equation, n_layers, - faces=(true, true, true, false)) + density; acceleration=[0.0, -9.81], state_equation, + n_layers, faces=(true, true, true, false)) fluid_system3 = WeaklyCompressibleSPHSystem(tank3.fluid, SummationDensity(), state_equation, diff --git a/test/schemes/boundary/open_boundary/mirroring.jl b/test/schemes/boundary/open_boundary/mirroring.jl index bd54e25871..0bea0a42ee 100644 --- a/test/schemes/boundary/open_boundary/mirroring.jl +++ b/test/schemes/boundary/open_boundary/mirroring.jl @@ -226,8 +226,8 @@ inflow = BoundaryZone(; boundary_face=face_in, boundary_type=InFlow(), face_normal=(i == 2 ? [1.0, 0.0] : [1.0, 0.0, 0.0]), - open_boundary_layers, density=1000.0, - particle_spacing, average_inflow_velocity=true) + open_boundary_layers, density=1000.0, particle_spacing, + average_inflow_velocity=true) open_boundary_in = OpenBoundarySystem(inflow; fluid_system, boundary_model=BoundaryModelMirroringTafuni(), buffer_size=0) diff --git a/test/schemes/boundary/open_boundary/open_boundary.jl b/test/schemes/boundary/open_boundary/open_boundary.jl index 4b1f8d47cf..43b4bd7cd6 100644 --- a/test/schemes/boundary/open_boundary/open_boundary.jl +++ b/test/schemes/boundary/open_boundary/open_boundary.jl @@ -26,9 +26,9 @@ include("pressure_model.jl") sample_points = RectangularShape(particle_spacing, (1, round(Int, n_particles_y / 2)), (0.0, 0.5), density=1.0).coordinates - zone = BoundaryZone(; boundary_face=([0.0, 0.0], [0.0, 2.0]), - face_normal=(-1.0, 0.0), open_boundary_layers=10, density=1000.0, - particle_spacing, sample_points, + zone = BoundaryZone(; boundary_face=([0.0, 0.0], [0.0, 2.0]), face_normal=(-1.0, 0.0), + open_boundary_layers=10, density=1000.0, particle_spacing, + sample_points, reference_velocity=(pos, t) -> velocity_function(pos)) open_boundary = OpenBoundarySystem(zone; fluid_system, diff --git a/test/schemes/fluid/surface_normal_sph.jl b/test/schemes/fluid/surface_normal_sph.jl index 1c39bd2097..ee46b6c60a 100644 --- a/test/schemes/fluid/surface_normal_sph.jl +++ b/test/schemes/fluid/surface_normal_sph.jl @@ -49,10 +49,8 @@ function create_rigid_boundary_system(coordinates, particle_spacing, state_equat rigid_model = BoundaryModelDummyParticles(wall_system.initial_condition.density, wall_system.initial_condition.mass, - AdamiPressureExtrapolation(), - kernel, - smoothing_length; - state_equation, + AdamiPressureExtrapolation(), kernel, + smoothing_length; state_equation, correction=nothing, reference_particle_spacing=particle_spacing) @@ -69,11 +67,7 @@ function create_fluid_system(coordinates, velocity, mass, density, particle_spac smoothing_kernel=SchoenbergCubicSplineKernel{NDIMS}()) tspan = (0.0, 0.01) - fluid = InitialCondition(; coordinates, - velocity, - mass, - density, - particle_spacing) + fluid = InitialCondition(; coordinates, velocity, mass, density, particle_spacing) state_equation = StateEquationCole(sound_speed=10.0, reference_density=1000.0, @@ -163,24 +157,17 @@ end density = sphere_ic.density wall_system, wall_boundary, wall_semi, - wall_ode = create_fluid_system(coordinates, velocity, mass, density, - particle_spacing, + wall_ode = create_fluid_system(coordinates, velocity, mass, density, particle_spacing, SurfaceTensionMorris(surface_tension_coefficient=0.072); - NDIMS, - smoothing_length, - smoothing_kernel, + NDIMS, smoothing_length, smoothing_kernel, surface_normal_method=ColorfieldSurfaceNormal(interface_threshold=0.1, ideal_density_threshold=0.9), - wall=true, walldistance=2.0, - boundary_system_type=:wall) + wall=true, walldistance=2.0, boundary_system_type=:wall) rigid_system, rigid_boundary, rigid_semi, - rigid_ode = create_fluid_system(coordinates, velocity, mass, density, - particle_spacing, + rigid_ode = create_fluid_system(coordinates, velocity, mass, density, particle_spacing, SurfaceTensionMorris(surface_tension_coefficient=0.072); - NDIMS, - smoothing_length, - smoothing_kernel, + NDIMS, smoothing_length, smoothing_kernel, surface_normal_method=ColorfieldSurfaceNormal(interface_threshold=0.1, ideal_density_threshold=0.9), wall=true, walldistance=2.0, @@ -227,13 +214,10 @@ end # wall is placed 2.0 away so that it doesn't have much influence on the result system, bnd_system, semi, - ode = create_fluid_system(coordinates, velocity, mass, - density, + ode = create_fluid_system(coordinates, velocity, mass, density, particle_spacing, SurfaceTensionMorris(surface_tension_coefficient=0.072); - NDIMS, - smoothing_length, - smoothing_kernel, + NDIMS, smoothing_length, smoothing_kernel, surface_normal_method=ColorfieldSurfaceNormal(interface_threshold=0.1, ideal_density_threshold=0.9), wall=true, walldistance=2.0) @@ -330,13 +314,10 @@ end density = sphere_ic.density system, bnd_system, semi, - ode = create_fluid_system(coordinates, velocity, mass, - density, + ode = create_fluid_system(coordinates, velocity, mass, density, particle_spacing, SurfaceTensionAkinci(surface_tension_coefficient=0.072); - NDIMS, - smoothing_length, - smoothing_kernel, + NDIMS, smoothing_length, smoothing_kernel, surface_normal_method=ColorfieldSurfaceNormal(interface_threshold=0.1, ideal_density_threshold=0.9), wall=true, walldistance=2.0) @@ -417,13 +398,10 @@ end # Create fluid system (no wall) system, bnd_system, semi, - ode = create_fluid_system(coordinates, velocity, mass, - density, particle_spacing, + ode = create_fluid_system(coordinates, velocity, mass, density, particle_spacing, SurfaceTensionMorris(surface_tension_coefficient=0.072); - NDIMS, - smoothing_length=1.5 * - particle_spacing, - wall=false, walldistance=0.0) + NDIMS, smoothing_length=1.5 * particle_spacing, wall=false, + walldistance=0.0) # Compute surface normals compute_and_test_surface_values(system, semi, ode; NDIMS) diff --git a/test/schemes/fluid/surface_tension.jl b/test/schemes/fluid/surface_tension.jl index e6d1d53743..ab5abae780 100644 --- a/test/schemes/fluid/surface_tension.jl +++ b/test/schemes/fluid/surface_tension.jl @@ -98,10 +98,7 @@ mass = ones(2) density = ones(2) - ic = InitialCondition(; coordinates=coords, - velocity, - mass, - density, + ic = InitialCondition(; coordinates=coords, velocity, mass, density, particle_spacing=1.0) # 2. Define Density Calculator, State Equation, and Kernel diff --git a/test/setups/rectangular_shape.jl b/test/setups/rectangular_shape.jl index 2fd5cfc96d..4e2419487f 100644 --- a/test/setups/rectangular_shape.jl +++ b/test/setups/rectangular_shape.jl @@ -142,9 +142,8 @@ n_particles_per_dimension = (2, 5) @testset "Loop Order :y_first" begin - shape = RectangularShape(particle_spacing, - n_particles_per_dimension, (0.0, 0.0); - acceleration=(0.0, -1.0), + shape = RectangularShape(particle_spacing, n_particles_per_dimension, + (0.0, 0.0); acceleration=(0.0, -1.0), state_equation) @test shape.pressure ≈ vec(pressure) @@ -155,20 +154,17 @@ end @testset "Loop Order :x_first" begin - shape = RectangularShape(particle_spacing, - n_particles_per_dimension, (0.0, 0.0); - acceleration=(0.0, -1.0), - state_equation, - loop_order=:x_first) + shape = RectangularShape(particle_spacing, n_particles_per_dimension, + (0.0, 0.0); acceleration=(0.0, -1.0), + state_equation, loop_order=:x_first) # Transpose `pressure` @test shape.pressure ≈ vec(pressure') end @testset "Positive Acceleration" begin - shape = RectangularShape(particle_spacing, - n_particles_per_dimension, (0.0, 0.0); - acceleration=(0.0, 1.0), + shape = RectangularShape(particle_spacing, n_particles_per_dimension, + (0.0, 0.0); acceleration=(0.0, 1.0), state_equation) @test shape.pressure ≈ vec(reverse(pressure)) @@ -181,10 +177,8 @@ @testset "Horizontal Gravity" begin n_particles_per_dimension = (5, 2) - shape = RectangularShape(particle_spacing, - n_particles_per_dimension, (0.0, 0.0); - acceleration=(-1.0, 0.0), - state_equation) + shape = RectangularShape(particle_spacing, n_particles_per_dimension, + (0.0, 0.0); acceleration=(-1.0, 0.0), state_equation) @test shape.pressure ≈ 1.0 * vec(pressure') @test shape.density == @@ -289,9 +283,9 @@ end permute!(acceleration_, permutation) shape = RectangularShape(particle_spacing, - Tuple(n_particles_per_dimension_), - (0.0, 0.0, 0.0); density=1000.0, - loop_order, acceleration=acceleration_) + Tuple(n_particles_per_dimension_), (0.0, 0.0, 0.0); + density=1000.0, loop_order, + acceleration=acceleration_) # Permute pressure with acceleration permutation permuted1 = permutedims(pressure, permutation) @@ -349,9 +343,8 @@ end acceleration_ = collect(acceleration) permute!(acceleration_, permutation) - shape = RectangularShape(particle_spacing, - Tuple(n_particles_per_dimension_), (0.0, 0.0, 0.0); - acceleration=acceleration_, + shape = RectangularShape(particle_spacing, Tuple(n_particles_per_dimension_), + (0.0, 0.0, 0.0); acceleration=acceleration_, state_equation) @test shape.pressure ≈ vec(permutedims(pressure, permutation)) diff --git a/test/systems/iisph_system.jl b/test/systems/iisph_system.jl index 8dd3b3bd8d..cf2b5e20aa 100644 --- a/test/systems/iisph_system.jl +++ b/test/systems/iisph_system.jl @@ -48,15 +48,10 @@ smoothing_length = 0.362 initial_condition = InitialCondition(; coordinates, mass, density) - system = ImplicitIncompressibleSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - reference_density, - omega, - max_error, - min_iterations, - max_iterations, - time_step) + system = ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, reference_density, + omega, max_error, min_iterations, + max_iterations, time_step) # Constructor copies input fields, applies defaults, and respects the requested dimensionality @test system isa ImplicitIncompressibleSPHSystem{NDIMS} diff --git a/test/systems/rigid_system.jl b/test/systems/rigid_system.jl index 81b9277f50..63abf8fec5 100644 --- a/test/systems/rigid_system.jl +++ b/test/systems/rigid_system.jl @@ -15,10 +15,8 @@ smoothing_kernel, smoothing_length) - system = RigidBodySystem(initial_condition; - boundary_model, - acceleration=(0.0, -9.81), - particle_spacing=0.1) + system = RigidBodySystem(initial_condition; boundary_model, + acceleration=(0.0, -9.81), particle_spacing=0.1) @test ndims(system) == 2 @test system.initial_condition == initial_condition @@ -59,8 +57,7 @@ smoothing_kernel, smoothing_length) - system = RigidBodySystem(initial_condition; - boundary_model, + system = RigidBodySystem(initial_condition; boundary_model, acceleration=(0.0, -9.81)) @test !haskey(system.cache, :contact_manifold_count) @@ -427,8 +424,7 @@ smoothing_kernel, smoothing_length) - rigid_system = RigidBodySystem(initial_condition; - boundary_model) + rigid_system = RigidBodySystem(initial_condition; boundary_model) semi = Semidiscretization(rigid_system) ode = semidiscretize(semi, (0.0, 0.01)) v_ode, u_ode = ode.u0.x @@ -496,8 +492,7 @@ fluid_ic = InitialCondition(; coordinates=reshape([0.0, 0.0], 2, 1), velocity=zeros(2, 1), mass=[particle_volume * fluid_density], - density=[fluid_density], - particle_spacing) + density=[fluid_density], particle_spacing) fluid_system = WeaklyCompressibleSPHSystem(fluid_ic, SummationDensity(), state_equation, @@ -510,8 +505,7 @@ boundary_model = BoundaryModelDummyParticles([fluid_density], [particle_volume * fluid_density], AdamiPressureExtrapolation(), - smoothing_kernel, - smoothing_length; + smoothing_kernel, smoothing_length; state_equation, reference_particle_spacing=particle_spacing) @@ -519,19 +513,14 @@ wall_ic = InitialCondition(; coordinates=boundary_coordinates, velocity=zeros(2, 1), mass=[particle_volume * fluid_density], - density=[fluid_density], - particle_spacing) - WallBoundarySystem(wall_ic, boundary_model; - adhesion_coefficient) + density=[fluid_density], particle_spacing) + WallBoundarySystem(wall_ic, boundary_model; adhesion_coefficient) else rigid_ic = InitialCondition(; coordinates=boundary_coordinates, velocity=zeros(2, 1), mass=[particle_volume * rigid_density], - density=[rigid_density], - particle_spacing) - RigidBodySystem(rigid_ic; - boundary_model, - adhesion_coefficient) + density=[rigid_density], particle_spacing) + RigidBodySystem(rigid_ic; boundary_model, adhesion_coefficient) end semi = Semidiscretization(fluid_system, boundary_system) @@ -595,30 +584,24 @@ boundary_model = BoundaryModelDummyParticles(fill(fluid_density, 2), fill(particle_volume * fluid_density, - 2), - AdamiPressureExtrapolation(), - smoothing_kernel, - smoothing_length; + 2), AdamiPressureExtrapolation(), + smoothing_kernel, smoothing_length; state_equation, reference_particle_spacing=particle_spacing) function run_setup(fluid_positions) - rigid_ic = InitialCondition(; coordinates=[-0.5 0.5 - 0.0 0.0], + rigid_ic = InitialCondition(; coordinates=[-0.5 0.5 0.0 0.0], velocity=zeros(2, 2), mass=fill(particle_volume * rigid_density, 2), - density=fill(rigid_density, 2), - particle_spacing) - rigid_system = RigidBodySystem(rigid_ic; - boundary_model, + density=fill(rigid_density, 2), particle_spacing) + rigid_system = RigidBodySystem(rigid_ic; boundary_model, acceleration=(0.0, 0.0)) fluid_systems = map(fluid_positions) do position fluid_ic = InitialCondition(; coordinates=reshape(collect(position), 2, 1), velocity=zeros(2, 1), mass=[particle_volume * fluid_density], - density=[fluid_density], - particle_spacing) + density=[fluid_density], particle_spacing) WeaklyCompressibleSPHSystem(fluid_ic, SummationDensity(), state_equation, smoothing_kernel, smoothing_length) @@ -671,43 +654,34 @@ boundary_model = BoundaryModelDummyParticles([fluid_density], [particle_volume * fluid_density], AdamiPressureExtrapolation(), - smoothing_kernel, - smoothing_length; + smoothing_kernel, smoothing_length; state_equation, reference_particle_spacing=particle_spacing) rigid_ic = InitialCondition(; coordinates=reshape([0.0, 0.0], 2, 1), velocity=zeros(2, 1), mass=[particle_volume * rigid_density], - density=[rigid_density], - particle_spacing) - rigid_system = RigidBodySystem(rigid_ic; - boundary_model, - acceleration=(0.0, 0.0)) + density=[rigid_density], particle_spacing) + rigid_system = RigidBodySystem(rigid_ic; boundary_model, acceleration=(0.0, 0.0)) open_boundary_ic = InitialCondition(; coordinates=reshape([1.5, 0.0], 2, 1), velocity=zeros(2, 1), mass=[particle_volume * fluid_density], - density=[fluid_density], - particle_spacing) + density=[fluid_density], particle_spacing) fluid_support_ic = InitialCondition(; coordinates=reshape([10.0, 10.0], 2, 1), velocity=zeros(2, 1), mass=[particle_volume * fluid_density], - density=[fluid_density], - particle_spacing) + density=[fluid_density], particle_spacing) fluid_system = WeaklyCompressibleSPHSystem(fluid_support_ic, SummationDensity(), state_equation, smoothing_kernel, smoothing_length) boundary_face = ([2.0, -0.5], [2.0, 0.5]) - zone = BoundaryZone(; boundary_face, face_normal=(1.0, 0.0), - density=fluid_density, - particle_spacing, - initial_condition=open_boundary_ic, - open_boundary_layers=1, - boundary_type=InFlow()) + zone = BoundaryZone(; boundary_face, face_normal=(1.0, 0.0), density=fluid_density, + particle_spacing, initial_condition=open_boundary_ic, + open_boundary_layers=1, boundary_type=InFlow()) open_boundary_system = OpenBoundarySystem(zone; fluid_system, boundary_model=BoundaryModelDynamicalPressureZhang(), @@ -963,19 +937,12 @@ @test_throws ArgumentError RigidContactModel(; normal_stiffness=1.0, contact_distance=-1.0) - rigid_system = RigidBodySystem(rigid_ic; - acceleration=(0.0, 0.0), - contact_model) - rigid_system_with_boundary = RigidBodySystem(rigid_ic; - acceleration=(0.0, 0.0), - boundary_model, - contact_model) - rigid_system_custom_manifolds = RigidBodySystem(rigid_ic; - acceleration=(0.0, 0.0), - contact_model, - max_manifolds=3) - rigid_system_without_contact = RigidBodySystem(rigid_ic; - acceleration=(0.0, 0.0), + rigid_system = RigidBodySystem(rigid_ic; acceleration=(0.0, 0.0), contact_model) + rigid_system_with_boundary = RigidBodySystem(rigid_ic; acceleration=(0.0, 0.0), + boundary_model, contact_model) + rigid_system_custom_manifolds = RigidBodySystem(rigid_ic; acceleration=(0.0, 0.0), + contact_model, max_manifolds=3) + rigid_system_without_contact = RigidBodySystem(rigid_ic; acceleration=(0.0, 0.0), boundary_model) @test haskey(rigid_system.cache, :contact_manifold_count) @test rigid_system.contact_model.normal_stiffness ≈ contact_model.normal_stiffness @@ -1000,9 +967,7 @@ @test iszero(TrixiParticles.compact_support(boundary_system, rigid_system)) @test iszero(TrixiParticles.compact_support(rigid_system_without_contact, boundary_system)) - @test_throws ArgumentError RigidBodySystem(rigid_ic; - contact_model, - max_manifolds=0) + @test_throws ArgumentError RigidBodySystem(rigid_ic; contact_model, max_manifolds=0) system_meta_data = Dict{String, Any}() TrixiParticles.add_system_data!(system_meta_data, rigid_system) @@ -1024,8 +989,7 @@ SummationDensity(), smoothing_kernel, smoothing_length) - kick_rigid_system = RigidBodySystem(rigid_ic; - acceleration=(0.0, 0.0), + kick_rigid_system = RigidBodySystem(rigid_ic; acceleration=(0.0, 0.0), contact_model) kick_boundary_system = WallBoundarySystem(boundary_ic, kick_boundary_model) kick_semi = Semidiscretization(kick_rigid_system, kick_boundary_system) @@ -1090,8 +1054,7 @@ 0.04) short_support_boundary = WallBoundarySystem(boundary_ic, short_support_boundary_model) - far_rigid_system = RigidBodySystem(far_rigid_ic; - acceleration=(0.0, 0.0), + far_rigid_system = RigidBodySystem(far_rigid_ic; acceleration=(0.0, 0.0), contact_model) short_support_semi = Semidiscretization(far_rigid_system, short_support_boundary) short_support_ode = semidiscretize(short_support_semi, (0.0, 0.01)) diff --git a/test/systems/tlsph_system.jl b/test/systems/tlsph_system.jl index 3d935f77ba..26c9be91d3 100644 --- a/test/systems/tlsph_system.jl +++ b/test/systems/tlsph_system.jl @@ -23,12 +23,9 @@ initial_condition = InitialCondition(; coordinates, mass, density=material_densities) - system = TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus=E, - poisson_ratio=nu, - boundary_model) + system = TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, young_modulus=E, + poisson_ratio=nu, boundary_model) @test system isa TotalLagrangianSPHSystem @test ndims(system) == NDIMS @@ -65,12 +62,9 @@ initial_condition = InitialCondition(; coordinates, mass, density=material_densities) - system = TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus=E, - poisson_ratio=nu, - boundary_model) + system = TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, young_modulus=E, + poisson_ratio=nu, boundary_model) show_compact = "TotalLagrangianSPHSystem{2}(Val{:smoothing_kernel}(), " * "[0.0, 0.0], Val{:boundary_model}(), nothing, nothing) with 2 particles" @@ -94,12 +88,9 @@ E = [1.2, 3.4] nu = [0.2, 0.4] - system = TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus=E, - poisson_ratio=nu, - boundary_model) + system = TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, young_modulus=E, + poisson_ratio=nu, boundary_model) show_box = """ ┌──────────────────────────────────────────────────────────────────────────────────────────────────┐ @@ -328,12 +319,9 @@ initial_condition = InitialCondition(; coordinates, mass, density=material_densities) - system = TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus=E, - poisson_ratio=nu, - boundary_model) + system = TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, young_modulus=E, + poisson_ratio=nu, boundary_model) u0 = zeros(TrixiParticles.u_nvariables(system), TrixiParticles.n_integrated_particles(system)) @@ -358,12 +346,9 @@ initial_condition = InitialCondition(; coordinates, velocity, mass, density=material_densities) - system = TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus=E, - poisson_ratio=nu, - boundary_model) + system = TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, young_modulus=E, + poisson_ratio=nu, boundary_model) v0 = zeros(TrixiParticles.v_nvariables(system), TrixiParticles.n_integrated_particles(system)) diff --git a/test/systems/wcsph_system.jl b/test/systems/wcsph_system.jl index a2f9b559b4..8af6b5031b 100644 --- a/test/systems/wcsph_system.jl +++ b/test/systems/wcsph_system.jl @@ -209,11 +209,9 @@ density_diffusion = Val(:density_diffusion) initial_condition = InitialCondition(; coordinates, mass, density) - system = WeaklyCompressibleSPHSystem(initial_condition, - density_calculator, + system = WeaklyCompressibleSPHSystem(initial_condition, density_calculator, state_equation, smoothing_kernel, - smoothing_length; - density_diffusion) + smoothing_length; density_diffusion) show_compact = "WeaklyCompressibleSPHSystem{2}(SummationDensity(), nothing, Val{:state_equation}(), Val{:smoothing_kernel}(), nothing, Val{:density_diffusion}(), nothing, nothing, nothing, [0.0, 0.0], nothing) with 2 particles" @test repr(system) == show_compact diff --git a/validation/dam_break_2d/setup_marrone_2011.jl b/validation/dam_break_2d/setup_marrone_2011.jl index 519182b1be..6c0374a3b7 100644 --- a/validation/dam_break_2d/setup_marrone_2011.jl +++ b/validation/dam_break_2d/setup_marrone_2011.jl @@ -78,8 +78,7 @@ if use_edac state_equation = nothing tank_edac = RectangularTank(particle_spacing, initial_fluid_size, tank_size, - fluid_density; - n_layers=boundary_layers, spacing_ratio, + fluid_density; n_layers=boundary_layers, spacing_ratio, acceleration=(0.0, -gravity), state_equation=nothing) fluid_system = EntropicallyDampedSPHSystem(tank_edac.fluid, smoothing_kernel, @@ -115,11 +114,8 @@ saving_paper = SolutionSavingCallback(save_times=[0.0, 1.5, 2.36, 3.0, 5.7, 6.45 prefix="marrone_times") trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); - fluid_particle_spacing=particle_spacing, - boundary_density_calculator, + fluid_particle_spacing=particle_spacing, boundary_density_calculator, state_equation, - solution_prefix="validation_" * method * "_" * formatted_string, - tspan, fluid_system, - update_strategy=nothing, - extra_callback=postprocessing_cb, + solution_prefix="validation_" * method * "_" * formatted_string, tspan, + fluid_system, update_strategy=nothing, extra_callback=postprocessing_cb, extra_callback2=saving_paper) diff --git a/validation/dam_break_2d/validation_dam_break_2d.jl b/validation/dam_break_2d/validation_dam_break_2d.jl index ec62c5ba6c..52c78a26ad 100644 --- a/validation/dam_break_2d/validation_dam_break_2d.jl +++ b/validation/dam_break_2d/validation_dam_break_2d.jl @@ -27,14 +27,12 @@ update_strategy = nothing # ========================================================================================== # ==== WCSPH simulation +# `sound_speed`, `alpha`, and `tspan` are used by De Courcy et al. (2024). trixi_include(@__MODULE__, - joinpath(validation_dir(), "dam_break_2d", - "setup_marrone_2011.jl"); - use_edac=false, update_strategy, - particles_per_height=resolution, - sound_speed=50 * sqrt(9.81 * 0.6), # This is used by De Courcy et al. (2024) - alpha=0.01, # This is used by De Courcy et al. (2024) - tspan=(0.0, 7 / sqrt(9.81 / 0.6))) # This is used by De Courcy et al. (2024) + joinpath(validation_dir(), "dam_break_2d", "setup_marrone_2011.jl"); + use_edac=false, update_strategy, particles_per_height=resolution, + sound_speed=50 * sqrt(9.81 * 0.6), alpha=0.01, + tspan=(0.0, 7 / sqrt(9.81 / 0.6))) reference_file_wcsph_name = joinpath(validation_dir(), "dam_break_2d", "validation_reference_wcsph_$formatted_string.json") @@ -56,14 +54,12 @@ error_wcsph_P2 = interpolated_mse(reference_data["pressure_P2_fluid_1"]["time"], # ========================================================================================== # ==== EDAC simulation +# `sound_speed`, `alpha`, and `tspan` are used by De Courcy et al. (2024). trixi_include(@__MODULE__, - joinpath(validation_dir(), "dam_break_2d", - "setup_marrone_2011.jl"); - use_edac=true, update_strategy, - particles_per_height=resolution, - sound_speed=50 * sqrt(9.81 * 0.6), # This is used by De Courcy et al. (2024) - alpha=0.01, # This is used by De Courcy et al. (2024) - tspan=(0.0, 7 / sqrt(9.81 / 0.6))) # This is used by De Courcy et al. (2024) + joinpath(validation_dir(), "dam_break_2d", "setup_marrone_2011.jl"); + use_edac=true, update_strategy, particles_per_height=resolution, + sound_speed=50 * sqrt(9.81 * 0.6), alpha=0.01, + tspan=(0.0, 7 / sqrt(9.81 / 0.6))) reference_file_edac_name = joinpath(validation_dir(), "dam_break_2d", "validation_reference_edac_$formatted_string.json") diff --git a/validation/hydrostatic_water_column_2d/validation.jl b/validation/hydrostatic_water_column_2d/validation.jl index 3cf60ffb34..e37dd96eb6 100644 --- a/validation/hydrostatic_water_column_2d/validation.jl +++ b/validation/hydrostatic_water_column_2d/validation.jl @@ -52,11 +52,8 @@ function run_simulation(method; n_particles_plate_y, tspan) trixi_include(@__MODULE__, joinpath(examples_dir(), "fsi", "hydrostatic_water_column_2d.jl"); - use_edac=method.use_edac, - n_particles_plate_y, - update_strategy=SerialUpdate(), - tspan, - prefix=pp_filename, + use_edac=method.use_edac, n_particles_plate_y, + update_strategy=SerialUpdate(), tspan, prefix=pp_filename, extra_callback=pp) # `@invokelatest` is required with Julia 1.12 @@ -69,9 +66,7 @@ errors = Dict{Symbol, Tuple{Float64, Float64}}() for method in methods pp_filename, - _ = run_simulation(method; - n_particles_plate_y, - tspan) + _ = run_simulation(method; n_particles_plate_y, tspan) # Load the run JSON file and add the analytical solution as a single point. run_filename = joinpath("out", pp_filename * ".json") diff --git a/validation/lid_driven_cavity_2d/validation_lid_driven_cavity_2d.jl b/validation/lid_driven_cavity_2d/validation_lid_driven_cavity_2d.jl index d7b2c9f221..33405f1ef5 100644 --- a/validation/lid_driven_cavity_2d/validation_lid_driven_cavity_2d.jl +++ b/validation/lid_driven_cavity_2d/validation_lid_driven_cavity_2d.jl @@ -77,16 +77,13 @@ for reynolds_number in reynolds_numbers, saving_callback = SolutionSavingCallback(; dt=0.02, output_directory) CAPTURE_STARTED[] = false - pp_callback = PostprocessCallback(; dt=0.02, - interpolated_velocity, + pp_callback = PostprocessCallback(; dt=0.02, interpolated_velocity, filename="interpolated_velocities", write_file_interval=0) # Import variables into scope - trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "lid_driven_cavity_2d.jl"); - wcsph, density_calculator, - saving_callback, tspan, pp_callback, + trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "lid_driven_cavity_2d.jl"); + wcsph, density_calculator, saving_callback, tspan, pp_callback, particle_spacing, reynolds_number) file = joinpath(output_directory, "interpolated_velocities.csv") diff --git a/validation/oscillating_beam_2d/validation_oscillating_beam_2d.jl b/validation/oscillating_beam_2d/validation_oscillating_beam_2d.jl index d48faff942..f0c3c8c3c1 100644 --- a/validation/oscillating_beam_2d/validation_oscillating_beam_2d.jl +++ b/validation/oscillating_beam_2d/validation_oscillating_beam_2d.jl @@ -25,8 +25,7 @@ tspan = (0, 10) n_particles_beam_y = 5 # Overwrite `sol` assignment to skip time integration -trixi_include(@__MODULE__, - joinpath(examples_dir(), "structure", "oscillating_beam_2d.jl"); +trixi_include(@__MODULE__, joinpath(examples_dir(), "structure", "oscillating_beam_2d.jl"); n_particles_y=n_particles_beam_y, sol=nothing, tspan, penalty_force=PenaltyForceGanzenmueller(alpha=0.01)) diff --git a/validation/taylor_green_vortex_2d/validation_taylor_green_vortex_2d.jl b/validation/taylor_green_vortex_2d/validation_taylor_green_vortex_2d.jl index 3f0c10a896..afe2f6cb13 100644 --- a/validation/taylor_green_vortex_2d/validation_taylor_green_vortex_2d.jl +++ b/validation/taylor_green_vortex_2d/validation_taylor_green_vortex_2d.jl @@ -91,22 +91,17 @@ for density_calculator in density_calculators, perturbation in perturb_coordinat output_directory = joinpath("out_tgv", name_density_calculator * name_perturbation, wcsph ? "wcsph" : "edac", "validation_run_taylor_green_vortex_2d_nparticles_$(n_particles_xy)x$(n_particles_xy)") - saving_callback = SolutionSavingCallback(; dt=0.02, - output_directory, + saving_callback = SolutionSavingCallback(; dt=0.02, output_directory, p_avg=diff_p_loc_p_avg) - pp_callback = PostprocessCallback(; dt=0.02, - L1v=compute_l1v_error, - L1p=compute_l1p_error, - output_directory, - filename="errors", - write_csv=true, write_file_interval=1) + pp_callback = PostprocessCallback(; dt=0.02, L1v=compute_l1v_error, + L1p=compute_l1p_error, output_directory, + filename="errors", write_csv=true, + write_file_interval=1) # Import variables into scope trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "taylor_green_vortex_2d.jl"); - density_calculator, - perturb_coordinates=perturbation, wcsph, - particle_spacing, reynolds_number, - tspan, saving_callback, pp_callback) + density_calculator, perturb_coordinates=perturbation, wcsph, + particle_spacing, reynolds_number, tspan, saving_callback, pp_callback) end From b6b01fe5f0367d5020c255b0450fab841d484964 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Mon, 27 Apr 2026 16:19:48 +0200 Subject: [PATCH 19/56] format --- examples/fluid/falling_water_spheres_2d.jl | 4 +++- examples/fluid/falling_water_spheres_3d.jl | 8 +++++++- examples/fluid/sphere_surface_tension_wall_2d.jl | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index d4ce60b6ac..77c32408a8 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -32,7 +32,9 @@ sound_speed = 100 state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density, exponent=1) -tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; n_layers=boundary_layers, spacing_ratio, faces, acceleration, state_equation) +tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density; + n_layers=boundary_layers, spacing_ratio, faces, acceleration, + state_equation) sphere_radius = 0.05 diff --git a/examples/fluid/falling_water_spheres_3d.jl b/examples/fluid/falling_water_spheres_3d.jl index 4ce493245c..10e2c0c915 100644 --- a/examples/fluid/falling_water_spheres_3d.jl +++ b/examples/fluid/falling_water_spheres_3d.jl @@ -35,4 +35,10 @@ fluid_smoothing_length = 1.0 * fluid_particle_spacing surface_tension = SurfaceTensionAkinci(surface_tension_coefficient=0.05) -trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); fluid_particle_spacing, tspan=(0.0, 0.1), initial_fluid_size=(0.0, 0.0, 0.0), interval=100, tank_size=(2.0, 1.0, 0.1), sound_speed, faces=(true, true, true, true, true, false), acceleration=(0.0, 0.0, -gravity), sphere1, sphere2, fluid_smoothing_length, fluid_smoothing_kernel=SchoenbergCubicSplineKernel{3}(), nu, alpha=10 * nu / (fluid_smoothing_length * sound_speed), surface_tension) +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); + fluid_particle_spacing, tspan=(0.0, 0.1), initial_fluid_size=(0.0, 0.0, 0.0), + interval=100, tank_size=(2.0, 1.0, 0.1), sound_speed, + faces=(true, true, true, true, true, false), + acceleration=(0.0, 0.0, -gravity), sphere1, sphere2, fluid_smoothing_length, + fluid_smoothing_kernel=SchoenbergCubicSplineKernel{3}(), nu, + alpha=10 * nu / (fluid_smoothing_length * sound_speed), surface_tension) diff --git a/examples/fluid/sphere_surface_tension_wall_2d.jl b/examples/fluid/sphere_surface_tension_wall_2d.jl index 76d086cdab..ec0c8ade6a 100644 --- a/examples/fluid/sphere_surface_tension_wall_2d.jl +++ b/examples/fluid/sphere_surface_tension_wall_2d.jl @@ -62,4 +62,7 @@ sphere_surface_tension = WeaklyCompressibleSPHSystem(sphere1; correction=AkinciFreeSurfaceCorrection(fluid_density), reference_particle_spacing=fluid_particle_spacing) -trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); sphere=nothing, sphere1, adhesion_coefficient=0.001, wall_viscosity=4.0 * nu, alpha, sound_speed, fluid_density, nu, fluid_particle_spacing, tspan, tank_size, fluid_smoothing_length, sphere_surface_tension) +trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"); + sphere=nothing, sphere1, adhesion_coefficient=0.001, wall_viscosity=4.0 * nu, + alpha, sound_speed, fluid_density, nu, fluid_particle_spacing, tspan, + tank_size, fluid_smoothing_length, sphere_surface_tension) From 1ddba071c2ec15779c52b6bf83de1e5b345ffa80 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 11:20:17 +0200 Subject: [PATCH 20/56] fix --- test/systems/rigid_system.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/systems/rigid_system.jl b/test/systems/rigid_system.jl index 63abf8fec5..6a171b1eda 100644 --- a/test/systems/rigid_system.jl +++ b/test/systems/rigid_system.jl @@ -590,7 +590,8 @@ reference_particle_spacing=particle_spacing) function run_setup(fluid_positions) - rigid_ic = InitialCondition(; coordinates=[-0.5 0.5 0.0 0.0], + rigid_ic = InitialCondition(; coordinates=[-0.5 0.5 + 0.0 0.0], velocity=zeros(2, 2), mass=fill(particle_volume * rigid_density, 2), density=fill(rigid_density, 2), particle_spacing) From 9ff9e8270f2a64ea8b6e6af4d082054e05496d5e Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 11:23:11 +0200 Subject: [PATCH 21/56] format --- test/systems/rigid_system.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/systems/rigid_system.jl b/test/systems/rigid_system.jl index 6a171b1eda..3ee2e355e5 100644 --- a/test/systems/rigid_system.jl +++ b/test/systems/rigid_system.jl @@ -591,7 +591,7 @@ function run_setup(fluid_positions) rigid_ic = InitialCondition(; coordinates=[-0.5 0.5 - 0.0 0.0], + 0.0 0.0], velocity=zeros(2, 2), mass=fill(particle_volume * rigid_density, 2), density=fill(rigid_density, 2), particle_spacing) From 08e2a86955ff81bee21ee82ad50e76a437fde64a Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:08:41 +0200 Subject: [PATCH 22/56] Apply suggestion from @efaulhaber Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl b/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl index cd2fb35809..113b1d8735 100644 --- a/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl +++ b/examples/fluid/dam_break_2d_iisph_pressure_boundaries.jl @@ -6,8 +6,7 @@ tspan = (0.0, 5.7 / sqrt(9.81 / 0.6)) # Load setup from dam break example trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); - tspan, - sol=nothing, ode=nothing) + tspan, sol=nothing, ode=nothing) # Change smoothing kernel and length smoothing_length = 1.2 * fluid_particle_spacing From d03a88c33ff6853eed679d9857f3c2fd899a136c Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:09:10 +0200 Subject: [PATCH 23/56] Update examples/fluid/dam_break_oil_film_2d.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- examples/fluid/dam_break_oil_film_2d.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fluid/dam_break_oil_film_2d.jl b/examples/fluid/dam_break_oil_film_2d.jl index 93f68021df..0ed141fc16 100644 --- a/examples/fluid/dam_break_oil_film_2d.jl +++ b/examples/fluid/dam_break_oil_film_2d.jl @@ -70,8 +70,7 @@ oil_system = WeaklyCompressibleSPHSystem(oil; reference_particle_spacing=fluid_particle_spacing) # oil_system = WeaklyCompressibleSPHSystem(oil; -# smoothing_kernel, -# smoothing_length, +# smoothing_kernel, smoothing_length, # density_calculator=fluid_density_calculator, # state_equation=oil_eos, # viscosity=oil_viscosity, From b14fe4103c7ea019652439b1c8dbca628e1e8979 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:09:22 +0200 Subject: [PATCH 24/56] Update examples/fluid/falling_water_spheres_2d.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- examples/fluid/falling_water_spheres_2d.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index 77c32408a8..eb73e2ec4a 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -67,8 +67,7 @@ sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1; smoothing_length=fluid_smoothing_length, sound_speed, viscosity, density_calculator=ContinuityDensity(), - acceleration, - surface_tension, + acceleration, surface_tension, reference_particle_spacing=fluid_particle_spacing) sphere = WeaklyCompressibleSPHSystem(sphere2; smoothing_kernel=fluid_smoothing_kernel, From d941a560e16f97580ed2030913f77f7f696b0adf Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:09:55 +0200 Subject: [PATCH 25/56] Update examples/fluid/falling_water_spheres_2d.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- examples/fluid/falling_water_spheres_2d.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index eb73e2ec4a..e38814a1fe 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -96,8 +96,7 @@ boundary_system = WallBoundarySystem(tank.boundary, boundary_model; semi = Semidiscretization(sphere_surface_tension, sphere, boundary_system) ode = semidiscretize(semi, tspan) -interval = 1000 -info_callback = InfoCallback(; interval) +info_callback = InfoCallback(interval=1000) saving_callback = SolutionSavingCallback(dt=0.01, output_directory="out", prefix="") From bfd5087e9eff1a28deab3b371f104d9b55223f56 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:10:16 +0200 Subject: [PATCH 26/56] Update test/systems/tlsph_system.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/systems/tlsph_system.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/systems/tlsph_system.jl b/test/systems/tlsph_system.jl index 26c9be91d3..1b69655b5a 100644 --- a/test/systems/tlsph_system.jl +++ b/test/systems/tlsph_system.jl @@ -370,10 +370,8 @@ initial_condition = InitialCondition(; coordinates, velocity, mass, density=material_densities) - system = TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus=E, + system = TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, young_modulus=E, poisson_ratio=nu) # Initialize deformation_grad and pk1_rho2 with arbitrary values From 7851285f5d99e8144248a6c28fc5dee39ea858a5 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:10:30 +0200 Subject: [PATCH 27/56] Update test/systems/tlsph_system.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/systems/tlsph_system.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/systems/tlsph_system.jl b/test/systems/tlsph_system.jl index 1b69655b5a..c98e8d17d9 100644 --- a/test/systems/tlsph_system.jl +++ b/test/systems/tlsph_system.jl @@ -222,10 +222,8 @@ smoothing_length) initial_condition = InitialCondition(; coordinates, mass, density) - system = TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus=1.0, + system = TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, young_modulus=1.0, poisson_ratio=1.0) semi = DummySemidiscretization() From 6c3125242335f8e3b134d8f6c9dc0f89fe7c7816 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:10:45 +0200 Subject: [PATCH 28/56] Update test/systems/edac_system.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/systems/edac_system.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/systems/edac_system.jl b/test/systems/edac_system.jl index 6074d9e8bf..3b462555ae 100644 --- a/test/systems/edac_system.jl +++ b/test/systems/edac_system.jl @@ -26,10 +26,8 @@ system = EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, smoothing_length, sound_speed) - system_keywords = EntropicallyDampedSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - sound_speed) + system_keywords = EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, sound_speed) @test system isa EntropicallyDampedSPHSystem{NDIMS} @test system.initial_condition == initial_condition From 104980b93117cb9cd0232c028d4da2bf95377e90 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:11:07 +0200 Subject: [PATCH 29/56] Update test/schemes/structure/total_lagrangian_sph/rhs.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/schemes/structure/total_lagrangian_sph/rhs.jl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/schemes/structure/total_lagrangian_sph/rhs.jl b/test/schemes/structure/total_lagrangian_sph/rhs.jl index 2f7a5aef93..225ea8afd4 100644 --- a/test/schemes/structure/total_lagrangian_sph/rhs.jl +++ b/test/schemes/structure/total_lagrangian_sph/rhs.jl @@ -160,12 +160,10 @@ smoothing_kernel = SchoenbergCubicSplineKernel{2}() initial_condition = InitialCondition(; coordinates, mass, density) - system = TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus=E, + system = TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, young_modulus=E, poisson_ratio=nu) - tspan = (0.0, 1.0) +tspan = (0.0, 1.0) names = ["CPU code", "GPU code emulated on the CPU"] backends = [SerialBackend(), TrixiParticles.KernelAbstractions.CPU()] From ce4d33cb62088b42c8a8d0ad98cef429d1606ab2 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:11:57 +0200 Subject: [PATCH 30/56] Update examples/fluid/poiseuille_flow_3d.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- examples/fluid/poiseuille_flow_3d.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fluid/poiseuille_flow_3d.jl b/examples/fluid/poiseuille_flow_3d.jl index 5a05b2704b..94c795b2ca 100644 --- a/examples/fluid/poiseuille_flow_3d.jl +++ b/examples/fluid/poiseuille_flow_3d.jl @@ -114,10 +114,9 @@ state_equation = StateEquationCole(; sound_speed, reference_density=fluid_densit exponent=1) fluid_system = WeaklyCompressibleSPHSystem(fluid_particles; smoothing_kernel, - smoothing_length, + smoothing_length, shifting_technique, density_calculator=fluid_density_calculator, state_equation, buffer_size=n_buffer_particles, - shifting_technique, density_diffusion=DensityDiffusionMolteniColagrossi(delta=0.1), viscosity) From de041344fdbae8479d47e7cb6be92c5b4ca2ac8f Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:12:57 +0200 Subject: [PATCH 31/56] Update examples/fsi/dam_break_gate_2d.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- examples/fsi/dam_break_gate_2d.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fsi/dam_break_gate_2d.jl b/examples/fsi/dam_break_gate_2d.jl index 3ebef03623..e534de8409 100644 --- a/examples/fsi/dam_break_gate_2d.jl +++ b/examples/fsi/dam_break_gate_2d.jl @@ -150,8 +150,7 @@ boundary_model_structure = BoundaryModelDummyParticles(hydrodynamic_densites, structure_system = TotalLagrangianSPHSystem(structure; smoothing_kernel=structure_smoothing_kernel, smoothing_length=structure_smoothing_length, - young_modulus=E, - poisson_ratio=nu, + young_modulus=E, poisson_ratio=nu, boundary_model=boundary_model_structure, clamped_particles=1:nparticles(clamped_particles), acceleration=(0.0, -gravity)) From c6455de37a64fe6c3159fc0bfa3f696aaf724a25 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:13:20 +0200 Subject: [PATCH 32/56] Update examples/fsi/dam_break_plate_2d.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- examples/fsi/dam_break_plate_2d.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fsi/dam_break_plate_2d.jl b/examples/fsi/dam_break_plate_2d.jl index 7ec4ffcc37..b4a24706d0 100644 --- a/examples/fsi/dam_break_plate_2d.jl +++ b/examples/fsi/dam_break_plate_2d.jl @@ -126,8 +126,7 @@ boundary_model_structure = BoundaryModelMonaghanKajtar(k_structure, spacing_rati structure_system = TotalLagrangianSPHSystem(structure; smoothing_kernel=structure_smoothing_kernel, smoothing_length=structure_smoothing_length, - young_modulus=E, - poisson_ratio=nu, + young_modulus=E, poisson_ratio=nu, boundary_model=boundary_model_structure, clamped_particles=1:nparticles(clamped_particles), acceleration=(0.0, -gravity), From 75b40763122bf6366a33ac51477cc4516f3caf2a Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:13:40 +0200 Subject: [PATCH 33/56] Update examples/fsi/hydrostatic_water_column_2d.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- examples/fsi/hydrostatic_water_column_2d.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fsi/hydrostatic_water_column_2d.jl b/examples/fsi/hydrostatic_water_column_2d.jl index b8d3ca63df..0b979fb9f1 100644 --- a/examples/fsi/hydrostatic_water_column_2d.jl +++ b/examples/fsi/hydrostatic_water_column_2d.jl @@ -127,8 +127,7 @@ boundary_model_structure = BoundaryModelDummyParticles(hydrodynamic_densities, structure_system = TotalLagrangianSPHSystem(structure_geometry; smoothing_kernel, smoothing_length=smoothing_length_structure, - young_modulus=E, - poisson_ratio=nu, + young_modulus=E, poisson_ratio=nu, boundary_model=boundary_model_structure, clamped_particles=1:nparticles(fixed_particles), acceleration=(0.0, -gravity)) From ab8d1bc4583a7dce16c45e7e1eb259a65c6413b3 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:14:16 +0200 Subject: [PATCH 34/56] Update examples/structure/oscillating_beam_2d.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- examples/structure/oscillating_beam_2d.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/structure/oscillating_beam_2d.jl b/examples/structure/oscillating_beam_2d.jl index 78d4f98041..9de6fbd687 100644 --- a/examples/structure/oscillating_beam_2d.jl +++ b/examples/structure/oscillating_beam_2d.jl @@ -60,9 +60,7 @@ structure = union(clamped_particles, beam) smoothing_length = sqrt(2) * particle_spacing smoothing_kernel = WendlandC2Kernel{2}() -structure_system = TotalLagrangianSPHSystem(structure; - smoothing_kernel, - smoothing_length, +structure_system = TotalLagrangianSPHSystem(structure; smoothing_kernel, smoothing_length, young_modulus=material.E, poisson_ratio=material.nu, clamped_particles=1:nparticles(clamped_particles), From 556bd9412dc299dc6dc8cd32093250c5dae7b259 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:14:37 +0200 Subject: [PATCH 35/56] Update src/schemes/boundary/dem_boundary/system.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- src/schemes/boundary/dem_boundary/system.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/schemes/boundary/dem_boundary/system.jl b/src/schemes/boundary/dem_boundary/system.jl index 3eefc46322..cfb0d5247d 100644 --- a/src/schemes/boundary/dem_boundary/system.jl +++ b/src/schemes/boundary/dem_boundary/system.jl @@ -22,6 +22,8 @@ struct BoundaryDEMSystem{NDIMS, ELTYPE <: Real, IC, normal_stiffness :: ELTYPE buffer :: Nothing + # This constructor is necessary for Adapt.jl to work with this struct. + # See the comments in general/gpu.jl for more details. function BoundaryDEMSystem(initial_condition, coordinates, radius, normal_stiffness, buffer) NDIMS = ndims(initial_condition) From ec946f87305025fe0411d72d26a695056fe88be3 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:18:23 +0200 Subject: [PATCH 36/56] Update src/schemes/fluid/entropically_damped_sph/system.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- src/schemes/fluid/entropically_damped_sph/system.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index 4762c99397..3f0f9db803 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -1,8 +1,6 @@ @doc raw""" - EntropicallyDampedSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - sound_speed, + EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, sound_speed, pressure_acceleration=inter_particle_averaged_pressure, density_calculator=SummationDensity(), shifting_technique=nothing, From efe949b391f1b3ff739c7ad9dd4faedca476cb44 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:18:56 +0200 Subject: [PATCH 37/56] Update src/schemes/fluid/implicit_incompressible_sph/system.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- src/schemes/fluid/implicit_incompressible_sph/system.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/schemes/fluid/implicit_incompressible_sph/system.jl b/src/schemes/fluid/implicit_incompressible_sph/system.jl index f603811a91..7d56512c7a 100644 --- a/src/schemes/fluid/implicit_incompressible_sph/system.jl +++ b/src/schemes/fluid/implicit_incompressible_sph/system.jl @@ -1,8 +1,6 @@ """ - ImplicitIncompressibleSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - reference_density, + ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, reference_density, viscosity=nothing, acceleration=ntuple(_ -> 0.0, NDIMS), omega=0.5, max_error=0.1, min_iterations=2, From 00b2f1f3db77728d7c5a94b3d86449eb5f663e94 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:19:28 +0200 Subject: [PATCH 38/56] Update src/schemes/fluid/weakly_compressible_sph/system.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- src/schemes/fluid/weakly_compressible_sph/system.jl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index f2db9ed326..f36a257911 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -1,9 +1,6 @@ """ - WeaklyCompressibleSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - density_calculator, - state_equation, + WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, density_calculator, state_equation, acceleration=ntuple(_ -> 0.0, NDIMS), viscosity=nothing, density_diffusion=nothing, pressure_acceleration=nothing, From 3d0e81be1ca1c793eeab73753cfdc25f2eb19ed6 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:20:53 +0200 Subject: [PATCH 39/56] Update src/schemes/structure/discrete_element_method/system.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- src/schemes/structure/discrete_element_method/system.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/schemes/structure/discrete_element_method/system.jl b/src/schemes/structure/discrete_element_method/system.jl index ad36166418..75a2e31de9 100644 --- a/src/schemes/structure/discrete_element_method/system.jl +++ b/src/schemes/structure/discrete_element_method/system.jl @@ -1,7 +1,5 @@ """ - DEMSystem(initial_condition; - contact_model, - damping_coefficient=0.0001, + DEMSystem(initial_condition; contact_model, damping_coefficient=0.0001, acceleration=ntuple(_ -> 0.0, NDIMS), source_terms=nothing, radius=nothing) From 265b562115cdbd7faacbf2c0dad8ff082159e2ed Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:21:42 +0200 Subject: [PATCH 40/56] Update test/general/custom_quantities.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/general/custom_quantities.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/general/custom_quantities.jl b/test/general/custom_quantities.jl index b7cbcb132d..33435c8fd1 100644 --- a/test/general/custom_quantities.jl +++ b/test/general/custom_quantities.jl @@ -12,10 +12,8 @@ smoothing_kernel = SchoenbergCubicSplineKernel{2}() smoothing_length = 1.2 * particle_spacing - fluid_system = EntropicallyDampedSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - sound_speed=1.0) + fluid_system = EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, sound_speed=1.0) fluid_system.cache.density .= initial_condition.density boundary_model = BoundaryModelDummyParticles(initial_condition.density, From 7aa865494ec20d205954cfa0393d4e70e5efced4 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:22:12 +0200 Subject: [PATCH 41/56] Update test/general/interpolation.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/general/interpolation.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/general/interpolation.jl b/test/general/interpolation.jl index 0687f51b82..afb313c371 100644 --- a/test/general/interpolation.jl +++ b/test/general/interpolation.jl @@ -108,8 +108,7 @@ boundary_model = BoundaryModelDummyParticles(bnd.density, bnd.mass, AdamiPressureExtrapolation(), smoothing_kernel, smoothing_length; - state_equation, - viscosity) + state_equation, viscosity) boundary_system = WallBoundarySystem(bnd, boundary_model) From 9832beef261f0b0109a558cab884ec3f9eab800b Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:22:41 +0200 Subject: [PATCH 42/56] Update test/general/interpolation.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/general/interpolation.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/general/interpolation.jl b/test/general/interpolation.jl index afb313c371..5ac7e888cf 100644 --- a/test/general/interpolation.jl +++ b/test/general/interpolation.jl @@ -651,8 +651,7 @@ boundary_model = BoundaryModelDummyParticles(bnd.density, bnd.mass, AdamiPressureExtrapolation(), smoothing_kernel, smoothing_length; - state_equation, - viscosity) + state_equation, viscosity) boundary_system = WallBoundarySystem(bnd, boundary_model) From 1ae0b3f8d0d9604f9dcaded464b48354b323e15a Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:24:03 +0200 Subject: [PATCH 43/56] Update test/schemes/boundary/dummy_particles/rhs.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/schemes/boundary/dummy_particles/rhs.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/schemes/boundary/dummy_particles/rhs.jl b/test/schemes/boundary/dummy_particles/rhs.jl index 7dfe3e871b..1242b1e80a 100644 --- a/test/schemes/boundary/dummy_particles/rhs.jl +++ b/test/schemes/boundary/dummy_particles/rhs.jl @@ -77,10 +77,8 @@ v_boundary_continuity = copy(initial_condition.density') # TLSPH system - structure_system = TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus=0.0, + structure_system = TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, young_modulus=0.0, poisson_ratio=0.0, boundary_model=boundary_model_continuity) From 4c5ad1950a1262f415e92ac270c2c82c1c71de6c Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:24:32 +0200 Subject: [PATCH 44/56] Update test/schemes/fluid/rhs.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/schemes/fluid/rhs.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/schemes/fluid/rhs.jl b/test/schemes/fluid/rhs.jl index 48297a0b8a..89010d6e65 100644 --- a/test/schemes/fluid/rhs.jl +++ b/test/schemes/fluid/rhs.jl @@ -140,8 +140,7 @@ pressure_acceleration=nothing, density_calculator) - system_iisph = ImplicitIncompressibleSPHSystem(fluid; - smoothing_kernel, + system_iisph = ImplicitIncompressibleSPHSystem(fluid; smoothing_kernel, smoothing_length, reference_density=1000.0, time_step=0.001) From 687698c046958f38b08b7255256b401b50c77d61 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:25:19 +0200 Subject: [PATCH 45/56] Update test/schemes/boundary/dummy_particles/dummy_particles.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/schemes/boundary/dummy_particles/dummy_particles.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/schemes/boundary/dummy_particles/dummy_particles.jl b/test/schemes/boundary/dummy_particles/dummy_particles.jl index cf468f107a..309a6b18da 100644 --- a/test/schemes/boundary/dummy_particles/dummy_particles.jl +++ b/test/schemes/boundary/dummy_particles/dummy_particles.jl @@ -75,10 +75,8 @@ young_modulus=1e6, poisson_ratio=0.3, boundary_model=boundary_model_adami), - TotalLagrangianSPHSystem(boundary; - smoothing_kernel, - smoothing_length, - young_modulus=1e6, + TotalLagrangianSPHSystem(boundary; smoothing_kernel, + smoothing_length, young_modulus=1e6, poisson_ratio=0.3, boundary_model=boundary_model_bernoulli) ] From 2144c9b3183797658e979bd15c780dd7bb44949b Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:25:45 +0200 Subject: [PATCH 46/56] Update test/schemes/boundary/dummy_particles/dummy_particles.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- test/schemes/boundary/dummy_particles/dummy_particles.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/schemes/boundary/dummy_particles/dummy_particles.jl b/test/schemes/boundary/dummy_particles/dummy_particles.jl index 309a6b18da..40993b4e77 100644 --- a/test/schemes/boundary/dummy_particles/dummy_particles.jl +++ b/test/schemes/boundary/dummy_particles/dummy_particles.jl @@ -69,10 +69,8 @@ particle_spacing), RigidBodySystem(boundary; boundary_model=boundary_model_bernoulli, particle_spacing), - TotalLagrangianSPHSystem(boundary; - smoothing_kernel, - smoothing_length, - young_modulus=1e6, + TotalLagrangianSPHSystem(boundary; smoothing_kernel, + smoothing_length, young_modulus=1e6, poisson_ratio=0.3, boundary_model=boundary_model_adami), TotalLagrangianSPHSystem(boundary; smoothing_kernel, From 46ece3a6d9b510af4132e92fcd2264ce06b31e13 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 12:30:10 +0200 Subject: [PATCH 47/56] fix doc strings --- .../fluid/entropically_damped_sph/system.jl | 14 ++++++------- .../implicit_incompressible_sph/system.jl | 18 +++++++--------- .../fluid/weakly_compressible_sph/system.jl | 21 ++++++++----------- .../discrete_element_method/system.jl | 12 +++++------ .../structure/total_lagrangian_sph/system.jl | 7 ++----- 5 files changed, 30 insertions(+), 42 deletions(-) diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index 4762c99397..63a6b07431 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -1,8 +1,6 @@ @doc raw""" - EntropicallyDampedSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - sound_speed, + EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, sound_speed, pressure_acceleration=inter_particle_averaged_pressure, density_calculator=SummationDensity(), shifting_technique=nothing, @@ -21,11 +19,11 @@ See [Entropically Damped Artificial Compressibility for SPH](@ref edac) for more - `initial_condition`: Initial condition representing the system's particles. # Keywords -- `smoothing_kernel`: Smoothing kernel to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). -- `smoothing_length`: Smoothing length to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). - `sound_speed`: Speed of sound. +- `smoothing_kernel`: Smoothing kernel to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). +- `smoothing_length`: Smoothing length to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). - `viscosity`: Viscosity model for this system (default: no viscosity). Recommended: [`ViscosityAdami`](@ref). - `acceleration`: Acceleration vector for the system. (default: zero vector) diff --git a/src/schemes/fluid/implicit_incompressible_sph/system.jl b/src/schemes/fluid/implicit_incompressible_sph/system.jl index f603811a91..410d2b8370 100644 --- a/src/schemes/fluid/implicit_incompressible_sph/system.jl +++ b/src/schemes/fluid/implicit_incompressible_sph/system.jl @@ -1,10 +1,8 @@ """ - ImplicitIncompressibleSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - reference_density, + ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, reference_density, viscosity=nothing, - acceleration=ntuple(_ -> 0.0, NDIMS), + acceleration=ntuple(_ -> 0.0, ndims(smoothing_kernel)), omega=0.5, max_error=0.1, min_iterations=2, max_iterations=20, time_step) @@ -19,11 +17,11 @@ See [Implicit Incompressible SPH](@ref iisph) for more details on the method. - `initial_condition`: [`InitialCondition`](@ref) representing the system's particles. # Keywords -- `smoothing_kernel`: Smoothing kernel to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). -- `smoothing_length`: Smoothing length to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). -- `reference_density`: Reference density used for the fluid particles. +- `smoothing_kernel`: Smoothing kernel to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). +- `smoothing_length`: Smoothing length to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). +- `reference_density`: Reference density used for the fluid particles. - `viscosity`: Currently, only [`ViscosityMorris`](@ref) and [`ViscosityAdami`](@ref) are supported. - `acceleration`: Acceleration vector for the system. (default: zero vector) diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index f2db9ed326..1dc10d0a48 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -1,9 +1,6 @@ """ - WeaklyCompressibleSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - density_calculator, - state_equation, + WeaklyCompressibleSPHSystem(initial_condition; density_calculator, state_equation, + smoothing_kernel, smoothing_length, acceleration=ntuple(_ -> 0.0, NDIMS), viscosity=nothing, density_diffusion=nothing, pressure_acceleration=nothing, @@ -22,13 +19,13 @@ See [Weakly Compressible SPH](@ref wcsph) for more details on the method. - `initial_condition`: [`InitialCondition`](@ref) representing the system's particles. # Keywords -- `smoothing_kernel`: Smoothing kernel to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). -- `smoothing_length`: Smoothing length to be used for this system. - See [Smoothing Kernels](@ref smoothing_kernel). -- `density_calculator`: Density calculator for the system. - See [`ContinuityDensity`](@ref) and [`SummationDensity`](@ref). -- `state_equation`: Equation of state for the system. See [`StateEquationCole`](@ref). +- `density_calculator`: Density calculator for the system. + See [`ContinuityDensity`](@ref) and [`SummationDensity`](@ref). +- `state_equation`: Equation of state for the system. See [`StateEquationCole`](@ref). +- `smoothing_kernel`: Smoothing kernel to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). +- `smoothing_length`: Smoothing length to be used for this system. + See [Smoothing Kernels](@ref smoothing_kernel). - `acceleration`: Acceleration vector for the system. (default: zero vector) - `viscosity`: Viscosity model for this system (default: no viscosity). See [`ArtificialViscosityMonaghan`](@ref) or [`ViscosityAdami`](@ref). diff --git a/src/schemes/structure/discrete_element_method/system.jl b/src/schemes/structure/discrete_element_method/system.jl index ad36166418..29d76203f0 100644 --- a/src/schemes/structure/discrete_element_method/system.jl +++ b/src/schemes/structure/discrete_element_method/system.jl @@ -1,8 +1,6 @@ """ - DEMSystem(initial_condition; - contact_model, - damping_coefficient=0.0001, - acceleration=ntuple(_ -> 0.0, NDIMS), + DEMSystem(initial_condition; contact_model, damping_coefficient=0.0001, + acceleration=ntuple(_ -> 0.0, ndims(initial_condition)), source_terms=nothing, radius=nothing) @@ -18,10 +16,10 @@ specified material properties and contact mechanics. velocities, masses, and radii of particles. # Keywords -- `contact_model`: Contact model used for particle interactions. - - `acceleration`: Global acceleration vector applied to the system, such as gravity. Specified as + - `contact_model`: Contact model used for particle interactions. + - `acceleration`: Global acceleration vector applied to the system, such as gravity. Specified as an `SVector` of length `NDIMS`, with a default of zero in each dimension. - - `source_terms`: Optional; additional forces or modifications to particle dynamics not + - `source_terms`: Optional; additional forces or modifications to particle dynamics not captured by standard DEM interactions, such as electromagnetic forces or user-defined perturbations. - `damping_coefficient=0.0001`: Set a damping coefficient for the collision interactions. - `radius=nothing`: Specifies the radius of the particles, defaults to `initial_condition.particle_spacing / 2`. diff --git a/src/schemes/structure/total_lagrangian_sph/system.jl b/src/schemes/structure/total_lagrangian_sph/system.jl index 3d5ffbf170..9b68d42b02 100644 --- a/src/schemes/structure/total_lagrangian_sph/system.jl +++ b/src/schemes/structure/total_lagrangian_sph/system.jl @@ -1,9 +1,6 @@ @doc raw""" - TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus, - poisson_ratio, + TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, smoothing_length, + young_modulus, poisson_ratio, clamped_particles=Int[], clamped_particles_motion=nothing, acceleration=ntuple(_ -> 0.0, NDIMS), From ea412992a068504092a88640ddb98a688160f6b3 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 13:44:16 +0200 Subject: [PATCH 48/56] review --- examples/fluid/dam_break_2d_gpu.jl | 23 +++-- examples/fluid/falling_water_spheres_2d.jl | 3 +- examples/fluid/lid_driven_cavity_2d.jl | 3 +- examples/fluid/poiseuille_flow_2d.jl | 3 +- examples/fluid/sphere_surface_tension_2d.jl | 6 +- .../fluid/entropically_damped_sph/system.jl | 19 +---- .../implicit_incompressible_sph/system.jl | 9 +- .../fluid/weakly_compressible_sph/system.jl | 20 +---- .../discrete_element_method/system.jl | 2 + .../structure/total_lagrangian_sph/system.jl | 12 +-- src/setups/rectangular_tank.jl | 4 +- test/general/density_calculator.jl | 7 +- test/general/interpolation.jl | 14 ++-- test/general/semidiscretization.jl | 6 +- .../dummy_particles/dummy_particles.jl | 28 ++++--- test/schemes/boundary/dummy_particles/rhs.jl | 16 ++-- .../monaghan_kajtar/monaghan_kajtar.jl | 7 +- .../open_boundary/characteristic_variables.jl | 25 +++--- .../open_boundary/dynamical_pressure.jl | 36 ++++---- .../boundary/open_boundary/mirroring.jl | 42 +++++----- .../boundary/open_boundary/open_boundary.jl | 4 +- test/schemes/fluid/rhs.jl | 25 +++--- test/schemes/fluid/surface_normal_sph.jl | 5 +- test/schemes/fluid/surface_tension.jl | 9 +- test/schemes/fluid/viscosity.jl | 49 ++++++----- test/systems/edac_system.jl | 42 ++++------ test/systems/rigid_system.jl | 35 ++++---- test/systems/wcsph_system.jl | 84 ++++++++----------- validation/dam_break_2d/setup_marrone_2011.jl | 2 +- 29 files changed, 257 insertions(+), 283 deletions(-) diff --git a/examples/fluid/dam_break_2d_gpu.jl b/examples/fluid/dam_break_2d_gpu.jl index 54b31e59c2..8051af1838 100644 --- a/examples/fluid/dam_break_2d_gpu.jl +++ b/examples/fluid/dam_break_2d_gpu.jl @@ -18,20 +18,13 @@ using TrixiParticles -fluid_particle_spacing = 0.6 / 40 -spacing_ratio = 1 -boundary_layers = 4 -coordinates_eltype = Float64 tspan = (0.0, 5.7 / sqrt(9.81 / 0.6)) # Load setup from dam break example trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); - fluid_particle_spacing, - spacing_ratio, boundary_layers, - coordinates_eltype, - tspan, - sol=nothing, ode=nothing) + joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), + fluid_particle_spacing=0.6 / 40, spacing_ratio=1, boundary_layers=4, + coordinates_eltype=Float64, tspan, sol=nothing, ode=nothing) # Define a GPU-compatible neighborhood search min_corner = minimum(tank.boundary.coordinates, dims=2) @@ -40,6 +33,10 @@ cell_list = FullGridCellList(; min_corner, max_corner) neighborhood_search = GridNeighborhoodSearch{2}(; cell_list) # Run the dam break simulation with this neighborhood search -trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"); - neighborhood_search, fluid_particle_spacing, tspan, boundary_layers, - spacing_ratio, parallelization_backend=PolyesterBackend(), coordinates_eltype) +trixi_include(@__MODULE__, + joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), + neighborhood_search, fluid_particle_spacing, + tspan, smoothing_length, density_diffusion, + boundary_layers, spacing_ratio, boundary_model, + parallelization_backend=PolyesterBackend(), boundary_density_calculator, + coordinates_eltype=Float64) diff --git a/examples/fluid/falling_water_spheres_2d.jl b/examples/fluid/falling_water_spheres_2d.jl index e38814a1fe..b8d5e9a59a 100644 --- a/examples/fluid/falling_water_spheres_2d.jl +++ b/examples/fluid/falling_water_spheres_2d.jl @@ -87,9 +87,8 @@ boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundar viscosity=ViscosityAdami(nu=wall_viscosity), reference_particle_spacing=fluid_particle_spacing) -adhesion_coefficient = 1.0 boundary_system = WallBoundarySystem(tank.boundary, boundary_model; - adhesion_coefficient) + adhesion_coefficient=1.0) # ========================================================================================== # ==== Simulation diff --git a/examples/fluid/lid_driven_cavity_2d.jl b/examples/fluid/lid_driven_cavity_2d.jl index b01dea22b1..77cab0e118 100644 --- a/examples/fluid/lid_driven_cavity_2d.jl +++ b/examples/fluid/lid_driven_cavity_2d.jl @@ -63,9 +63,8 @@ if wcsph exponent=1) fluid_system = WeaklyCompressibleSPHSystem(cavity.fluid; smoothing_kernel, smoothing_length, density_calculator, - state_equation, + state_equation, viscosity, pressure_acceleration=TrixiParticles.inter_particle_averaged_pressure, - viscosity, shifting_technique=TransportVelocityAdami(background_pressure=pressure)) else state_equation = nothing diff --git a/examples/fluid/poiseuille_flow_2d.jl b/examples/fluid/poiseuille_flow_2d.jl index fc2a4185b4..f39835adfb 100644 --- a/examples/fluid/poiseuille_flow_2d.jl +++ b/examples/fluid/poiseuille_flow_2d.jl @@ -98,9 +98,8 @@ if use_wcsph exponent=1) fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, smoothing_length, density_calculator=fluid_density_calculator, - state_equation, + state_equation, shifting_technique, buffer_size=n_buffer_particles, - shifting_technique, density_diffusion=DensityDiffusionMolteniColagrossi(delta=0.1), viscosity) else diff --git a/examples/fluid/sphere_surface_tension_2d.jl b/examples/fluid/sphere_surface_tension_2d.jl index 8279d7bb3d..d946f3ca1e 100644 --- a/examples/fluid/sphere_surface_tension_2d.jl +++ b/examples/fluid/sphere_surface_tension_2d.jl @@ -38,7 +38,11 @@ fluid = RectangularShape(particle_spacing, round.(Int, fluid_size ./ particle_sp alpha = 8 * nu / (smoothing_length * sound_speed) source_terms = SourceTermDamping(; damping_coefficient=0.5) -# fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, smoothing_length, density_calculator=SummationDensity(), state_equation, reference_particle_spacing=particle_spacing, viscosity=ArtificialViscosityMonaghan(; alpha, beta=0.0), surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.02), correction=AkinciFreeSurfaceCorrection(fluid_density), source_terms) +# fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, +# smoothing_length, density_calculator=SummationDensity(), state_equation, +# reference_particle_spacing=particle_spacing, viscosity=ArtificialViscosityMonaghan(; alpha, beta=0.0), +# surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.02), +# correction=AkinciFreeSurfaceCorrection(fluid_density), source_terms) # Alternatively can also be used with surface_tension=SurfaceTensionMomentumMorris(surface_tension_coefficient=1.0) fluid_system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index 63a6b07431..f388415728 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -83,24 +83,9 @@ struct EntropicallyDampedSPHSystem{NDIMS, ELTYPE <: Real, IC, M, DC, K, V, COR, cache :: C end -# Keyword-only public front door used by the examples and docs. -function EntropicallyDampedSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - sound_speed, - density_calculator=SummationDensity(), - kwargs...) - return EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, sound_speed; - density_calculator, kwargs...) -end - -# The default constructor needs to be accessible for Adapt.jl to work with this struct. -# See the comments in general/gpu.jl for more details. -function EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, - smoothing_length, sound_speed; +function EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, smoothing_length, + sound_speed, density_calculator=SummationDensity(), pressure_acceleration=inter_particle_averaged_pressure, - density_calculator=SummationDensity(), shifting_technique=nothing, average_pressure_reduction=(!isnothing(shifting_technique)), alpha=0.5, viscosity=nothing, diff --git a/src/schemes/fluid/implicit_incompressible_sph/system.jl b/src/schemes/fluid/implicit_incompressible_sph/system.jl index 410d2b8370..fdbf7056d5 100644 --- a/src/schemes/fluid/implicit_incompressible_sph/system.jl +++ b/src/schemes/fluid/implicit_incompressible_sph/system.jl @@ -62,10 +62,11 @@ struct ImplicitIncompressibleSPHSystem{NDIMS, ELTYPE <: Real, ARRAY1D, ARRAY2D, cache :: C end -function ImplicitIncompressibleSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - reference_density, +# The default constructor needs to be accessible for Adapt.jl to work with this struct. +# See the comments in general/gpu.jl for more details. + +function ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, reference_density, viscosity=nothing, acceleration=ntuple(_ -> 0.0, ndims(smoothing_kernel)), diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index 1dc10d0a48..522f095fa3 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -85,23 +85,9 @@ struct WeaklyCompressibleSPHSystem{NDIMS, ELTYPE <: Real, IC, MA, P, DC, SE, K, cache :: C end -# Keyword-only public front door used by the examples and docs. -function WeaklyCompressibleSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - density_calculator, - state_equation, - kwargs...) - return WeaklyCompressibleSPHSystem(initial_condition, density_calculator, - state_equation, smoothing_kernel, - smoothing_length; kwargs...) -end - -# The default constructor needs to be accessible for Adapt.jl to work with this struct. -# See the comments in general/gpu.jl for more details. -function WeaklyCompressibleSPHSystem(initial_condition, density_calculator, state_equation, - smoothing_kernel, smoothing_length; - acceleration=ntuple(_ -> zero(eltype(initial_condition)), +function WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, density_calculator, + state_equation, acceleration=ntuple(_ -> zero(eltype(initial_condition)), ndims(smoothing_kernel)), viscosity=nothing, density_diffusion=nothing, pressure_acceleration=nothing, diff --git a/src/schemes/structure/discrete_element_method/system.jl b/src/schemes/structure/discrete_element_method/system.jl index 29d76203f0..2f6dbd2e18 100644 --- a/src/schemes/structure/discrete_element_method/system.jl +++ b/src/schemes/structure/discrete_element_method/system.jl @@ -41,6 +41,8 @@ struct DEMSystem{NDIMS, ELTYPE <: Real, IC, ARRAY1D, ST, contact_model :: CM end +# The default constructor needs to be accessible for Adapt.jl to work with this struct. +# See the comments in general/gpu.jl for more details. function DEMSystem(initial_condition; contact_model, damping_coefficient=0.0001, acceleration=ntuple(_ -> 0.0, ndims(initial_condition)), source_terms=nothing, diff --git a/src/schemes/structure/total_lagrangian_sph/system.jl b/src/schemes/structure/total_lagrangian_sph/system.jl index 9b68d42b02..e155921b42 100644 --- a/src/schemes/structure/total_lagrangian_sph/system.jl +++ b/src/schemes/structure/total_lagrangian_sph/system.jl @@ -25,8 +25,8 @@ See [Total Lagrangian SPH](@ref tlsph) for more details on the method. See [Smoothing Kernels](@ref smoothing_kernel). - `young_modulus`: Young's modulus. - `poisson_ratio`: Poisson ratio. -- `clamped_particles`: Indices specifying the clamped particles that are fixed - and not integrated to clamp the structure. +- `clamped_particles`: Indices specifying the clamped particles that are fixed + and not integrated to clamp the structure. - `clamped_particles_motion`: Prescribed motion of the clamped particles. If `nothing` (default), the clamped particles are fixed. See [`PrescribedMotion`](@ref) for details. @@ -99,12 +99,8 @@ struct TotalLagrangianSPHSystem{BM, NDIMS, ELTYPE <: Real, IC, ARRAY1D, ARRAY2D, cache :: C end -function TotalLagrangianSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - young_modulus, - poisson_ratio, - clamped_particles=Int[], +function TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, smoothing_length, + young_modulus, poisson_ratio, clamped_particles=Int[], clamped_particles_motion=nothing, acceleration=ntuple(_ -> zero(eltype(initial_condition)), ndims(smoothing_kernel)), diff --git a/src/setups/rectangular_tank.jl b/src/setups/rectangular_tank.jl index b04090d88c..2b59bbc8b0 100644 --- a/src/setups/rectangular_tank.jl +++ b/src/setups/rectangular_tank.jl @@ -69,7 +69,9 @@ setup = RectangularTank(particle_spacing, (water_width, water_height), # 2D with hydrostatic pressure gradient. # `state_equation` has to be the same as for the WCSPH system. state_equation = StateEquationCole(sound_speed=10.0, exponent=1, reference_density=1000.0) -setup = RectangularTank(particle_spacing, (water_width, water_height), (container_width, container_height), fluid_density; acceleration=(0.0, -9.81), state_equation) +setup = RectangularTank(particle_spacing, (water_width, water_height), + (container_width, container_height), fluid_density; + acceleration=(0.0, -9.81), state_equation) # 3D setup = RectangularTank(particle_spacing, (water_width, water_height, water_depth), diff --git a/test/general/density_calculator.jl b/test/general/density_calculator.jl index 1d61c79819..f6057f0598 100644 --- a/test/general/density_calculator.jl +++ b/test/general/density_calculator.jl @@ -13,9 +13,10 @@ exponent=7) viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) - fluid_system = WeaklyCompressibleSPHSystem(initial_condition, SummationDensity(), - state_equation, smoothing_kernel, - smoothing_length; viscosity) + fluid_system = WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, + density_calculator=SummationDensity(), + state_equation, viscosity) (; cache) = fluid_system (; density) = cache # Density is in the cache for SummationDensity diff --git a/test/general/interpolation.jl b/test/general/interpolation.jl index 5ac7e888cf..7bffc86272 100644 --- a/test/general/interpolation.jl +++ b/test/general/interpolation.jl @@ -100,9 +100,10 @@ viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) - fluid_system = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length; viscosity, + fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation, viscosity, acceleration=(0.0, -9.81)) boundary_model = BoundaryModelDummyParticles(bnd.density, bnd.mass, @@ -643,9 +644,10 @@ viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) - fluid_system = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length; viscosity, + fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation, viscosity, acceleration=(0.0, -9.81, 0.0)) boundary_model = BoundaryModelDummyParticles(bnd.density, bnd.mass, diff --git a/test/general/semidiscretization.jl b/test/general/semidiscretization.jl index a6ddd5f438..12869fbe59 100644 --- a/test/general/semidiscretization.jl +++ b/test/general/semidiscretization.jl @@ -131,8 +131,10 @@ boundary_model = BoundaryModelDummyParticles(ic.density, ic.mass, SummationDensity(), kernel, 1.0) boundary_system = WallBoundarySystem(ic, boundary_model) - fluid_system = WeaklyCompressibleSPHSystem(ic, SummationDensity(), nothing, - kernel, 1.0) + fluid_system = WeaklyCompressibleSPHSystem(ic; smoothing_kernel=kernel, + smoothing_length=1.0, + density_calculator=SummationDensity(), + state_equation=nothing) error_str = "`WeaklyCompressibleSPHSystem` cannot be used without setting a " * "`state_equation` for all boundary models" diff --git a/test/schemes/boundary/dummy_particles/dummy_particles.jl b/test/schemes/boundary/dummy_particles/dummy_particles.jl index caf34a1c52..3511b59ba6 100644 --- a/test/schemes/boundary/dummy_particles/dummy_particles.jl +++ b/test/schemes/boundary/dummy_particles/dummy_particles.jl @@ -80,11 +80,10 @@ ] # Create fluid system - fluid_system = WeaklyCompressibleSPHSystem(fluid, - SummationDensity(), - state_equation, - smoothing_kernel, - smoothing_length) + fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=SummationDensity(), + state_equation) velocities = [ [0.0; -1.0], @@ -245,9 +244,10 @@ # Use constant density equal to the reference density of the state equation, # so that the pressure is constant zero. Then we test that the extrapolation also yields zero. @testset "Constant Zero Pressure" begin - fluid_system1 = WeaklyCompressibleSPHSystem(tank1.fluid, SummationDensity(), - state_equation, - smoothing_kernel, smoothing_length) + fluid_system1 = WeaklyCompressibleSPHSystem(tank1.fluid; smoothing_kernel, + smoothing_length, + density_calculator=SummationDensity(), + state_equation) fluid_system1.cache.density .= tank1.fluid.density v_fluid = zeros(2, TrixiParticles.nparticles(fluid_system1)) @@ -283,9 +283,10 @@ tank2 = RectangularTank(particle_spacing, (width, height), (width, height), density; n_layers, faces=(true, true, true, false)) - fluid_system2 = WeaklyCompressibleSPHSystem(tank2.fluid, SummationDensity(), - state_equation, - smoothing_kernel, smoothing_length) + fluid_system2 = WeaklyCompressibleSPHSystem(tank2.fluid; smoothing_kernel, + smoothing_length, + density_calculator=SummationDensity(), + state_equation) fluid_system2.cache.density .= tank2.fluid.density v_fluid = zeros(2, TrixiParticles.nparticles(fluid_system2)) @@ -324,10 +325,11 @@ density; acceleration=[0.0, -9.81], state_equation, n_layers, faces=(true, true, true, false)) - fluid_system3 = WeaklyCompressibleSPHSystem(tank3.fluid, SummationDensity(), - state_equation, + fluid_system3 = WeaklyCompressibleSPHSystem(tank3.fluid; smoothing_kernel, smoothing_length, + density_calculator=SummationDensity(), + state_equation, acceleration=[0.0, -9.81]) fluid_system3.cache.density .= tank3.fluid.density v_fluid = zeros(2, TrixiParticles.nparticles(fluid_system3)) diff --git a/test/schemes/boundary/dummy_particles/rhs.jl b/test/schemes/boundary/dummy_particles/rhs.jl index 1242b1e80a..5fe01a743f 100644 --- a/test/schemes/boundary/dummy_particles/rhs.jl +++ b/test/schemes/boundary/dummy_particles/rhs.jl @@ -17,11 +17,11 @@ # Create several neighbor systems to test fluid-neighbor interaction function second_systems(initial_condition, density_calculator, state_equation, smoothing_kernel, smoothing_length) - second_fluid_system = WeaklyCompressibleSPHSystem(initial_condition, - density_calculator, - state_equation, + second_fluid_system = WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, - smoothing_length) + smoothing_length, + density_calculator, + state_equation) # Overwrite `second_fluid_system.pressure` because we skip the update step second_fluid_system.pressure .= initial_condition.pressure @@ -147,11 +147,11 @@ ic.pressure[(center_particle + 1):end], ic.particle_spacing) - fluid_system = WeaklyCompressibleSPHSystem(fluid, - density_calculator, - state_equation, + fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, - smoothing_length) + smoothing_length, + density_calculator, + state_equation) n_particles = TrixiParticles.nparticles(fluid_system) # Overwrite `fluid_system.pressure` because we skip the update step diff --git a/test/schemes/boundary/monaghan_kajtar/monaghan_kajtar.jl b/test/schemes/boundary/monaghan_kajtar/monaghan_kajtar.jl index d5c0042c28..ec303dd021 100644 --- a/test/schemes/boundary/monaghan_kajtar/monaghan_kajtar.jl +++ b/test/schemes/boundary/monaghan_kajtar/monaghan_kajtar.jl @@ -22,9 +22,10 @@ fluid = rectangular_patch(particle_spacing, (3, 3), perturbation_factor=0.0, perturbation_factor_position=0.0, offset=(-1.5particle_spacing, 0.0)) - fluid_system = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length) + fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation) # Use double spacing for the boundary (exactly the opposite of what we would do # in a simulation) to test that forces grow infinitely when a fluid particle diff --git a/test/schemes/boundary/open_boundary/characteristic_variables.jl b/test/schemes/boundary/open_boundary/characteristic_variables.jl index 58a76ae8f1..7e169a2342 100644 --- a/test/schemes/boundary/open_boundary/characteristic_variables.jl +++ b/test/schemes/boundary/open_boundary/characteristic_variables.jl @@ -55,13 +55,13 @@ sign_ = (TrixiParticles.boundary_type_name(boundary_zone) == "inflow") ? 1 : -1 fluid = extrude_geometry(face_vertices; particle_spacing, n_extrude=4, - density, pressure, - direction=(sign_ * flow_direction)) + density, pressure, direction=(sign_ * flow_direction)) - fluid_system = EntropicallyDampedSPHSystem(fluid, smoothing_kernel, + fluid_system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel, + smoothing_length, + sound_speed, buffer_size=0, - density_calculator=ContinuityDensity(), - smoothing_length, sound_speed) + density_calculator=ContinuityDensity()) boundary_system = OpenBoundarySystem(boundary_zone; fluid_system, buffer_size=0, @@ -148,9 +148,11 @@ inflow = BoundaryZone(; boundary_face, boundary_type=InFlow(), face_normal, open_boundary_layers=10, density=1.0, particle_spacing) - system_wcsph = WeaklyCompressibleSPHSystem(initial_condition, ContinuityDensity(), - nothing, - SchoenbergCubicSplineKernel{n_dims}(), 1) + system_wcsph = WeaklyCompressibleSPHSystem(initial_condition; + smoothing_kernel=SchoenbergCubicSplineKernel{n_dims}(), + smoothing_length=1, + density_calculator=ContinuityDensity(), + state_equation=nothing) open_boundary_wcsph = OpenBoundarySystem(inflow; fluid_system=system_wcsph, buffer_size=0, @@ -158,9 +160,10 @@ @test TrixiParticles.v_nvariables(open_boundary_wcsph) == n_dims - system_edac = EntropicallyDampedSPHSystem(initial_condition, - SchoenbergCubicSplineKernel{n_dims}(), - 1.0, 1.0) + system_edac = EntropicallyDampedSPHSystem(initial_condition; + smoothing_kernel=SchoenbergCubicSplineKernel{n_dims}(), + smoothing_length=1.0, + sound_speed=1.0) open_boundary_edac = OpenBoundarySystem(inflow; fluid_system=system_edac, buffer_size=0, diff --git a/test/schemes/boundary/open_boundary/dynamical_pressure.jl b/test/schemes/boundary/open_boundary/dynamical_pressure.jl index 4e400ecd1b..bd325eb690 100644 --- a/test/schemes/boundary/open_boundary/dynamical_pressure.jl +++ b/test/schemes/boundary/open_boundary/dynamical_pressure.jl @@ -31,12 +31,14 @@ density=1.0, particle_spacing) bz.initial_condition.mass .= ic.mass - system_wcsph = WeaklyCompressibleSPHSystem(ic, density_calculator, - state_equation, smoothing_kernel, - smoothing_length) - - system_edac = EntropicallyDampedSPHSystem(ic, smoothing_kernel, - smoothing_length, 0.0; + system_wcsph = WeaklyCompressibleSPHSystem(ic; smoothing_kernel, + smoothing_length, + density_calculator, + state_equation) + + system_edac = EntropicallyDampedSPHSystem(ic; smoothing_kernel, + smoothing_length, + sound_speed=0.0, pressure_acceleration=nothing, density_calculator) @@ -126,9 +128,11 @@ inflow = BoundaryZone(; boundary_face, boundary_type=InFlow(), face_normal, open_boundary_layers=10, density=1.0, particle_spacing) - system_wcsph = WeaklyCompressibleSPHSystem(initial_condition, ContinuityDensity(), - nothing, - SchoenbergCubicSplineKernel{n_dims}(), 1) + system_wcsph = WeaklyCompressibleSPHSystem(initial_condition; + smoothing_kernel=SchoenbergCubicSplineKernel{n_dims}(), + smoothing_length=1, + density_calculator=ContinuityDensity(), + state_equation=nothing) open_boundary_wcsph = OpenBoundarySystem(inflow; fluid_system=system_wcsph, buffer_size=0, @@ -138,9 +142,10 @@ @test TrixiParticles.v_nvariables(open_boundary_wcsph) == n_dims + 1 # EDAC with `SummationDensity` - system_edac_1 = EntropicallyDampedSPHSystem(initial_condition, - SchoenbergCubicSplineKernel{n_dims}(), - 1.0, 1.0) + system_edac_1 = EntropicallyDampedSPHSystem(initial_condition; + smoothing_kernel=SchoenbergCubicSplineKernel{n_dims}(), + smoothing_length=1.0, + sound_speed=1.0) open_boundary_edac_1 = OpenBoundarySystem(inflow; fluid_system=system_edac_1, buffer_size=0, @@ -150,9 +155,10 @@ @test TrixiParticles.v_nvariables(open_boundary_edac_1) == n_dims + 2 # EDAC with `ContinuityDensity` - system_edac_2 = EntropicallyDampedSPHSystem(initial_condition, - SchoenbergCubicSplineKernel{n_dims}(), - 1.0, 1.0, + system_edac_2 = EntropicallyDampedSPHSystem(initial_condition; + smoothing_kernel=SchoenbergCubicSplineKernel{n_dims}(), + smoothing_length=1.0, + sound_speed=1.0, density_calculator=ContinuityDensity()) open_boundary_edac_2 = OpenBoundarySystem(inflow; fluid_system=system_edac_2, diff --git a/test/schemes/boundary/open_boundary/mirroring.jl b/test/schemes/boundary/open_boundary/mirroring.jl index 0bea0a42ee..d9e41ee0a2 100644 --- a/test/schemes/boundary/open_boundary/mirroring.jl +++ b/test/schemes/boundary/open_boundary/mirroring.jl @@ -49,8 +49,8 @@ smoothing_length = 1.5 * particle_spacing smoothing_kernel = WendlandC2Kernel{ndims(domain_fluid)}() - fluid_system = EntropicallyDampedSPHSystem(domain_fluid, smoothing_kernel, - smoothing_length, 1.0) + fluid_system = EntropicallyDampedSPHSystem(domain_fluid; smoothing_kernel, + smoothing_length, sound_speed=1.0) fluid_system.cache.density .= domain_fluid.density @@ -145,8 +145,8 @@ smoothing_length = 1.5 * particle_spacing smoothing_kernel = WendlandC2Kernel{ndims(domain_fluid)}() - fluid_system = EntropicallyDampedSPHSystem(domain_fluid, smoothing_kernel, - smoothing_length, 1.0) + fluid_system = EntropicallyDampedSPHSystem(domain_fluid; smoothing_kernel, + smoothing_length, sound_speed=1.0) fluid_system.cache.density .= domain_fluid.density @@ -213,8 +213,8 @@ smoothing_length = 1.5 * particle_spacing smoothing_kernel = WendlandC2Kernel{ndims(domain_fluid)}() - fluid_system = EntropicallyDampedSPHSystem(domain_fluid, smoothing_kernel, - smoothing_length, 1.0) + fluid_system = EntropicallyDampedSPHSystem(domain_fluid; smoothing_kernel, + smoothing_length, sound_speed=1.0) fluid_system.cache.density .= 1000.0 if i == 2 @@ -269,8 +269,9 @@ smoothing_length = 1.2 * particle_spacing smoothing_kernel = WendlandC2Kernel{2}() - fluid_system = EntropicallyDampedSPHSystem(domain_fluid, smoothing_kernel, - smoothing_length, 1.0) + fluid_system = EntropicallyDampedSPHSystem(domain_fluid; smoothing_kernel, + smoothing_length, + sound_speed=1.0) fluid_system.cache.density .= domain_fluid.density @@ -348,10 +349,11 @@ smoothing_kernel = WendlandC2Kernel{2}() # Use a temporary fluid system just to interpolate the pressure - interpolation_system = WeaklyCompressibleSPHSystem(entire_domain, - ContinuityDensity(), - nothing, smoothing_kernel, - smoothing_length) + interpolation_system = WeaklyCompressibleSPHSystem(entire_domain; + smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation=nothing) interpolation_system.pressure .= entire_domain.pressure semi = Semidiscretization(interpolation_system) @@ -551,9 +553,11 @@ inflow = BoundaryZone(; boundary_face, boundary_type=InFlow(), face_normal, open_boundary_layers=10, density=1.0, particle_spacing) - system_wcsph = WeaklyCompressibleSPHSystem(initial_condition, ContinuityDensity(), - nothing, - SchoenbergCubicSplineKernel{n_dims}(), 1) + system_wcsph = WeaklyCompressibleSPHSystem(initial_condition; + smoothing_kernel=SchoenbergCubicSplineKernel{n_dims}(), + smoothing_length=1, + density_calculator=ContinuityDensity(), + state_equation=nothing) open_boundary_wcsph = OpenBoundarySystem(inflow; fluid_system=system_wcsph, buffer_size=0, @@ -561,10 +565,10 @@ @test TrixiParticles.v_nvariables(open_boundary_wcsph) == n_dims - system_edac_1 = EntropicallyDampedSPHSystem(initial_condition, - SchoenbergCubicSplineKernel{n_dims}(), - 1.0, - 1.0) + system_edac_1 = EntropicallyDampedSPHSystem(initial_condition; + smoothing_kernel=SchoenbergCubicSplineKernel{n_dims}(), + smoothing_length=1.0, + sound_speed=1.0) open_boundary_edac_1 = OpenBoundarySystem(inflow; fluid_system=system_edac_1, buffer_size=0, diff --git a/test/schemes/boundary/open_boundary/open_boundary.jl b/test/schemes/boundary/open_boundary/open_boundary.jl index 43b4bd7cd6..80b4da4e8f 100644 --- a/test/schemes/boundary/open_boundary/open_boundary.jl +++ b/test/schemes/boundary/open_boundary/open_boundary.jl @@ -16,8 +16,8 @@ include("pressure_model.jl") smoothing_length = 1.3 * particle_spacing smoothing_kernel = WendlandC2Kernel{ndims(fluid)}() - fluid_system = EntropicallyDampedSPHSystem(fluid, smoothing_kernel, smoothing_length, - 1.0) + fluid_system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel, + smoothing_length, sound_speed=1.0) fluid_system.cache.density .= fluid.density # Use a smaller cross-sectional area to test user-defined area functionality diff --git a/test/schemes/fluid/rhs.jl b/test/schemes/fluid/rhs.jl index 89010d6e65..20e7e6330a 100644 --- a/test/schemes/fluid/rhs.jl +++ b/test/schemes/fluid/rhs.jl @@ -58,16 +58,17 @@ "IISPH" ] if system_name == "WCSPH" - system = WeaklyCompressibleSPHSystem(fluid, + system = WeaklyCompressibleSPHSystem(fluid; + smoothing_kernel, + smoothing_length, density_calculator, state_equation, - smoothing_kernel, - smoothing_length; pressure_acceleration) elseif system_name == "EDAC" - system = EntropicallyDampedSPHSystem(fluid, + system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel, - smoothing_length, 0.0; + smoothing_length, + sound_speed=0.0, density_calculator, pressure_acceleration) elseif system_name == "IISPH" @@ -131,12 +132,14 @@ # A larger number of particles will increase accumulated errors in the # summation. A larger tolerance has to be used for the tests below. fluid = rectangular_patch(particle_spacing, (3, 3); seed) - system_wcsph = WeaklyCompressibleSPHSystem(fluid, density_calculator, - state_equation, smoothing_kernel, - smoothing_length) - - system_edac = EntropicallyDampedSPHSystem(fluid, smoothing_kernel, - smoothing_length, 0.0; + system_wcsph = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator, + state_equation) + + system_edac = EntropicallyDampedSPHSystem(fluid; smoothing_kernel, + smoothing_length, + sound_speed=0.0, pressure_acceleration=nothing, density_calculator) diff --git a/test/schemes/fluid/surface_normal_sph.jl b/test/schemes/fluid/surface_normal_sph.jl index ee46b6c60a..5eb8a81704 100644 --- a/test/schemes/fluid/surface_normal_sph.jl +++ b/test/schemes/fluid/surface_normal_sph.jl @@ -73,8 +73,9 @@ function create_fluid_system(coordinates, velocity, mass, density, particle_spac reference_density=1000.0, exponent=1) - system = WeaklyCompressibleSPHSystem(fluid, SummationDensity(), state_equation, - smoothing_kernel, smoothing_length; + system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, smoothing_length, + density_calculator=SummationDensity(), + state_equation, surface_normal_method, reference_particle_spacing=particle_spacing, surface_tension) diff --git a/test/schemes/fluid/surface_tension.jl b/test/schemes/fluid/surface_tension.jl index ab5abae780..7fe8abbd97 100644 --- a/test/schemes/fluid/surface_tension.jl +++ b/test/schemes/fluid/surface_tension.jl @@ -110,11 +110,10 @@ smoothing_length = 0.5 # 3. Create the WeaklyCompressibleSPHSystem with Surface Tension - system = WeaklyCompressibleSPHSystem(ic, - density_calc, - eq_state, - kernel, - smoothing_length; + system = WeaklyCompressibleSPHSystem(ic; smoothing_kernel=kernel, + smoothing_length, + density_calculator=density_calc, + state_equation=eq_state, surface_tension=SurfaceTensionMomentumMorris(surface_tension_coefficient=1.0), surface_normal_method=ColorfieldSurfaceNormal(interface_threshold=0.1, ideal_density_threshold=0.9), diff --git a/test/schemes/fluid/viscosity.jl b/test/schemes/fluid/viscosity.jl index cd2bd30257..9163bbb588 100644 --- a/test/schemes/fluid/viscosity.jl +++ b/test/schemes/fluid/viscosity.jl @@ -18,9 +18,10 @@ @testset verbose=true "`ArtificialViscosityMonaghan`" begin viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0) - system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length; viscosity) + system_wcsph = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation, viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -42,9 +43,10 @@ @testset verbose=true "`ViscosityMorris`" begin nu = 7e-3 viscosity = ViscosityMorris(; nu) - system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length; viscosity) + system_wcsph = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation, viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -71,9 +73,10 @@ end @testset verbose=true "`ViscosityAdami`" begin viscosity = ViscosityAdami(nu=7e-3) - system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length; viscosity) + system_wcsph = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation, viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -101,9 +104,10 @@ @testset verbose=true "`ViscosityMorrisSGS`" begin nu = 7e-3 viscosity = ViscosityMorrisSGS(; nu) - system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length; viscosity) + system_wcsph = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation, viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -131,9 +135,10 @@ end @testset verbose=true "`ViscosityAdamiSGS`" begin viscosity = ViscosityAdamiSGS(nu=7e-3) - system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length; viscosity) + system_wcsph = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation, viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -178,9 +183,10 @@ a=2.0, n=1.0, epsilon=0.01) - system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length; viscosity) + system_wcsph = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation, viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) @@ -204,9 +210,10 @@ a=2.0, n=0.3, epsilon=0.01) - system_wcsph = WeaklyCompressibleSPHSystem(fluid, ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length; viscosity) + system_wcsph = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation, viscosity) grad_kernel = TrixiParticles.smoothing_kernel_grad(system_wcsph, pos_diff, distance, 1) diff --git a/test/systems/edac_system.jl b/test/systems/edac_system.jl index 3b462555ae..ce04cd6774 100644 --- a/test/systems/edac_system.jl +++ b/test/systems/edac_system.jl @@ -24,10 +24,8 @@ initial_condition = InitialCondition(; coordinates, mass, density) - system = EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, + system = EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, smoothing_length, sound_speed) - system_keywords = EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, - smoothing_length, sound_speed) @test system isa EntropicallyDampedSPHSystem{NDIMS} @test system.initial_condition == initial_condition @@ -38,28 +36,16 @@ @test system.viscosity === nothing @test system.nu_edac == (0.5 * smoothing_length * sound_speed) / 8 @test system.acceleration == [0.0 for _ in 1:NDIMS] - @test system_keywords isa EntropicallyDampedSPHSystem{NDIMS} - @test system_keywords.initial_condition == system.initial_condition - @test system_keywords.mass == system.mass - @test system_keywords.density_calculator == system.density_calculator - @test system_keywords.smoothing_kernel == system.smoothing_kernel - @test TrixiParticles.initial_smoothing_length(system_keywords) == - TrixiParticles.initial_smoothing_length(system) - @test system_keywords.shifting_technique isa Nothing - @test system_keywords.viscosity === system.viscosity - @test system_keywords.nu_edac == system.nu_edac - @test system_keywords.acceleration == system.acceleration - error_str1 = "`acceleration` must be of length $NDIMS for a $(NDIMS)D problem" - @test_throws ArgumentError(error_str1) EntropicallyDampedSPHSystem(initial_condition, + @test_throws ArgumentError(error_str1) EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, smoothing_length, sound_speed, acceleration=(0.0)) error_str2 = "smoothing kernel dimensionality must be $NDIMS for a $(NDIMS)D problem" - @test_throws ArgumentError(error_str2) EntropicallyDampedSPHSystem(initial_condition, - smoothing_kernel2, + @test_throws ArgumentError(error_str2) EntropicallyDampedSPHSystem(initial_condition; + smoothing_kernel=smoothing_kernel2, smoothing_length, sound_speed) end @@ -92,8 +78,8 @@ smoothing_length = 0.362 sound_speed = 10.0 - system = EntropicallyDampedSPHSystem(setup, smoothing_kernel, smoothing_length, - sound_speed) + system = EntropicallyDampedSPHSystem(setup; smoothing_kernel, + smoothing_length, sound_speed) @test system isa EntropicallyDampedSPHSystem{NDIMS} @test system.initial_condition == setup @@ -118,7 +104,7 @@ sound_speed = 10.0 error_str = "`acceleration` must be of length $NDIMS for a $(NDIMS)D problem" - @test_throws ArgumentError(error_str) EntropicallyDampedSPHSystem(setup, + @test_throws ArgumentError(error_str) EntropicallyDampedSPHSystem(setup; smoothing_kernel, smoothing_length, sound_speed, @@ -138,7 +124,7 @@ sound_speed = 10.0 initial_condition = InitialCondition(; coordinates, mass, density) - system = EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, + system = EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, smoothing_length, sound_speed) show_compact = "EntropicallyDampedSPHSystem{2}(SummationDensity(), nothing, nothing, Val{:smoothing_kernel}(), [0.0, 0.0], nothing, nothing) with 2 particles" @@ -174,7 +160,7 @@ sound_speed = 10.0 initial_condition = InitialCondition(; coordinates, mass, density, pressure) - system = EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, + system = EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, smoothing_length, sound_speed) u0 = zeros(TrixiParticles.u_nvariables(system), @@ -200,7 +186,7 @@ initial_condition = InitialCondition(; coordinates, velocity, mass, density, pressure) - system = EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, + system = EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, smoothing_length, sound_speed) v0 = zeros(TrixiParticles.v_nvariables(system), @@ -217,7 +203,7 @@ initial_condition = InitialCondition(; coordinates, velocity, mass, density, pressure=pressure_function) - system = EntropicallyDampedSPHSystem(initial_condition, smoothing_kernel, + system = EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, smoothing_length, sound_speed) v0 = zeros(TrixiParticles.v_nvariables(system), @@ -237,10 +223,10 @@ transport_velocity = [nothing, TransportVelocityAdami(background_pressure=10000.0)] names = ["No TVF", "TransportVelocityAdami"] @testset "$(names[i])" for i in eachindex(transport_velocity) - system = EntropicallyDampedSPHSystem(fluid, smoothing_kernel, + system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel, + smoothing_length, sound_speed=0.0, shifting_technique=transport_velocity[i], - average_pressure_reduction=true, - smoothing_length, 0.0) + average_pressure_reduction=true) semi = Semidiscretization(system) TrixiParticles.initialize_neighborhood_searches!(semi) diff --git a/test/systems/rigid_system.jl b/test/systems/rigid_system.jl index 3ee2e355e5..3f768db542 100644 --- a/test/systems/rigid_system.jl +++ b/test/systems/rigid_system.jl @@ -451,9 +451,10 @@ smoothing_length = 0.12 state_equation = StateEquationCole(; sound_speed=10.0, reference_density=1000.0, exponent=7.0) - fluid_system = WeaklyCompressibleSPHSystem(rigid_ic, SummationDensity(), - state_equation, smoothing_kernel, - smoothing_length) + fluid_system = WeaklyCompressibleSPHSystem(rigid_ic; smoothing_kernel, + smoothing_length, + density_calculator=SummationDensity(), + state_equation) @test_throws ArgumentError Semidiscretization(fluid_system, rigid_system) @@ -463,11 +464,11 @@ smoothing_length) rigid_system_with_dummy = RigidBodySystem(rigid_ic; boundary_model=rigid_boundary_model) - fluid_with_surface_tension = WeaklyCompressibleSPHSystem(rigid_ic, - SummationDensity(), - state_equation, + fluid_with_surface_tension = WeaklyCompressibleSPHSystem(rigid_ic; smoothing_kernel, - smoothing_length; + smoothing_length, + density_calculator=SummationDensity(), + state_equation, surface_tension=SurfaceTensionMorris(surface_tension_coefficient=0.072), reference_particle_spacing=0.1) @@ -494,10 +495,10 @@ mass=[particle_volume * fluid_density], density=[fluid_density], particle_spacing) - fluid_system = WeaklyCompressibleSPHSystem(fluid_ic, SummationDensity(), + fluid_system = WeaklyCompressibleSPHSystem(fluid_ic; smoothing_kernel, + smoothing_length, + density_calculator=SummationDensity(), state_equation, - smoothing_kernel, - smoothing_length; surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.05), reference_particle_spacing=particle_spacing) @@ -604,8 +605,10 @@ mass=[particle_volume * fluid_density], density=[fluid_density], particle_spacing) - WeaklyCompressibleSPHSystem(fluid_ic, SummationDensity(), state_equation, - smoothing_kernel, smoothing_length) + WeaklyCompressibleSPHSystem(fluid_ic; smoothing_kernel, + smoothing_length, + density_calculator=SummationDensity(), + state_equation) end semi = Semidiscretization(fluid_systems..., rigid_system) @@ -674,10 +677,10 @@ velocity=zeros(2, 1), mass=[particle_volume * fluid_density], density=[fluid_density], particle_spacing) - fluid_system = WeaklyCompressibleSPHSystem(fluid_support_ic, SummationDensity(), - state_equation, - smoothing_kernel, - smoothing_length) + fluid_system = WeaklyCompressibleSPHSystem(fluid_support_ic; smoothing_kernel, + smoothing_length, + density_calculator=SummationDensity(), + state_equation) boundary_face = ([2.0, -0.5], [2.0, 0.5]) zone = BoundaryZone(; boundary_face, face_normal=(1.0, 0.0), density=fluid_density, diff --git a/test/systems/wcsph_system.jl b/test/systems/wcsph_system.jl index 8af6b5031b..89217f1d84 100644 --- a/test/systems/wcsph_system.jl +++ b/test/systems/wcsph_system.jl @@ -30,15 +30,11 @@ smoothing_length = 0.362 initial_condition = InitialCondition(; coordinates, mass, density) - system = WeaklyCompressibleSPHSystem(initial_condition, + system = WeaklyCompressibleSPHSystem(initial_condition; + smoothing_kernel, + smoothing_length, density_calculator, - state_equation, smoothing_kernel, - smoothing_length) - system_keywords = WeaklyCompressibleSPHSystem(initial_condition; - smoothing_kernel, - smoothing_length, - density_calculator, - state_equation) + state_equation) @test system isa WeaklyCompressibleSPHSystem{NDIMS} @test system.initial_condition == initial_condition @@ -49,36 +45,24 @@ @test TrixiParticles.initial_smoothing_length(system) == smoothing_length @test system.viscosity === nothing @test system.acceleration == [0.0 for _ in 1:NDIMS] - @test system_keywords isa WeaklyCompressibleSPHSystem{NDIMS} - @test system_keywords.initial_condition == system.initial_condition - @test system_keywords.mass == system.mass - @test system_keywords.density_calculator == system.density_calculator - @test system_keywords.state_equation == system.state_equation - @test system_keywords.smoothing_kernel == system.smoothing_kernel - @test TrixiParticles.initial_smoothing_length(system_keywords) == - TrixiParticles.initial_smoothing_length(system) - @test system_keywords.viscosity === system.viscosity - @test system_keywords.acceleration == system.acceleration - if density_calculator isa SummationDensity @test length(system.cache.density) == size(coordinates, 2) - @test length(system_keywords.cache.density) == size(coordinates, 2) end error_str1 = "`acceleration` must be of length $NDIMS for a $(NDIMS)D problem" - @test_throws ArgumentError(error_str1) WeaklyCompressibleSPHSystem(initial_condition, - density_calculator, - state_equation, + @test_throws ArgumentError(error_str1) WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, + density_calculator, + state_equation, acceleration=(0.0)) error_str2 = "smoothing kernel dimensionality must be $NDIMS for a $(NDIMS)D problem" - @test_throws ArgumentError(error_str2) WeaklyCompressibleSPHSystem(initial_condition, + @test_throws ArgumentError(error_str2) WeaklyCompressibleSPHSystem(initial_condition; + smoothing_kernel=smoothing_kernel2, + smoothing_length, density_calculator, - state_equation, - smoothing_kernel2, - smoothing_length) + state_equation) end end end @@ -137,17 +121,18 @@ if density_calculator isa ContinuityDensity && corr isa ShepardKernelCorrection error_str = "`ShepardKernelCorrection` cannot be used with `ContinuityDensity`" - @test_throws ArgumentError(error_str) WeaklyCompressibleSPHSystem(setup, - density_calculator, - state_equation, + @test_throws ArgumentError(error_str) WeaklyCompressibleSPHSystem(setup; smoothing_kernel, smoothing_length, + density_calculator, + state_equation, correction=corr) continue end - system = WeaklyCompressibleSPHSystem(setup, density_calculator, - state_equation, smoothing_kernel, + system = WeaklyCompressibleSPHSystem(setup; smoothing_kernel, smoothing_length, + density_calculator, + state_equation, correction=corr) @test system isa WeaklyCompressibleSPHSystem{NDIMS} @@ -185,11 +170,11 @@ density_calculators error_str = "`acceleration` must be of length $NDIMS for a $(NDIMS)D problem" - @test_throws ArgumentError(error_str) WeaklyCompressibleSPHSystem(setup, - density_calculator, - state_equation, + @test_throws ArgumentError(error_str) WeaklyCompressibleSPHSystem(setup; smoothing_kernel, smoothing_length, + density_calculator, + state_equation, acceleration=(0.0)) end end @@ -209,9 +194,9 @@ density_diffusion = Val(:density_diffusion) initial_condition = InitialCondition(; coordinates, mass, density) - system = WeaklyCompressibleSPHSystem(initial_condition, density_calculator, - state_equation, smoothing_kernel, - smoothing_length; density_diffusion) + system = WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, density_calculator, + state_equation, density_diffusion) show_compact = "WeaklyCompressibleSPHSystem{2}(SummationDensity(), nothing, Val{:state_equation}(), Val{:smoothing_kernel}(), nothing, Val{:density_diffusion}(), nothing, nothing, nothing, [0.0, 0.0], nothing) with 2 particles" @test repr(system) == show_compact @@ -246,10 +231,9 @@ density_calculator = SummationDensity() initial_condition = InitialCondition(; coordinates, mass, density) - system = WeaklyCompressibleSPHSystem(initial_condition, - density_calculator, - state_equation, smoothing_kernel, - smoothing_length) + system = WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, density_calculator, + state_equation) u0 = zeros(TrixiParticles.u_nvariables(system), TrixiParticles.n_integrated_particles(system)) @@ -271,10 +255,10 @@ initial_condition = InitialCondition(; coordinates, velocity, mass, density) # SummationDensity - system = WeaklyCompressibleSPHSystem(initial_condition, - SummationDensity(), - state_equation, smoothing_kernel, - smoothing_length) + system = WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, + density_calculator=SummationDensity(), + state_equation) v0 = zeros(TrixiParticles.v_nvariables(system), TrixiParticles.n_integrated_particles(system)) @@ -289,10 +273,10 @@ @test TrixiParticles.current_pressure(v0, system) == system.pressure # ContinuityDensity - system = WeaklyCompressibleSPHSystem(initial_condition, - ContinuityDensity(), - state_equation, smoothing_kernel, - smoothing_length) + system = WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, + smoothing_length, + density_calculator=ContinuityDensity(), + state_equation) v0 = zeros(TrixiParticles.v_nvariables(system), TrixiParticles.n_integrated_particles(system)) diff --git a/validation/dam_break_2d/setup_marrone_2011.jl b/validation/dam_break_2d/setup_marrone_2011.jl index 6c0374a3b7..9d4e5a2ef8 100644 --- a/validation/dam_break_2d/setup_marrone_2011.jl +++ b/validation/dam_break_2d/setup_marrone_2011.jl @@ -81,7 +81,7 @@ if use_edac fluid_density; n_layers=boundary_layers, spacing_ratio, acceleration=(0.0, -gravity), state_equation=nothing) - fluid_system = EntropicallyDampedSPHSystem(tank_edac.fluid, smoothing_kernel, + fluid_system = EntropicallyDampedSPHSystem(tank_edac.fluid; smoothing_kernel, smoothing_length, sound_speed, viscosity=viscosity_fluid, density_calculator=ContinuityDensity(), From 27278c0392fef3f40d17c55def69817115089828 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 13:44:46 +0200 Subject: [PATCH 49/56] format --- src/schemes/fluid/weakly_compressible_sph/system.jl | 3 ++- .../schemes/boundary/open_boundary/characteristic_variables.jl | 3 ++- test/schemes/structure/total_lagrangian_sph/rhs.jl | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index 522f095fa3..ef0f0d6497 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -87,7 +87,8 @@ end function WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, density_calculator, - state_equation, acceleration=ntuple(_ -> zero(eltype(initial_condition)), + state_equation, + acceleration=ntuple(_ -> zero(eltype(initial_condition)), ndims(smoothing_kernel)), viscosity=nothing, density_diffusion=nothing, pressure_acceleration=nothing, diff --git a/test/schemes/boundary/open_boundary/characteristic_variables.jl b/test/schemes/boundary/open_boundary/characteristic_variables.jl index 7e169a2342..9d2e9fa03e 100644 --- a/test/schemes/boundary/open_boundary/characteristic_variables.jl +++ b/test/schemes/boundary/open_boundary/characteristic_variables.jl @@ -55,7 +55,8 @@ sign_ = (TrixiParticles.boundary_type_name(boundary_zone) == "inflow") ? 1 : -1 fluid = extrude_geometry(face_vertices; particle_spacing, n_extrude=4, - density, pressure, direction=(sign_ * flow_direction)) + density, pressure, + direction=(sign_ * flow_direction)) fluid_system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel, smoothing_length, diff --git a/test/schemes/structure/total_lagrangian_sph/rhs.jl b/test/schemes/structure/total_lagrangian_sph/rhs.jl index 225ea8afd4..e0abb48e4a 100644 --- a/test/schemes/structure/total_lagrangian_sph/rhs.jl +++ b/test/schemes/structure/total_lagrangian_sph/rhs.jl @@ -163,7 +163,7 @@ system = TotalLagrangianSPHSystem(initial_condition; smoothing_kernel, smoothing_length, young_modulus=E, poisson_ratio=nu) -tspan = (0.0, 1.0) + tspan = (0.0, 1.0) names = ["CPU code", "GPU code emulated on the CPU"] backends = [SerialBackend(), TrixiParticles.KernelAbstractions.CPU()] From cb2a64042f6cfe787a16bd5639015d1f550799ba Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 14:15:44 +0200 Subject: [PATCH 50/56] fix test --- test/callbacks/solution_saving.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/callbacks/solution_saving.jl b/test/callbacks/solution_saving.jl index c82df25de2..8e32af8f06 100644 --- a/test/callbacks/solution_saving.jl +++ b/test/callbacks/solution_saving.jl @@ -1,6 +1,6 @@ @testset verbose=true "SolutionSavingCallback" begin @testset verbose=true "show" begin - out = joinpath(pkgdir(TrixiParticles), "out") + out = joinpath(tempdir(), "trixi_out") output_directory_padded = out * " "^(65 - length(out)) @testset verbose=true "dt" begin From df825a0865883213cb0b213c27bbaef47ad30a37 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 14:17:59 +0200 Subject: [PATCH 51/56] fix NEWS.md --- NEWS.md | 798 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 399 insertions(+), 399 deletions(-) diff --git a/NEWS.md b/NEWS.md index 60b8ded85b..3ec56e6274 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,399 +1,399 @@ -# Changelog - -TrixiParticles.jl follows the interpretation of -[semantic versioning (semver)](https://julialang.github.io/Pkg.jl/dev/compatibility/#Version-specifier-format-1) -used in the Julia ecosystem. Notable changes will be documented in this file for human readability. - -## Version 0.5 - -### API Changes - -- `DensityDiffusionAntuono` now only takes only one kwarg `delta` (#1142). -- Clipping of negative pressure values in the `DummyParticleBoundaryModel` is now disabled - by default and can be enabled with the keyword argument `clip_negative_pressure=true` (#1143). -- Return type of `vtk2trixi` changed to `NamedTuple` including an optional - `:initial_condition` field if `create_initial_condition=true` is passed (#959). - -### Performance - -- Greatly improved GPU performance of WCSPH and TLSPH - (#1128, #1117, #1124, #1125, #1130, #1116, #1139, #1149). - See [#1131](https://github.com/trixi-framework/TrixiParticles.jl/issues/1131) - for a detailed breakdown including benchmark results. - -## Version 0.4.4 - -### API Changes - -- Custom quantities called in the `PostprocessCallback` are now passed CPU arrays when - the simulation is run on a GPU (#1065). - -### Features - -- Added `StateEquationAdaptiveCole` an adaptive sound speed version of the Cole state equation (#875). -- Added `RigidBodySystem` that supports rigid body dynamics for FSI (#1076). -- Added `RigidContactModel` that supports rigid-wall and rigid-rigid collisions (#1090, #1091). -- Added a specialized neighborhood search for TLSPH self-interaction (#1016). -- Added CFL condition for TLSPH and split integration (#1030). -- Added new validation case hydrostatic water column (#724). -- Added Carreau–Yasuda non-Newtonian viscosity model (#1010). - -### Important Bugfixes - -- Fixed the periodic array of cylinders example file (#975). -- A `StepsizeCallback` can now be used with open boundaries (#1074). -- Fixed a bug with no-slip boundary conditions when using any viscosity model other than `ViscosityAdami` (#1089). - -### Documentation - -- Added a new tutorial for rigid body dynamics (#1095). -- Better overview page for tutorials (#1093). - -## Version 0.4.3 - -### API Changes - -- Added the keyword `coordinates_eltype` to `RectangularTank`, - `RectangularShape` and `SphereShape`, which defaults to `Float64` (#956). - -- Added keywords `element_type` and `coordinates_eltype` to `vtk2trixi` (#991) - -### Features -- Added support for ASCII STL files with multiple patches as separate geometries, - plus a function `extrude_geometry` and a union operation for `TrixiParticles.TriangleMesh` (#962). - -- Added an `RCRWindkesselModel` open-boundary pressure model as a lumped-parameter - description of vascular systems (#935, #1019, #992). - -- Added support for FP64 coordinates when using FP32 GPU computations, fixing - stability issues at high resolutions (#956). - -- Added a new `LaguerreGaussKernel` smoothing kernel (#893). - -- Added GPU and FP32 support for DEM (#979). - -### Performance -- Improved GPU performance with shifting up to a factor of 10x (#974, #993). - -- Significantly improved GPU performance of TLSPH (#1014). - -## Version 0.4.2 - -### API Changes - -- Keyword argument `n_clamped_particles` of the `TotalLagrangianSPHSystem` - has been deprecated in favor of a new kwarg `clamped_particles`. - -### Features - -- Added `OscillatingMotion2D` to create an oscillating `PrescribedMotion` combining - translation and rotation (#915). -- Added `BoundaryModelDynamicalPressureZhang` for `OpenBoundarySystem` (#900). -- Added `PrescribedMotion` to clamped particles in `TotalLagrangianSPHSystem` (#896). -- Added new boundary density calculator `PressureBoundaries` specifically for - `ImplicitIncompressibleSPHSystem` (#946). -- Included wall velocity in interpolation (#941). -- 2D dam break validation now compares against the results from De Courcy et al. (#934). -- Improved performance of `TotalLagrangianSPHSystem` on GPUs (#968). - -### Important Bugfixes - -- Fixed transport velocity formulation with tensile instability control (#948). -- Fixed `TotalLagrangianSPHSystem` close to open boundaries (#954). -- `extrude_geometry` now doesn't adjust the particle spacing (#965). -- Reduced overhead of `UpdateCallback` when no update operations are performed (#973). - -## Version 0.4.1 - -### Features - -- Added an incompressible SPH solver `ImplicitIncompressibleSPHSystem` (#751). -- Added `SplitIntegrationCallback` to integrate the `TotalLagrangianSPHSystem`s - in a `Semidiscretization` separately from the other systems (#794). - -### Important Bugfixes - -- Fixed `kernel_grad` threshold with single precision and small particle spacing (#913). -- Fixed error with `UpdateCallback` when `SaveSolutionCallback` comes first in the - `CallbackSet` (#924). -- Fixed error when using shifting techniques without `UpdateCallback` (#925). -- Updated program flow diagram (#917). - -## Version 0.4 - -### API Changes - -- Renamed `BoundarySPHSystem` to `WallBoundarySystem` and the keyword argument - `movement` to `prescribed_motion`. - -- Renamed `OpenBoundarySPHSystem` to `OpenBoundarySystem`. - -- Renamed `BoundaryMovement` to `PrescribedMotion`. The `movement_function` must now be - a function of `(x, t)` returning the *new position* instead of an offset. - For example, `movement_function(t) = SVector(t, 0.0)` now needs to be - `movement_function(x, t) = x + SVector(t, 0.0)`. - -- Renamed directory `solid` to `structure` in the examples file tree. - VTK files for the `TotalLagrangianSPHSystem` are now also called `structure_*`. - -- Renamed keyword argument `n_fixed_particles` of the `TotalLagrangianSPHSystem` - to `n_clamped_particles`. - -- API for `OpenBoundarySystem` and `BoundaryZone` changed. - It is now possible to pass multiple `BoundaryZone`s to a single `OpenBoundarySystem`. - Reference values are now assigned individually to each `BoundaryZone`. (#866) - -- Rename keyword arguments `plane` and `plane_normal` for `BoundaryZone` to `boundary_face` and `face_normal` (#597). - -- The argument of `TransportVelocityAdami` is now a keyword argument. - `TransportVelocityAdami(1000.0)` now becomes - `TransportVelocityAdami(background_pressure=1000.0)` (#884). - -- Combined transport velocity formulation (TVF) and particle shifting technique (PST) into - one unified framework. - The keyword argument `transport_velocity` now changed to `shifting_technique`. - The `ParticleShiftingCallback` has been removed. To use PST, use the `UpdateCallback` - instead, and pass `shifting_technique=ParticleShiftingTechniqueSun2017()` to the system (#884). - -- Renamed the keyword argument `tlsph` to `place_on_shell` for `ParticlePackingSystem`, - `sample_boundary`, `extrude_geometry`, `RectangularShape`, and `SphereShape` (#814). - -- Custom quantity functions passed to `SolutionSavingCallback` or `PostprocessCallback` - that were not using the documented API but were functions of - `(system, v_ode, u_ode, semi, t)` now need to be functions - of `(system, dv_ode, du_ode, v_ode, u_ode, semi, t)` (#879). - -- Renamed `each_moving_particle` to `each_integrated_particle`, - `n_moving_particles` to `n_integrated_particles` - and `active_particles` to `each_active_particle`. - -### Features - -- Added consistent particle shifting by Sun et al. (2019) as `ConsistentShiftingSun2019` (#888). - - -## Version 0.3.2 -### Features - -- **Open boundaries**: - - Averaging of the inflow velocities has been added as an option. (#833) - - New mirroring methods 0th order, 1st order and simple mirroring have been added. (#855) - -- **TLSPH**: - - The option to add artificial viscosity has been added to increase stability of FSI. (#869) - - -### Important Bugfixes - -- Fix the coordinates used for TLSPH in Adami extrapolation (#853) -- Fix PST for small smoothing length factors (#834) -- The TVF model has been improved to integrate correctly with time stepping (#864) - - -## Version 0.3.1 - -### Features - -- **Simplified SGS Viscosity Models**: Added ViscosityMorrisSGS and ViscosityAdamiSGS, - which implement a simplified Smagorinsky-type sub-grid-scale viscosity. (#753) - -- **Multithreaded Integration Array**: Introduced a new array type for CPU backends - that enables multithreaded broadcasting, delivering speed-ups of up to 5× on systems - with many threads when combined with thread pinning. (#722) - -- **Tensile Instability Control (TIC)**: Implemented TIC to mitigate tensile - instability artifacts in simulations. (#769) - -- **DXF file format support**: Import complex geometries using the DXF file format. (#821) - -- **Improved Plane interpolation**: Massively improved interpolation performance for planes (#763). - -### GPU - - - Make PST GPU-compatible (#813). - - - Make open boundaries GPU-compatible (#773). - - - Make interpolation GPU-compatible (#812). - -### Important Bugfixes - - - Fix validation setups (#801). - - - Calculate interpolated density instead of computed density when using interpolation (#808). - - - Fix allocations with Julia 1.10 (#809). - - - Fix Tafuni extrapolation for open boundaries (#829). - -## Version 0.3 - -### API Changes - -- Rescaled the Wendland kernels by a factor of 2 to be consistent with literature. - This requires adjusting the previously used smoothing length for the Wendland Kernels - by dividing them by 2 as well to obtain the same results (#775). - -- API for custom quantities and functions in the `PostprocessCallback` changed (#755). - -- The API for choosing parallelization backends changed. The keyword argument `data_type` - in `semidiscretize` was removed and a keyword argument `parallelization_backend` was added - to `Semidiscretization`. See [the docs on GPU support](@ref gpu_support) for more details. - -### Features - -- **Explicit Contact Models:** Added explicit contact models, `LinearContactModel` and `HertzContactModel`, to the DEM solver. (#756) - -- **Particle Shifting Technique (PST) for Closed Systems:** Integrated the - Particle Shifting Technique to enhance particle distribution, reduce clumping - and prevent void regions due to tensile instability in closed system simulations. (#735) - -- **Open Boundary Model:** Added an open boundary model based on Tafuni et al. (2018), - utilizing mirroring and extrapolation to transfer fluid quantities to the buffer zones. - This enhancement allows for more accurate handling of simulation boundaries in open systems, - ensuring better consistency between the computed domain and its buffer areas. (#574) - -- **Transport Velocity Formulation (TVF) for WCSPH Solver:** Added support for TVF - to the WCSPH solver, improving the consistency and stability - of weakly compressible SPH simulations. (#600) - -### Refactoring - -- **Variable Smoothing Length Structures:** Introduced new structures to support a variable - smoothing length, providing enhanced flexibility in simulation configurations. (#736) - -- **Flexible Parallelization Backend:** Improved the parallelization backend support, - making it possible to switch the parallelization backend for single simulations. (#748) - -- **Total Lagrangian SPH:** Added per-particle material parameters. (#740) - -## Version 0.2.7 - -### Features - -- Added the classic **Continuum Surface Force (CSF)** model based on Morris 2000 (#584), which computes - surface tension as a **body force** proportional to curvature and directed along the interface normal. - This method is efficient and accurate for capillary effects but does not explicitly conserve momentum. - -- Added the classic **Continuum Surface Stress (CSS)** model based on Morris 2000 (#584), which is - a **momentum-conserving** approach that formulates surface tension as the **divergence of a stress tensor**. - However, it requires additional computation and stabilization to handle **high-density interfaces** and reduce numerical instabilities. - -- Added `BoundaryZone` to allow for bidirectional flow (#623) - -- Added the symplectic time integration scheme used in DualSPHysics (#716) - -### Documentation - -- Added documentation for time integration (#716) - -### Testing - -- Run CI tests on GPUs via Buildkite CI (#723) - -### Bugs - -- Fix GPU computations (#689) - -## Version 0.2.6 - -### Features - -- Support for surface tension was added to EDAC (#539) - -### Refactored - -- Surface normal calculation was moved from `surface_tension.jl` to `surface_normal_sph.jl` (#539) - -## Version 0.2.5 - -### Features - -- Add particle packing for 2D (.asc) and 3D (.stl) geometries (#529) - -### Compatibility Changes - -- Dropped support for Julia 1.9 - -## Version 0.2.4 - -### Features - -- A method to prevent penetration of fast moving particles with solids was added (#498) -- Added the callback `SteadyStateReachedCallback` to detect convergence of static simulations (#601) -- Added ideal gas state equation (#607) -- Simulations can be run with `Float32` (#662) - -### Documentation - -- Documentation for GPU support was added (#660) -- A new user tutorial was added (#514) -- Several docs fixes (#663, #659, #637, #658, #664) - -## Version 0.2.3 - -### Highlights - -Transport Velocity Formulation (TVF) based on the work of Ramachandran et al. "Entropically damped artificial compressibility for SPH" (2019) was added. - -## Version 0.2.2 - -### Highlights - -Hotfix for threaded sampling of complex geometries. - -## Version 0.2.1 - -### Highlights - -Particle sampling of complex geometries from `.stl` and `.asc` files. - -## Version 0.2.0 - -### Removed - -Use of the internal neighborhood search has been removed and replaced with PointNeighbors.jl. - -## Development Cycle 0.1 - -### Highlights - -#### Discrete Element Method - -A basic implementation of the discrete element method was added. - -#### Surface Tension and Adhesion Model - -A surface tension and adhesion model based on the work by Akinci et al., "Versatile Surface Tension and Adhesion for SPH Fluids" (2013) was added to WCSPH. - -#### Support for Open Boundaries - -Open boundaries using the method of characteristics based on the work of Lastiwka et al., "Permeable and non-reflecting boundary conditions in SPH" (2009) were added for WCSPH and EDAC. - -## Pre Initial Release (v0.1.0) - -This section summarizes the initial features that TrixiParticles.jl was released with. - -### Highlights -#### EDAC - -An implementation of EDAC (Entropically Damped Artificial Compressibility) was added, -which allows for more stable simulations compared to basic WCSPH and reduces spurious pressure oscillations. - -#### WCSPH - -An implementation of WCSPH (Weakly Compressible Smoothed Particle Hydrodynamics), which is the classical SPH approach. - -Features: - -- Correction schemes (Shepard (0. Order) ... MixedKernelGradient (1. Order)) -- Density reinitialization -- Kernel summation and Continuity equation density formulations -- Flexible boundary conditions e.g. dummy particles with Adami pressure extrapolation, pressure zeroing, pressure mirroring... -- Moving boundaries -- Density diffusion based on the models by Molteni & Colagrossi (2009), Ferrari et al. (2009) and Antuono et al. (2010). - - -#### TLSPH - -An implementation of TLSPH (Total Lagrangian Smoothed Particle Hydrodynamics) for solid bodies enabling FSI (Fluid Structure Interactions). +# Changelog + +TrixiParticles.jl follows the interpretation of +[semantic versioning (semver)](https://julialang.github.io/Pkg.jl/dev/compatibility/#Version-specifier-format-1) +used in the Julia ecosystem. Notable changes will be documented in this file for human readability. + +## Version 0.5 + +### API Changes + +- `DensityDiffusionAntuono` now only takes only one kwarg `delta` (#1142). +- Clipping of negative pressure values in the `DummyParticleBoundaryModel` is now disabled + by default and can be enabled with the keyword argument `clip_negative_pressure=true` (#1143). +- Return type of `vtk2trixi` changed to `NamedTuple` including an optional + `:initial_condition` field if `create_initial_condition=true` is passed (#959). + +### Performance + +- Greatly improved GPU performance of WCSPH and TLSPH + (#1128, #1117, #1124, #1125, #1130, #1116, #1139, #1149). + See [#1131](https://github.com/trixi-framework/TrixiParticles.jl/issues/1131) + for a detailed breakdown including benchmark results. + +## Version 0.4.4 + +### API Changes + +- Custom quantities called in the `PostprocessCallback` are now passed CPU arrays when + the simulation is run on a GPU (#1065). + +### Features + +- Added `StateEquationAdaptiveCole` an adaptive sound speed version of the Cole state equation (#875). +- Added `RigidBodySystem` that supports rigid body dynamics for FSI (#1076). +- Added `RigidContactModel` that supports rigid-wall and rigid-rigid collisions (#1090, #1091). +- Added a specialized neighborhood search for TLSPH self-interaction (#1016). +- Added CFL condition for TLSPH and split integration (#1030). +- Added new validation case hydrostatic water column (#724). +- Added Carreau–Yasuda non-Newtonian viscosity model (#1010). + +### Important Bugfixes + +- Fixed the periodic array of cylinders example file (#975). +- A `StepsizeCallback` can now be used with open boundaries (#1074). +- Fixed a bug with no-slip boundary conditions when using any viscosity model other than `ViscosityAdami` (#1089). + +### Documentation + +- Added a new tutorial for rigid body dynamics (#1095). +- Better overview page for tutorials (#1093). + +## Version 0.4.3 + +### API Changes + +- Added the keyword `coordinates_eltype` to `RectangularTank`, + `RectangularShape` and `SphereShape`, which defaults to `Float64` (#956). + +- Added keywords `element_type` and `coordinates_eltype` to `vtk2trixi` (#991) + +### Features +- Added support for ASCII STL files with multiple patches as separate geometries, + plus a function `extrude_geometry` and a union operation for `TrixiParticles.TriangleMesh` (#962). + +- Added an `RCRWindkesselModel` open-boundary pressure model as a lumped-parameter + description of vascular systems (#935, #1019, #992). + +- Added support for FP64 coordinates when using FP32 GPU computations, fixing + stability issues at high resolutions (#956). + +- Added a new `LaguerreGaussKernel` smoothing kernel (#893). + +- Added GPU and FP32 support for DEM (#979). + +### Performance +- Improved GPU performance with shifting up to a factor of 10x (#974, #993). + +- Significantly improved GPU performance of TLSPH (#1014). + +## Version 0.4.2 + +### API Changes + +- Keyword argument `n_clamped_particles` of the `TotalLagrangianSPHSystem` + has been deprecated in favor of a new kwarg `clamped_particles`. + +### Features + +- Added `OscillatingMotion2D` to create an oscillating `PrescribedMotion` combining + translation and rotation (#915). +- Added `BoundaryModelDynamicalPressureZhang` for `OpenBoundarySystem` (#900). +- Added `PrescribedMotion` to clamped particles in `TotalLagrangianSPHSystem` (#896). +- Added new boundary density calculator `PressureBoundaries` specifically for + `ImplicitIncompressibleSPHSystem` (#946). +- Included wall velocity in interpolation (#941). +- 2D dam break validation now compares against the results from De Courcy et al. (#934). +- Improved performance of `TotalLagrangianSPHSystem` on GPUs (#968). + +### Important Bugfixes + +- Fixed transport velocity formulation with tensile instability control (#948). +- Fixed `TotalLagrangianSPHSystem` close to open boundaries (#954). +- `extrude_geometry` now doesn't adjust the particle spacing (#965). +- Reduced overhead of `UpdateCallback` when no update operations are performed (#973). + +## Version 0.4.1 + +### Features + +- Added an incompressible SPH solver `ImplicitIncompressibleSPHSystem` (#751). +- Added `SplitIntegrationCallback` to integrate the `TotalLagrangianSPHSystem`s + in a `Semidiscretization` separately from the other systems (#794). + +### Important Bugfixes + +- Fixed `kernel_grad` threshold with single precision and small particle spacing (#913). +- Fixed error with `UpdateCallback` when `SaveSolutionCallback` comes first in the + `CallbackSet` (#924). +- Fixed error when using shifting techniques without `UpdateCallback` (#925). +- Updated program flow diagram (#917). + +## Version 0.4 + +### API Changes + +- Renamed `BoundarySPHSystem` to `WallBoundarySystem` and the keyword argument + `movement` to `prescribed_motion`. + +- Renamed `OpenBoundarySPHSystem` to `OpenBoundarySystem`. + +- Renamed `BoundaryMovement` to `PrescribedMotion`. The `movement_function` must now be + a function of `(x, t)` returning the *new position* instead of an offset. + For example, `movement_function(t) = SVector(t, 0.0)` now needs to be + `movement_function(x, t) = x + SVector(t, 0.0)`. + +- Renamed directory `solid` to `structure` in the examples file tree. + VTK files for the `TotalLagrangianSPHSystem` are now also called `structure_*`. + +- Renamed keyword argument `n_fixed_particles` of the `TotalLagrangianSPHSystem` + to `n_clamped_particles`. + +- API for `OpenBoundarySystem` and `BoundaryZone` changed. + It is now possible to pass multiple `BoundaryZone`s to a single `OpenBoundarySystem`. + Reference values are now assigned individually to each `BoundaryZone`. (#866) + +- Rename keyword arguments `plane` and `plane_normal` for `BoundaryZone` to `boundary_face` and `face_normal` (#597). + +- The argument of `TransportVelocityAdami` is now a keyword argument. + `TransportVelocityAdami(1000.0)` now becomes + `TransportVelocityAdami(background_pressure=1000.0)` (#884). + +- Combined transport velocity formulation (TVF) and particle shifting technique (PST) into + one unified framework. + The keyword argument `transport_velocity` now changed to `shifting_technique`. + The `ParticleShiftingCallback` has been removed. To use PST, use the `UpdateCallback` + instead, and pass `shifting_technique=ParticleShiftingTechniqueSun2017()` to the system (#884). + +- Renamed the keyword argument `tlsph` to `place_on_shell` for `ParticlePackingSystem`, + `sample_boundary`, `extrude_geometry`, `RectangularShape`, and `SphereShape` (#814). + +- Custom quantity functions passed to `SolutionSavingCallback` or `PostprocessCallback` + that were not using the documented API but were functions of + `(system, v_ode, u_ode, semi, t)` now need to be functions + of `(system, dv_ode, du_ode, v_ode, u_ode, semi, t)` (#879). + +- Renamed `each_moving_particle` to `each_integrated_particle`, + `n_moving_particles` to `n_integrated_particles` + and `active_particles` to `each_active_particle`. + +### Features + +- Added consistent particle shifting by Sun et al. (2019) as `ConsistentShiftingSun2019` (#888). + + +## Version 0.3.2 +### Features + +- **Open boundaries**: + - Averaging of the inflow velocities has been added as an option. (#833) + - New mirroring methods 0th order, 1st order and simple mirroring have been added. (#855) + +- **TLSPH**: + - The option to add artificial viscosity has been added to increase stability of FSI. (#869) + + +### Important Bugfixes + +- Fix the coordinates used for TLSPH in Adami extrapolation (#853) +- Fix PST for small smoothing length factors (#834) +- The TVF model has been improved to integrate correctly with time stepping (#864) + + +## Version 0.3.1 + +### Features + +- **Simplified SGS Viscosity Models**: Added ViscosityMorrisSGS and ViscosityAdamiSGS, + which implement a simplified Smagorinsky-type sub-grid-scale viscosity. (#753) + +- **Multithreaded Integration Array**: Introduced a new array type for CPU backends + that enables multithreaded broadcasting, delivering speed-ups of up to 5× on systems + with many threads when combined with thread pinning. (#722) + +- **Tensile Instability Control (TIC)**: Implemented TIC to mitigate tensile + instability artifacts in simulations. (#769) + +- **DXF file format support**: Import complex geometries using the DXF file format. (#821) + +- **Improved Plane interpolation**: Massively improved interpolation performance for planes (#763). + +### GPU + + - Make PST GPU-compatible (#813). + + - Make open boundaries GPU-compatible (#773). + + - Make interpolation GPU-compatible (#812). + +### Important Bugfixes + + - Fix validation setups (#801). + + - Calculate interpolated density instead of computed density when using interpolation (#808). + + - Fix allocations with Julia 1.10 (#809). + + - Fix Tafuni extrapolation for open boundaries (#829). + +## Version 0.3 + +### API Changes + +- Rescaled the Wendland kernels by a factor of 2 to be consistent with literature. + This requires adjusting the previously used smoothing length for the Wendland Kernels + by dividing them by 2 as well to obtain the same results (#775). + +- API for custom quantities and functions in the `PostprocessCallback` changed (#755). + +- The API for choosing parallelization backends changed. The keyword argument `data_type` + in `semidiscretize` was removed and a keyword argument `parallelization_backend` was added + to `Semidiscretization`. See [the docs on GPU support](@ref gpu_support) for more details. + +### Features + +- **Explicit Contact Models:** Added explicit contact models, `LinearContactModel` and `HertzContactModel`, to the DEM solver. (#756) + +- **Particle Shifting Technique (PST) for Closed Systems:** Integrated the + Particle Shifting Technique to enhance particle distribution, reduce clumping + and prevent void regions due to tensile instability in closed system simulations. (#735) + +- **Open Boundary Model:** Added an open boundary model based on Tafuni et al. (2018), + utilizing mirroring and extrapolation to transfer fluid quantities to the buffer zones. + This enhancement allows for more accurate handling of simulation boundaries in open systems, + ensuring better consistency between the computed domain and its buffer areas. (#574) + +- **Transport Velocity Formulation (TVF) for WCSPH Solver:** Added support for TVF + to the WCSPH solver, improving the consistency and stability + of weakly compressible SPH simulations. (#600) + +### Refactoring + +- **Variable Smoothing Length Structures:** Introduced new structures to support a variable + smoothing length, providing enhanced flexibility in simulation configurations. (#736) + +- **Flexible Parallelization Backend:** Improved the parallelization backend support, + making it possible to switch the parallelization backend for single simulations. (#748) + +- **Total Lagrangian SPH:** Added per-particle material parameters. (#740) + +## Version 0.2.7 + +### Features + +- Added the classic **Continuum Surface Force (CSF)** model based on Morris 2000 (#584), which computes + surface tension as a **body force** proportional to curvature and directed along the interface normal. + This method is efficient and accurate for capillary effects but does not explicitly conserve momentum. + +- Added the classic **Continuum Surface Stress (CSS)** model based on Morris 2000 (#584), which is + a **momentum-conserving** approach that formulates surface tension as the **divergence of a stress tensor**. + However, it requires additional computation and stabilization to handle **high-density interfaces** and reduce numerical instabilities. + +- Added `BoundaryZone` to allow for bidirectional flow (#623) + +- Added the symplectic time integration scheme used in DualSPHysics (#716) + +### Documentation + +- Added documentation for time integration (#716) + +### Testing + +- Run CI tests on GPUs via Buildkite CI (#723) + +### Bugs + +- Fix GPU computations (#689) + +## Version 0.2.6 + +### Features + +- Support for surface tension was added to EDAC (#539) + +### Refactored + +- Surface normal calculation was moved from `surface_tension.jl` to `surface_normal_sph.jl` (#539) + +## Version 0.2.5 + +### Features + +- Add particle packing for 2D (.asc) and 3D (.stl) geometries (#529) + +### Compatibility Changes + +- Dropped support for Julia 1.9 + +## Version 0.2.4 + +### Features + +- A method to prevent penetration of fast moving particles with solids was added (#498) +- Added the callback `SteadyStateReachedCallback` to detect convergence of static simulations (#601) +- Added ideal gas state equation (#607) +- Simulations can be run with `Float32` (#662) + +### Documentation + +- Documentation for GPU support was added (#660) +- A new user tutorial was added (#514) +- Several docs fixes (#663, #659, #637, #658, #664) + +## Version 0.2.3 + +### Highlights + +Transport Velocity Formulation (TVF) based on the work of Ramachandran et al. "Entropically damped artificial compressibility for SPH" (2019) was added. + +## Version 0.2.2 + +### Highlights + +Hotfix for threaded sampling of complex geometries. + +## Version 0.2.1 + +### Highlights + +Particle sampling of complex geometries from `.stl` and `.asc` files. + +## Version 0.2.0 + +### Removed + +Use of the internal neighborhood search has been removed and replaced with PointNeighbors.jl. + +## Development Cycle 0.1 + +### Highlights + +#### Discrete Element Method + +A basic implementation of the discrete element method was added. + +#### Surface Tension and Adhesion Model + +A surface tension and adhesion model based on the work by Akinci et al., "Versatile Surface Tension and Adhesion for SPH Fluids" (2013) was added to WCSPH. + +#### Support for Open Boundaries + +Open boundaries using the method of characteristics based on the work of Lastiwka et al., "Permeable and non-reflecting boundary conditions in SPH" (2009) were added for WCSPH and EDAC. + +## Pre Initial Release (v0.1.0) + +This section summarizes the initial features that TrixiParticles.jl was released with. + +### Highlights +#### EDAC + +An implementation of EDAC (Entropically Damped Artificial Compressibility) was added, +which allows for more stable simulations compared to basic WCSPH and reduces spurious pressure oscillations. + +#### WCSPH + +An implementation of WCSPH (Weakly Compressible Smoothed Particle Hydrodynamics), which is the classical SPH approach. + +Features: + +- Correction schemes (Shepard (0. Order) ... MixedKernelGradient (1. Order)) +- Density reinitialization +- Kernel summation and Continuity equation density formulations +- Flexible boundary conditions e.g. dummy particles with Adami pressure extrapolation, pressure zeroing, pressure mirroring... +- Moving boundaries +- Density diffusion based on the models by Molteni & Colagrossi (2009), Ferrari et al. (2009) and Antuono et al. (2010). + + +#### TLSPH + +An implementation of TLSPH (Total Lagrangian Smoothed Particle Hydrodynamics) for solid bodies enabling FSI (Fluid Structure Interactions). From 297e6e62703e172a15dea54cbe7ce8c8797a70da Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 14:48:01 +0200 Subject: [PATCH 52/56] add news section --- NEWS.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/NEWS.md b/NEWS.md index 3ec56e6274..69e1435dba 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,53 @@ used in the Julia ecosystem. Notable changes will be documented in this file for by default and can be enabled with the keyword argument `clip_negative_pressure=true` (#1143). - Return type of `vtk2trixi` changed to `NamedTuple` including an optional `:initial_condition` field if `create_initial_condition=true` is passed (#959). +- Public system constructors now use keyword arguments for configuration values. + This affects `WeaklyCompressibleSPHSystem`, `EntropicallyDampedSPHSystem`, + `ImplicitIncompressibleSPHSystem`, `TotalLagrangianSPHSystem`, `DEMSystem`, + and `BoundaryDEMSystem`. + +#### Migration Guide for Keyword-Only System Constructors + +The initial condition remains the only positional argument for the affected system +constructors. All method, material, and configuration arguments that were previously +passed positionally now need to be passed as keywords. +Existing optional keyword arguments remain available. For example, the +`density_calculator` keyword of `EntropicallyDampedSPHSystem` still defaults to +`SummationDensity()`. + +Use these rewrites, where `ic` is the initial condition, `kernel` is the +smoothing kernel, and `h` is the smoothing length: + +```julia +WeaklyCompressibleSPHSystem(ic, density_calculator, state_equation, kernel, h; + kwargs...) +# becomes +WeaklyCompressibleSPHSystem(ic; smoothing_kernel=kernel, smoothing_length=h, + density_calculator, state_equation, kwargs...) + +EntropicallyDampedSPHSystem(ic, kernel, h, sound_speed; kwargs...) +# becomes +EntropicallyDampedSPHSystem(ic; smoothing_kernel=kernel, smoothing_length=h, + sound_speed, kwargs...) + +ImplicitIncompressibleSPHSystem(ic, kernel, h, reference_density; kwargs...) +# becomes +ImplicitIncompressibleSPHSystem(ic; smoothing_kernel=kernel, smoothing_length=h, + reference_density, kwargs...) + +TotalLagrangianSPHSystem(ic, kernel, h, young_modulus, poisson_ratio; kwargs...) +# becomes +TotalLagrangianSPHSystem(ic; smoothing_kernel=kernel, smoothing_length=h, + young_modulus, poisson_ratio, kwargs...) + +DEMSystem(ic, contact_model; kwargs...) +# becomes +DEMSystem(ic; contact_model, kwargs...) + +BoundaryDEMSystem(ic, normal_stiffness) +# becomes +BoundaryDEMSystem(ic; normal_stiffness) +``` ### Performance From 79f701fbe20b666bb517be5332b15ead469740c4 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 14:48:17 +0200 Subject: [PATCH 53/56] Update src/schemes/fluid/implicit_incompressible_sph/system.jl Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- src/schemes/fluid/implicit_incompressible_sph/system.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/schemes/fluid/implicit_incompressible_sph/system.jl b/src/schemes/fluid/implicit_incompressible_sph/system.jl index fdbf7056d5..6e54ce7b66 100644 --- a/src/schemes/fluid/implicit_incompressible_sph/system.jl +++ b/src/schemes/fluid/implicit_incompressible_sph/system.jl @@ -64,7 +64,6 @@ end # The default constructor needs to be accessible for Adapt.jl to work with this struct. # See the comments in general/gpu.jl for more details. - function ImplicitIncompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, reference_density, viscosity=nothing, From 188f4fa60158afefc641e4a46f449984cb93194f Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 14:50:42 +0200 Subject: [PATCH 54/56] review comments Co-authored-by: Copilot --- examples/fluid/sphere_surface_tension_2d.jl | 10 ++++++---- src/schemes/fluid/entropically_damped_sph/system.jl | 2 ++ src/schemes/fluid/weakly_compressible_sph/system.jl | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/fluid/sphere_surface_tension_2d.jl b/examples/fluid/sphere_surface_tension_2d.jl index d946f3ca1e..24a954531a 100644 --- a/examples/fluid/sphere_surface_tension_2d.jl +++ b/examples/fluid/sphere_surface_tension_2d.jl @@ -39,10 +39,12 @@ fluid = RectangularShape(particle_spacing, round.(Int, fluid_size ./ particle_sp alpha = 8 * nu / (smoothing_length * sound_speed) source_terms = SourceTermDamping(; damping_coefficient=0.5) # fluid_system = WeaklyCompressibleSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, -# smoothing_length, density_calculator=SummationDensity(), state_equation, -# reference_particle_spacing=particle_spacing, viscosity=ArtificialViscosityMonaghan(; alpha, beta=0.0), -# surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.02), -# correction=AkinciFreeSurfaceCorrection(fluid_density), source_terms) +# smoothing_length, density_calculator=SummationDensity(), +# state_equation, reference_particle_spacing=particle_spacing, +# viscosity=ArtificialViscosityMonaghan(; alpha, beta=0.0), +# surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.02), +# correction=AkinciFreeSurfaceCorrection(fluid_density), +# source_terms) # Alternatively can also be used with surface_tension=SurfaceTensionMomentumMorris(surface_tension_coefficient=1.0) fluid_system = EntropicallyDampedSPHSystem(fluid; smoothing_kernel=fluid_smoothing_kernel, diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index f388415728..2b085d3ebb 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -83,6 +83,8 @@ struct EntropicallyDampedSPHSystem{NDIMS, ELTYPE <: Real, IC, M, DC, K, V, COR, cache :: C end +# The default constructor needs to be accessible for Adapt.jl to work with this struct. +# See the comments in general/gpu.jl for more details. function EntropicallyDampedSPHSystem(initial_condition; smoothing_kernel, smoothing_length, sound_speed, density_calculator=SummationDensity(), pressure_acceleration=inter_particle_averaged_pressure, diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index ef0f0d6497..4b1caf351a 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -85,6 +85,8 @@ struct WeaklyCompressibleSPHSystem{NDIMS, ELTYPE <: Real, IC, MA, P, DC, SE, K, cache :: C end +# The default constructor needs to be accessible for Adapt.jl to work with this struct. +# See the comments in general/gpu.jl for more details. function WeaklyCompressibleSPHSystem(initial_condition; smoothing_kernel, smoothing_length, density_calculator, state_equation, From 3ca4955c8272d0752f4c59d24e6b3c3c3340323b Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 15:08:48 +0200 Subject: [PATCH 55/56] Update NEWS.md Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 69e1435dba..b1680eec51 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,7 +18,7 @@ used in the Julia ecosystem. Notable changes will be documented in this file for `ImplicitIncompressibleSPHSystem`, `TotalLagrangianSPHSystem`, `DEMSystem`, and `BoundaryDEMSystem`. -#### Migration Guide for Keyword-Only System Constructors +#### Migration Guide for Keyword-Based System Constructors The initial condition remains the only positional argument for the affected system constructors. All method, material, and configuration arguments that were previously From 9277de1f46365eeb76a5b0a36e82b5377f1f91c8 Mon Sep 17 00:00:00 2001 From: Sven Berger Date: Tue, 28 Apr 2026 15:09:03 +0200 Subject: [PATCH 56/56] Update NEWS.md Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index b1680eec51..90f41613af 100644 --- a/NEWS.md +++ b/NEWS.md @@ -27,7 +27,7 @@ Existing optional keyword arguments remain available. For example, the `density_calculator` keyword of `EntropicallyDampedSPHSystem` still defaults to `SummationDensity()`. -Use these rewrites, where `ic` is the initial condition, `kernel` is the +Here are examples, where `ic` is the initial condition, `kernel` is the smoothing kernel, and `h` is the smoothing length: ```julia