Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LasNikas committed Sep 30, 2024
1 parent 8d7f718 commit 24e9c5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 10 additions & 11 deletions src/schemes/boundary/open_boundary/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,24 +263,23 @@ end
@inline function convert_particle!(system::OpenBoundarySPHSystem, fluid_system,
boundary_zone::BoundaryZone{BidirectionalFlow}, particle,
v, u, v_fluid, u_fluid)
particle_position = particle_coords - boundary_zone.zone_origin
particle_position = current_coords(u, system, particle) - boundary_zone.zone_origin

# Check if particle is in- or outside the fluid domain.
# `plane_normal` is always pointing in the fluid domain.
if dot(particle_position, boundary_zone.plane_normal)

# Activate a new particle in simulation domain
transfer_particle!(fluid_system, system, particle, v_fluid, u_fluid, v, u)

# Reset position of boundary particle
for dim in 1:ndims(system)
u[dim, particle] = boundary_zone.plane_normal[dim]
end
if signbit(dot(particle_position, boundary_zone.plane_normal))
deactivate_particle!(system, particle, u)

return system
end

deactivate_particle!(system, particle, u)
# Activate a new particle in simulation domain
transfer_particle!(fluid_system, system, particle, v_fluid, u_fluid, v, u)

# Reset position of boundary particle
for dim in 1:ndims(system)
u[dim, particle] = boundary_zone.plane_normal[dim]
end

return system
end
Expand Down
2 changes: 1 addition & 1 deletion src/visualization/write2vtk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ function write2vtk!(vtk, v, u, t, system::OpenBoundarySPHSystem; write_meta_data
for particle in active_particles(system)]

if write_meta_data
vtk["boundary_zone"] = first(typeof(boundary_zone).parameters)
vtk["boundary_zone"] = type2string(first(typeof(system.boundary_zone).parameters))
vtk["width"] = round(system.boundary_zone.zone_width, digits=3)
vtk["velocity_function"] = type2string(system.reference_velocity)
vtk["pressure_function"] = type2string(system.reference_pressure)
Expand Down

0 comments on commit 24e9c5b

Please sign in to comment.