diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index 0865f8227..39cf4796d 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -239,6 +239,10 @@ system_correction(system::EntropicallyDampedSPHSystem) = system.correction return v[end, particle] end +@inline function current_velocity(v, system::EntropicallyDampedSPHSystem) + return view(v, 1:ndims(system), :) +end + @inline system_state_equation(system::EntropicallyDampedSPHSystem) = nothing # WARNING! diff --git a/test/systems/edac_system.jl b/test/systems/edac_system.jl index c49fe4806..424680abf 100644 --- a/test/systems/edac_system.jl +++ b/test/systems/edac_system.jl @@ -193,7 +193,12 @@ TrixiParticles.n_moving_particles(system)) TrixiParticles.write_v0!(v0, system) + system.cache.density .= density + @test v0 == vcat(velocity, pressure') + @test TrixiParticles.current_velocity(v0, system) == velocity + @test TrixiParticles.current_density(v0, system) == system.cache.density + @test TrixiParticles.current_pressure(v0, system) == pressure initial_condition = InitialCondition(; coordinates, velocity, mass, density, pressure=pressure_function) diff --git a/test/systems/wcsph_system.jl b/test/systems/wcsph_system.jl index 1b0387360..cf6020d06 100644 --- a/test/systems/wcsph_system.jl +++ b/test/systems/wcsph_system.jl @@ -266,7 +266,13 @@ TrixiParticles.n_moving_particles(system)) TrixiParticles.write_v0!(v0, system) + system.cache.density .= density + system.pressure .= zero(density) + @test v0 == velocity + @test TrixiParticles.current_velocity(v0, system) == velocity + @test TrixiParticles.current_density(v0, system) == system.cache.density + @test TrixiParticles.current_pressure(v0, system) == system.pressure # ContinuityDensity system = WeaklyCompressibleSPHSystem(initial_condition,