Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
20c9e72
add automatic reordering
Sep 30, 2025
da82198
fix typo
Sep 30, 2025
07671f4
Merge branch 'main' into automatic-ordering-clamped-particles
Sep 30, 2025
51affb8
revise docs
Sep 30, 2025
270dd86
indentation
Sep 30, 2025
b1b813d
Merge branch 'main' into automatic-ordering-clamped-particles
Oct 2, 2025
1ad1a2b
add tests
Oct 2, 2025
6263795
Merge branch 'main' into automatic-ordering-clamped-particles
Oct 6, 2025
1c71c74
Merge branch 'main' into automatic-ordering-clamped-particles
Oct 8, 2025
09cf86b
Merge branch 'main' into automatic-ordering-clamped-particles
Oct 10, 2025
aff99ba
Merge branch 'main' into automatic-ordering-clamped-particles
Oct 13, 2025
37310d2
add vector variant
Oct 14, 2025
d2b8fa7
force unique indices
Oct 14, 2025
f5816a2
Merge branch 'main' into automatic-ordering-clamped-particles
Oct 14, 2025
1304c97
Merge branch 'main' into automatic-ordering-clamped-particles
Oct 22, 2025
88b09e3
add depwarning
Oct 22, 2025
ed33304
drop `n_particles_clamped`
Oct 22, 2025
93a5372
Merge branch 'main' into automatic-ordering-clamped-particles
Oct 27, 2025
c3c2d13
fix regex
Oct 28, 2025
8935c64
Merge branch 'automatic-ordering-clamped-particles' into drop-n_clamp…
Oct 28, 2025
ffaf028
rm regex
Oct 28, 2025
7604078
fix again
Oct 28, 2025
407ef63
implement suggestions
Oct 28, 2025
aa26aa7
apply formatter
Oct 28, 2025
2d2ce7e
Merge branch 'main' into automatic-ordering-clamped-particles
Oct 29, 2025
0e33f31
fix examples
Oct 29, 2025
2133216
fix
Oct 29, 2025
7f84978
implement suggestions
Oct 30, 2025
34f4c3b
rm datatype restriction
Oct 30, 2025
acd73df
implement suggestions
Oct 31, 2025
79fc6aa
adapt example files
Oct 31, 2025
3434c40
Merge branch 'automatic-ordering-clamped-particles' into drop-n_clamp…
Oct 31, 2025
1d57f11
Merge branch 'dev' into drop-n_clamped_particles
Apr 17, 2026
7ec3b4a
fix merge conflict
Apr 17, 2026
b4438d5
fix again
Apr 17, 2026
b0ea29c
Merge branch 'dev' into drop-n_clamped_particles
LasNikas Apr 20, 2026
1c31aa1
fix unit tests
Apr 20, 2026
f9a7b4f
fix tests
Apr 20, 2026
f711b24
fix tests
Apr 21, 2026
ae506ab
Merge branch 'dev' into drop-n_clamped_particles
LasNikas Apr 21, 2026
a3a79da
add docs
Apr 22, 2026
f109608
remove unnecessary info
Apr 22, 2026
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: 2 additions & 2 deletions examples/fsi/hydrostatic_water_column_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ right_wall = RectangularShape(structure_particle_spacing, (3, n_particles_plate_
place_on_shell=true)
fixed_particles = union(left_wall, right_wall)

structure_geometry = union(plate, fixed_particles)
structure_geometry = union(fixed_particles, plate)

# ==========================================================================================
# ==== Smoothing Kernel, Boundary, and Related Quantities
Expand Down Expand Up @@ -127,7 +127,7 @@ boundary_model_structure = BoundaryModelDummyParticles(hydrodynamic_densities,
structure_system = TotalLagrangianSPHSystem(structure_geometry, smoothing_kernel,
smoothing_length_structure,
E, nu, boundary_model=boundary_model_structure,
n_clamped_particles=nparticles(fixed_particles),
clamped_particles=1:nparticles(fixed_particles),
acceleration=(0.0, -gravity))

min_corner = min.(minimum(structure_geometry.coordinates, dims=2),
Expand Down
43 changes: 8 additions & 35 deletions src/schemes/structure/total_lagrangian_sph/system.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@doc raw"""
TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, smoothing_length,
young_modulus, poisson_ratio;
n_clamped_particles=0,
clamped_particles=Int[],
clamped_particles_motion=nothing,
acceleration=ntuple(_ -> 0.0, NDIMS),
Expand All @@ -26,11 +25,6 @@ See [Total Lagrangian SPH](@ref tlsph) for more details on the method.
See [Smoothing Kernels](@ref smoothing_kernel).

# Keywords
- `n_clamped_particles` (deprecated): Number of clamped particles that are fixed and not integrated
to clamp the structure. Note that the clamped particles must be the **last**
particles in the `InitialCondition`. See the info box below.
This keyword is deprecated and will be removed in a future release.
Instead pass `clamped_particles` with the explicit particle indices to be clamped.
- `clamped_particles`: Indices specifying the clamped particles that are fixed
and not integrated to clamp the structure.
- `clamped_particles_motion`: Prescribed motion of the clamped particles.
Expand Down Expand Up @@ -63,24 +57,17 @@ See [Total Lagrangian SPH](@ref tlsph) for more details on the method.
Alternatively, a user-defined neighborhood search can be passed here.

!!! note
If specifying the clamped particles manually (via `n_clamped_particles`),
the clamped particles must be the **last** particles in the `InitialCondition`.
To do so, e.g. use the `union` function:
To define `clamped_particles` conveniently, place the clamped block first and combine
initial conditions with `union`:
```jldoctest; output = false, setup = :(clamped_particles = RectangularShape(0.1, (1, 4), (0.0, 0.0), density=1.0); beam = RectangularShape(0.1, (3, 4), (0.1, 0.0), density=1.0))
structure = union(beam, clamped_particles)
structure = union(clamped_particles, beam)
clamped_particle_indices = 1:nparticles(clamped_particles)

# output
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ InitialCondition │
│ ════════════════ │
│ #dimensions: ……………………………………………… 2 │
│ #particles: ………………………………………………… 16 │
│ particle spacing: ………………………………… 0.1 │
│ eltype: …………………………………………………………… Float64 │
│ coordinate eltype: ……………………………… Float64 │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
1:4
```
where `beam` and `clamped_particles` are of type [`InitialCondition`](@ref).
Comment thread
efaulhaber marked this conversation as resolved.
Since `clamped_particles` is the first argument, these particles appear first in
`structure`, so their indices are `1:nparticles(clamped_particles)`.
"""
struct TotalLagrangianSPHSystem{BM, NDIMS, ELTYPE <: Real, IC, ARRAY1D, ARRAY2D, ARRAY3D,
YM, PR, LL, LM, K, PF, V, ST, M, IM, NHS,
Expand Down Expand Up @@ -114,7 +101,6 @@ end

function TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, smoothing_length,
young_modulus, poisson_ratio;
n_clamped_particles=0,
clamped_particles=Int[],
clamped_particles_motion=nothing,
acceleration=ntuple(_ -> zero(eltype(initial_condition)),
Expand All @@ -136,20 +122,6 @@ function TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, smoothing
throw(ArgumentError("`acceleration` must be of length $NDIMS for a $(NDIMS)D problem"))
end

# Backwards compatibility: `n_clamped_particles` is deprecated.
# Emit a deprecation warning and (if the user didn't supply explicit indices)
# convert the old `n_clamped_particles` convention to `clamped_particles`.
if n_clamped_particles != 0
Base.depwarn("keyword `n_clamped_particles` is deprecated and will be removed in a future release; " *
"pass `clamped_particles` (Vector{Int} of indices) instead.",
:n_clamped_particles)
if isempty(clamped_particles)
clamped_particles = collect((n_particles - n_clamped_particles + 1):n_particles)
else
throw(ArgumentError("Either `n_clamped_particles` or `clamped_particles` can be specified, not both."))
end
end

# Handle clamped particles
if !isempty(clamped_particles)
@assert allunique(clamped_particles) "`clamped_particles` contains duplicate particle indices"
Expand All @@ -162,6 +134,7 @@ function TotalLagrangianSPHSystem(initial_condition, smoothing_kernel, smoothing
move_particles_to_end!(young_modulus_sorted, clamped_particles)
move_particles_to_end!(poisson_ratio_sorted, clamped_particles)
else
n_clamped_particles = 0
initial_condition_sorted = initial_condition
young_modulus_sorted = young_modulus
poisson_ratio_sorted = poisson_ratio
Expand Down
6 changes: 0 additions & 6 deletions test/examples/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,6 @@
"hydrostatic_water_column_2d.jl"),
tspan=(0.0, 0.1), n_particles_plate_y=3) [
r"\[ Info: To create the self-interaction neighborhood search.*\n",
r"┌ Warning: keyword `n_clamped_particles` is deprecated.*\n",
r"│ caller = ip:0x0\n",
r"└ @ Core :-1\n"
]
@test sol.retcode == ReturnCode.Success
if VERSION < v"1.12"
Expand Down Expand Up @@ -334,9 +331,6 @@
tspan=(0.0, 0.1), n_particles_plate_y=3,
use_edac=true) [
r"\[ Info: To create the self-interaction neighborhood search.*\n",
r"┌ Warning: keyword `n_clamped_particles` is deprecated.*\n",
r"│ caller = ip:0x0\n",
r"└ @ Core :-1\n"
]
@test sol.retcode == ReturnCode.Success
if VERSION < v"1.12"
Expand Down
3 changes: 0 additions & 3 deletions test/validation/validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@
n_particles_plate_y=3) [
r"┌ Info: The desired tank length in y-direction.*\n",
r"└ New tank length in y-direction is set to.*\n",
r"┌ Warning: keyword `n_clamped_particles` is deprecated.*\n",
r"│ caller = ip:0x0\n",
r"└ @ Core :-1\n",
r"\[ Info: To create the self-interaction neighborhood search.*\n"
]

Expand Down
Loading