diff --git a/src/callbacks/density_reinit.jl b/src/callbacks/density_reinit.jl index ded47149f9..d1306f4de7 100644 --- a/src/callbacks/density_reinit.jl +++ b/src/callbacks/density_reinit.jl @@ -1,5 +1,6 @@ """ - 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). @@ -7,7 +8,7 @@ Callback to reinitialize the density field when using [`ContinuityDensity`](@ref - `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 diff --git a/src/callbacks/post_process.jl b/src/callbacks/post_process.jl index 42b85fd669..b2214cabd1 100644 --- a/src/callbacks/post_process.jl +++ b/src/callbacks/post_process.jl @@ -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. diff --git a/src/general/corrections.jl b/src/general/corrections.jl index 292523feb8..476b3af7fe 100644 --- a/src/general/corrections.jl +++ b/src/general/corrections.jl @@ -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). diff --git a/src/general/custom_quantities.jl b/src/general/custom_quantities.jl index 71c94dc528..b888b57d94 100644 --- a/src/general/custom_quantities.jl +++ b/src/general/custom_quantities.jl @@ -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 diff --git a/src/general/initial_condition.jl b/src/general/initial_condition.jl index f69f5b78d1..b59ca0e0f8 100644 --- a/src/general/initial_condition.jl +++ b/src/general/initial_condition.jl @@ -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 @@ -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 diff --git a/src/general/interpolation.jl b/src/general/interpolation.jl index fa77dab0e0..b0441374eb 100644 --- a/src/general/interpolation.jl +++ b/src/general/interpolation.jl @@ -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 diff --git a/src/preprocessing/geometries/polygon.jl b/src/preprocessing/geometries/polygon.jl index c56315b729..19047e28c5 100644 --- a/src/preprocessing/geometries/polygon.jl +++ b/src/preprocessing/geometries/polygon.jl @@ -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))") diff --git a/src/preprocessing/geometries/triangle_mesh.jl b/src/preprocessing/geometries/triangle_mesh.jl index ede02d4682..cbe0b3e79a 100644 --- a/src/preprocessing/geometries/triangle_mesh.jl +++ b/src/preprocessing/geometries/triangle_mesh.jl @@ -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))") diff --git a/src/preprocessing/point_in_poly/winding_number_jacobson.jl b/src/preprocessing/point_in_poly/winding_number_jacobson.jl index 145a6d9a28..9f6736a4cc 100644 --- a/src/preprocessing/point_in_poly/winding_number_jacobson.jl +++ b/src/preprocessing/point_in_poly/winding_number_jacobson.jl @@ -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", diff --git a/src/schemes/boundary/open_boundary/mirroring.jl b/src/schemes/boundary/open_boundary/mirroring.jl index 75b5029e25..07787d3ce7 100644 --- a/src/schemes/boundary/open_boundary/mirroring.jl +++ b/src/schemes/boundary/open_boundary/mirroring.jl @@ -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). diff --git a/src/schemes/boundary/wall_boundary/dummy_particles.jl b/src/schemes/boundary/wall_boundary/dummy_particles.jl index 9f5d8926a1..0db508779a 100644 --- a/src/schemes/boundary/wall_boundary/dummy_particles.jl +++ b/src/schemes/boundary/wall_boundary/dummy_particles.jl @@ -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`. diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index 33f80f43a4..68e36b8b8a 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -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, diff --git a/src/schemes/fluid/surface_tension.jl b/src/schemes/fluid/surface_tension.jl index 7a0232c51c..41b2613abe 100644 --- a/src/schemes/fluid/surface_tension.jl +++ b/src/schemes/fluid/surface_tension.jl @@ -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. @@ -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 @@ -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 @@ -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 diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index f84849f096..8465dec01e 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -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 diff --git a/src/schemes/structure/discrete_element_method/system.jl b/src/schemes/structure/discrete_element_method/system.jl index ecdd5a29a5..90b10bb013 100644 --- a/src/schemes/structure/discrete_element_method/system.jl +++ b/src/schemes/structure/discrete_element_method/system.jl @@ -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 diff --git a/src/setups/complex_shape.jl b/src/setups/complex_shape.jl index 55d3c996af..66e2a35df7 100644 --- a/src/setups/complex_shape.jl +++ b/src/setups/complex_shape.jl @@ -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) diff --git a/src/setups/extrude_geometry.jl b/src/setups/extrude_geometry.jl index 3ff618205f..0aad063968 100644 --- a/src/setups/extrude_geometry.jl +++ b/src/setups/extrude_geometry.jl @@ -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.