Skip to content

Fix current_velocity for EDAC #825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/schemes/fluid/entropically_damped_sph/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
5 changes: 5 additions & 0 deletions test/systems/edac_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions test/systems/wcsph_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading