Skip to content
Draft
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
5 changes: 3 additions & 2 deletions src/callbacks/density_reinit.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"""
DensityReinitializationCallback(; interval::Integer=0, dt=0.0)
DensityReinitializationCallback(particle_system; interval::Integer=0, dt=0.0,
reinit_initial_solution=true)

Callback to reinitialize the density field when using [`ContinuityDensity`](@ref) [Panizzo2007](@cite).

# Keywords
- `interval=0`: Reinitialize the density every `interval` time steps.
- `dt`: Reinitialize the density in regular intervals of `dt` in terms
of integration time.
- `reinit_initial_solution`: Reinitialize the initial solution (default=false)
- `reinit_initial_solution`: Reinitialize the initial solution (default=true)
"""
mutable struct DensityReinitializationCallback{I}
interval::I
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks/post_process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ a fixed interval of simulation time (`dt`).
- `output_directory="out"`: The path where the results of the post-processing will be saved.
- `write_csv=true`: If set to `true`, write a csv file.
- `write_json=true`: If set to `true`, write a json file.
- `append_timestep=false`: If set to `true`, the current timestamp will be added to the filename.
- `append_timestamp=false`: If set to `true`, the current timestamp will be added to the filename.
- `write_file_interval=1`: Files will be written after every `write_file_interval` number of
postprocessing execution steps. A value of 0 indicates that files
are only written at the end of the simulation, eliminating I/O overhead.
Expand Down
2 changes: 1 addition & 1 deletion src/general/corrections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ the correction matrix $\bm{L}_a$ is evaluated explicitly as
struct GradientCorrection end

@doc raw"""
BlendedGradientCorrection()
BlendedGradientCorrection(blending_factor)

Calculate a blended gradient to reduce the stability issues of the [`GradientCorrection`](@ref)
as explained by [Bonet (1999)](@cite Bonet1999).
Expand Down
3 changes: 1 addition & 2 deletions src/general/custom_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ function kinetic_energy(system::AbstractStructureSystem,
dv_ode, du_ode, v_ode, u_ode, semi, t)
v = wrap_v(v_ode, system, semi)
mass = system.mass
energy = zero(eltype(system))

return sum(each_active_particle(system)) do particle
v_i = current_velocity(v, system, particle)
energy += mass[particle] * dot(v_i, v_i) / 2
mass[particle] * dot(v_i, v_i) / 2
end
end

Expand Down
4 changes: 2 additions & 2 deletions src/general/initial_condition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ end

function move_particles_to_end!(ic::InitialCondition, particle_ids_to_move)
invalid_id = findfirst(i -> i <= 0 || i > nparticles(ic), particle_ids_to_move)
isnothing(invalid_id) || throw(BoundsError(ic, invalid_id))
isnothing(invalid_id) || throw(BoundsError(ic, particle_ids_to_move[invalid_id]))

sort_key = [i in particle_ids_to_move ? 1 : 0 for i in eachparticle(ic)]
# Determine a permutation that sorts 'sort_key' in ascending order
Expand All @@ -453,7 +453,7 @@ end

function move_particles_to_end!(a::AbstractVector, particle_ids_to_move)
invalid_id = findfirst(i -> i <= 0 || i > length(a), particle_ids_to_move)
isnothing(invalid_id) || throw(BoundsError(a, invalid_id))
isnothing(invalid_id) || throw(BoundsError(a, particle_ids_to_move[invalid_id]))

sort_key = [i in particle_ids_to_move ? 1 : 0 for i in eachindex(a)]
# determine a permutation that sorts 'sort_key' in ascending order
Expand Down
2 changes: 1 addition & 1 deletion src/general/interpolation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ The interpolation utilizes the same kernel function of the SPH simulation to wei
contributions from nearby particles.

See also: [`interpolate_line`](@ref), [`interpolate_plane_2d`](@ref),
[`interpolate_plane_2d_vtk`](@ref), [`interpolate_plane_3d`](@ref), .
[`interpolate_plane_2d_vtk`](@ref), [`interpolate_plane_3d`](@ref).

# Arguments
- `point_coords`: A matrix of point coordinates, where the $i$-th column holds the
Expand Down
2 changes: 1 addition & 1 deletion src/preprocessing/geometries/polygon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function Base.show(io::IO, ::MIME"text/plain", geometry::Polygon)
@nospecialize geometry # reduce precompilation time

if get(io, :compact, false)
show(io, system)
show(io, geometry)
else
summary_header(io, "Polygon{$(ndims(geometry)), $(eltype(geometry))}")
summary_line(io, "#edges", "$(nfaces(geometry))")
Expand Down
2 changes: 1 addition & 1 deletion src/preprocessing/geometries/triangle_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function Base.show(io::IO, ::MIME"text/plain", geometry::TriangleMesh)
@nospecialize geometry # reduce precompilation time

if get(io, :compact, false)
show(io, system)
show(io, geometry)
else
summary_header(io, "TriangleMesh{$(ndims(geometry)), $(eltype(geometry))}")
summary_line(io, "#faces", "$(nfaces(geometry))")
Expand Down
2 changes: 1 addition & 1 deletion src/preprocessing/point_in_poly/winding_number_jacobson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function Base.show(io::IO, ::MIME"text/plain", winding::WindingNumberJacobson)
@nospecialize winding # reduce precompilation time

if get(io, :compact, false)
show(io, system)
show(io, winding)
else
summary_header(io, "WindingNumberJacobson")
summary_line(io, "winding number factor",
Expand Down
2 changes: 1 addition & 1 deletion src/schemes/boundary/open_boundary/mirroring.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct FirstOrderMirroring{ELTYPE}
end

"""
SimpleMirroring(; firstorder_tolerance=1f-3))
SimpleMirroring(; firstorder_tolerance=1f-3)

This method is similar to [`FirstOrderMirroring`](@ref), but does not use
the corrected gradient as proposed by [Negi et al. (2022)](@cite Negi2022).
Expand Down
2 changes: 1 addition & 1 deletion src/schemes/boundary/wall_boundary/dummy_particles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ struct AdamiPressureExtrapolation{ELTYPE}
end

@doc raw"""
BernoulliPressureExtrapolation(; pressure_offset=0, factor=1)
BernoulliPressureExtrapolation(; pressure_offset=0, factor=1, allow_loop_flipping=true)

`density_calculator` for `BoundaryModelDummyParticles`.

Expand Down
8 changes: 5 additions & 3 deletions src/schemes/fluid/entropically_damped_sph/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
pressure_acceleration=inter_particle_averaged_pressure,
density_calculator=SummationDensity(),
shifting_technique=nothing,
average_pressure_reduction=(!isnothing(shifting_technique)),
alpha=0.5, viscosity=nothing,
acceleration=ntuple(_ -> 0.0, NDIMS), surface_tension=nothing,
acceleration=ntuple(_ -> 0.0, NDIMS),
correction=nothing,
source_terms=nothing, surface_tension=nothing,
surface_normal_method=nothing, buffer_size=nothing,
reference_particle_spacing=0.0, color_value=1,
source_terms=nothing)
reference_particle_spacing=0.0, color_value=1)

System for particles of a fluid.
As opposed to the [weakly compressible SPH scheme](@ref wcsph), which uses an equation of state,
Expand Down
8 changes: 4 additions & 4 deletions src/schemes/fluid/surface_tension.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ abstract type AbstractSurfaceTension end
abstract type AkinciTypeSurfaceTension <: AbstractSurfaceTension end

@doc raw"""
CohesionForceAkinci(surface_tension_coefficient=1.0)
CohesionForceAkinci(; surface_tension_coefficient=1.0)

This model only implements the cohesion force of the Akinci [Akinci2013](@cite) surface tension model.

Expand All @@ -21,7 +21,7 @@ struct CohesionForceAkinci{ELTYPE} <: AkinciTypeSurfaceTension
end

@doc raw"""
SurfaceTensionAkinci(surface_tension_coefficient=1.0)
SurfaceTensionAkinci(; surface_tension_coefficient=1.0)

Implements a model for surface tension and adhesion effects drawing upon the
principles outlined by Akinci [Akinci2013](@cite). This model is instrumental in capturing the nuanced
Expand All @@ -44,7 +44,7 @@ struct SurfaceTensionAkinci{ELTYPE} <: AkinciTypeSurfaceTension
end

@doc raw"""
SurfaceTensionMorris(surface_tension_coefficient=1.0)
SurfaceTensionMorris(; surface_tension_coefficient=1.0)

This model implements the surface tension approach described by Morris [Morris2000](@cite).
It calculates surface tension forces based on the curvature of the fluid interface
Expand Down Expand Up @@ -76,7 +76,7 @@ function create_cache_surface_tension(::SurfaceTensionMorris, ELTYPE, NDIMS, npa
end

@doc raw"""
SurfaceTensionMomentumMorris(surface_tension_coefficient=1.0)
SurfaceTensionMomentumMorris(; surface_tension_coefficient=1.0)

This model implements the momentum-conserving surface tension approach outlined by Morris
[Morris2000](@cite). It calculates surface tension forces using the divergence of a stress
Expand Down
2 changes: 1 addition & 1 deletion src/schemes/fluid/weakly_compressible_sph/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
buffer_size=nothing,
correction=nothing, source_terms=nothing,
surface_tension=nothing, surface_normal_method=nothing,
reference_particle_spacing=0.0, color_value=1))
reference_particle_spacing=0.0, color_value=1)

System for particles of a fluid.
The weakly compressible SPH (WCSPH) scheme is used, wherein a stiff equation of state
Expand Down
4 changes: 2 additions & 2 deletions src/schemes/structure/discrete_element_method/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ initialize!(system::DEMSystem, semi) = system

function compact_support(system::DEMSystem, neighbor::DEMSystem)
# we for now assume that the compact support is 3 * radius
# todo: needs to be changed for more complex simulations
# TODO: needs to be changed for more complex simulations
return 3 * max(maximum(system.radius), maximum(neighbor.radius))
end

function compact_support(system::DEMSystem, neighbor)
# we for now assume that the compact support is 3 * radius
# todo: needs to be changed for more complex simulations
# TODO: needs to be changed for more complex simulations
return 3 * maximum(system.radius)
end

Expand Down
2 changes: 1 addition & 1 deletion src/setups/complex_shape.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ComplexShape(geometry::Union{TriangleMesh, Polygon}; particle_spacing, density,
pressure=0.0, mass=nothing, velocity=zeros(ndims(geometry)),
point_in_geometry_algorithm=WindingNumberJacobson(; geometry,
hierarchical_winding=false,
hierarchical_winding=true,
winding_number_factor=sqrt(eps())),
grid_offset::Real=0.0, max_nparticles=10^7,
pad_initial_particle_grid=2particle_spacing)
Expand Down
2 changes: 1 addition & 1 deletion src/setups/extrude_geometry.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@doc raw"""
extrude_geometry(geometry; particle_spacing, direction, n_extrude::Integer,
velocity=zeros(length(direction)),
velocity=zeros(length(direction)), place_on_shell=false,
mass=nothing, density=nothing, pressure=0.0)

Extrude either a line, a plane or a shape along a specific direction.
Expand Down