Skip to content

Commit

Permalink
fix reference mass
Browse files Browse the repository at this point in the history
  • Loading branch information
LasNikas committed Nov 7, 2024
1 parent fa8f33f commit 384c73d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/multi_resolution/particle_refinement.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
struct ParticleRefinement{SP, ELTYPE}
splitting_pattern :: SP
max_spacing_ratio :: ELTYPE
splitting_pattern :: SP
max_spacing_ratio :: ELTYPE
mass_ref :: Vector{ELTYPE}
end

function refinement!(semi, v_ode, u_ode, v_tmp, u_tmp, t)
Expand Down Expand Up @@ -50,16 +51,18 @@ end
end

function update_particle_spacing(semi::Semidiscretization, u_ode)
foreach_system(semi) do particle_system
u_particle_system = wrap_u(u_ode, particle_system, semi)
update_particle_spacing(particle_system, u_particle_system, semi)
foreach_system(semi) do system
u = wrap_u(u_ode, system, semi)
update_particle_spacing(system, u, semi)
end
end

@inline update_particle_spacing(system, u, semi) = system

@inline function update_particle_spacing(system::FluidSystem, u, semi)
(; smoothing_length, smoothing_length_factor) = system.cache
(; mass_ref) = system.particle_refinement

system_coords = current_coordinates(u, system)

for particle in eachparticle(system)
Expand All @@ -72,7 +75,7 @@ end
end

smoothing_length[particle] = smoothing_length_factor * new_spacing
system.mass[particle] = system.density[particle] * new_spacing^(ndims(system))
mass_ref[particle] = system.density[particle] * new_spacing^(ndims(system))
end

return system
Expand Down

0 comments on commit 384c73d

Please sign in to comment.