Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
0f75713
working
svchb Feb 18, 2025
79ade1a
update
svchb Feb 19, 2025
54bee9b
add more reference files
svchb Feb 19, 2025
82e6fdd
change style
svchb Feb 19, 2025
5defb55
update
svchb Feb 19, 2025
0459622
update
svchb Feb 19, 2025
c10e468
with error plots
svchb Feb 19, 2025
5fb5b4e
working
svchb Feb 19, 2025
b5a4b22
update
svchb Feb 20, 2025
12d8054
update
svchb Feb 20, 2025
2ea2a33
update
svchb Feb 20, 2025
ef60adf
cleanup
svchb Feb 20, 2025
151ef4b
format
svchb Feb 21, 2025
e192cc0
Merge branch 'main' into validation_hydrostatic_water_column
svchb Feb 21, 2025
ddac0e9
format
svchb Feb 21, 2025
5be95b7
Merge branch 'validation_hydrostatic_water_column' of github.com:svch…
svchb Feb 21, 2025
37dffdf
remove statistics package dependency
svchb Feb 21, 2025
bd575b8
increase error
svchb Feb 21, 2025
ad2cddc
update files
svchb Feb 23, 2025
e513dc0
format
svchb Feb 23, 2025
35b3e00
fix file path
svchb Feb 23, 2025
0e38347
increase errors
svchb Feb 23, 2025
06a217c
larger error
svchb Feb 24, 2025
662723a
increase error
svchb Feb 24, 2025
821f763
another try
svchb Feb 24, 2025
2972b07
Merge branch 'main' into validation_hydrostatic_water_column
svchb Mar 26, 2025
a87b3d2
Merge branch 'main' into validation_hydrostatic_water_column
svchb Apr 4, 2025
83e5598
Merge branch 'main' into validation_hydrostatic_water_column
svchb Apr 15, 2025
3ae5db6
Merge branch 'main' into validation_hydrostatic_water_column
svchb Apr 17, 2025
244a94f
Merge branch 'main' into validation_hydrostatic_water_column
svchb May 16, 2025
2452933
Merge branch 'main' into validation_hydrostatic_water_column
svchb Jun 25, 2025
45b607f
replace trixi_test_nowarn
svchb Jun 26, 2025
24b1924
Merge branch 'main' into validation_hydrostatic_water_column
svchb Jul 2, 2025
6f69766
update
svchb Jul 3, 2025
265ce07
Merge branch 'validation_hydrostatic_water_column' of https://github.…
svchb Jul 3, 2025
7fda2f1
fix
svchb Jul 4, 2025
b3920de
update
svchb Jul 17, 2025
8e6e621
add convenience scripts
svchb Jul 18, 2025
5ad9325
update
svchb Jul 18, 2025
ca683b5
add test mode
svchb Jul 18, 2025
4ebd3a3
update
svchb Jul 18, 2025
fe71153
escape command
svchb Jul 18, 2025
66fdad6
update
svchb Jul 18, 2025
9df122c
adjust naming
svchb Jul 18, 2025
ab93cb3
update
svchb Jul 18, 2025
6bf3969
update
svchb Jul 18, 2025
bb6674a
format
svchb Jul 18, 2025
81b8e93
update
svchb Jul 19, 2025
9b6707e
remove srun
svchb Jul 19, 2025
348f42a
update
svchb Jul 21, 2025
3296349
update
svchb Jul 21, 2025
84c5428
add new validation reference files
svchb Jul 21, 2025
7ddc0f1
update time estimate
svchb Jul 21, 2025
42f8cb0
Merge branch 'main' into validation_hydrostatic_water_column
svchb Jul 21, 2025
da29a88
review comments
svchb Jul 21, 2025
537f525
Merge branch 'validation_hydrostatic_water_column' of https://github.…
svchb Jul 21, 2025
e490f41
format
svchb Jul 21, 2025
06aeb6c
update
svchb Jul 21, 2025
2480dca
update
svchb Jul 21, 2025
c776947
split into example
svchb Jul 21, 2025
4ca11be
update
svchb Jul 21, 2025
606d854
remove 2nd tspan
svchb Jul 30, 2025
d7920e0
format
svchb Jul 30, 2025
8564459
Merge branch 'main' into validation_hydrostatic_water_column
svchb Jul 30, 2025
9bf15a5
Merge branch 'main' into validation_hydrostatic_water_column
svchb Jan 21, 2026
222e8b1
Remove left over files from merge
svchb Jan 21, 2026
a8bcde1
revert changes
svchb Jan 21, 2026
442e63a
fix problems with new version
svchb Jan 21, 2026
ddfbf78
Merge branch 'main' into validation_hydrostatic_water_column
svchb Jan 21, 2026
067aa87
update style
svchb Jan 21, 2026
b5778e7
refactor: rename solid_density and solid_particle_spacing to structur…
svchb Jan 21, 2026
52be78f
refactor: rename local_state_equation to state_equation for consistency
svchb Jan 21, 2026
502e325
Update examples/fsi/hydrostatic_water_column_2d.jl
svchb Jan 21, 2026
1184eb2
Update examples/fsi/hydrostatic_water_column_2d.jl
svchb Jan 21, 2026
758c578
Update test/validation/validation.jl
svchb Jan 21, 2026
c0b492e
Merge branch 'validation_hydrostatic_water_column' of https://github.…
svchb Jan 21, 2026
acaab98
adjust comment style
svchb Jan 23, 2026
79941d3
remove semicolons
svchb Jan 23, 2026
1a887bc
remove for now
svchb Jan 23, 2026
4d223f0
cleanup
svchb Jan 23, 2026
92c9577
format
svchb Jan 23, 2026
6952b4a
Merge branch 'main' into validation_hydrostatic_water_column
svchb Jan 23, 2026
e181304
renaming
svchb Jan 23, 2026
290ead4
update
svchb Jan 23, 2026
2e78106
fix
svchb Feb 2, 2026
afae8e8
remove comment
svchb Feb 2, 2026
63347b4
Merge branch 'main' into validation_hydrostatic_water_column
svchb Feb 2, 2026
8036cb3
update
svchb Feb 2, 2026
3102254
Merge branch 'validation_hydrostatic_water_column' of https://github.…
svchb Feb 2, 2026
3803c9a
switch to split integration
svchb Feb 2, 2026
d5a28fa
format
svchb Feb 2, 2026
4a060ab
suppress warning
svchb Feb 3, 2026
9750794
update
svchb Feb 3, 2026
d8d87f3
Merge branch 'main' into validation_hydrostatic_water_column
svchb Feb 3, 2026
ba8b642
fix grammar
svchb Feb 3, 2026
2f8db52
Merge branch 'validation_hydrostatic_water_column' of https://github.…
svchb Feb 3, 2026
7c397e0
update
svchb Feb 3, 2026
e8e4edf
more suppression
svchb Feb 3, 2026
1c22253
format
svchb Feb 3, 2026
a27211e
run the example as well
svchb Feb 20, 2026
6a57999
Remove obsolete validation reference files for hydrostatic water colu…
svchb Feb 20, 2026
d12c336
Merge branch 'main' into validation_hydrostatic_water_column
svchb Feb 20, 2026
c922d73
Reformat
svchb Feb 20, 2026
127b267
Merge branch 'validation_hydrostatic_water_column' of https://github.…
svchb Feb 20, 2026
9a535f9
fix tests
svchb Feb 20, 2026
29cb130
remove dt
svchb Feb 20, 2026
145576f
update tolerance for wcsph error in hydrostatic_water_column test
svchb Feb 20, 2026
7fbdc95
remove txt
svchb Feb 23, 2026
a673aba
remove error functions
svchb Feb 23, 2026
02b3f1d
update split integration callback to use Carpenter-Kennedy2N54 and ad…
svchb Feb 23, 2026
d5ea990
refactor kinetic_energy function
svchb Feb 23, 2026
0813410
update tolerance for edac error in hydrostatic_water_column test
svchb Feb 23, 2026
246fa29
Merge branch 'main' into validation_hydrostatic_water_column
svchb Feb 24, 2026
fd03767
Merge branch 'main' into validation_hydrostatic_water_column
svchb Feb 25, 2026
21fdff0
Merge branch 'main' into validation_hydrostatic_water_column
svchb Feb 28, 2026
85c4c98
Merge branch 'main' into validation_hydrostatic_water_column
svchb Mar 5, 2026
013fa96
fix solid to structure
svchb Mar 5, 2026
4557df9
hotfix
svchb Mar 5, 2026
74df4ea
fix the test
svchb Mar 5, 2026
fbd012b
format
svchb Mar 5, 2026
2966228
Merge branch 'main' into validation_hydrostatic_water_column
svchb Mar 6, 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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TrixiParticles"
uuid = "66699cd8-9c01-4e9d-a059-b96c86d16b3a"
version = "0.4.4-dev"
authors = ["erik.faulhaber <44124897+efaulhaber@users.noreply.github.com>"]
version = "0.4.4-dev"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
160 changes: 160 additions & 0 deletions examples/fsi/hydrostatic_water_column_2d.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# ==========================================================================================
# 2D Hydrostatic Water Column on an Elastic Plate (FSI)
#
# Case "Elastic plate under a hydrostatic water column" as described in
# "A fluid–structure interaction model for free-surface flows and flexible structures
# using smoothed particle hydrodynamics on a GPU" by J. O'Connor and B.D. Rogers
# published in Journal of Fluids and Structures
# https://doi.org/10.1016/j.jfluidstructs.2021.103312
# ==========================================================================================

using TrixiParticles
using OrdinaryDiffEq
using JSON

# ==========================================================================================
# ==== Options
use_edac = true # Use EDAC or WCSPH

# ==========================================================================================
# ==== Experiment Parameters
# The paper uses 5 to 40 (3 for short runtime in CI)
n_particles_plate_y = 5
boundary_layers = 3
spacing_ratio = 1
gravity = 9.81
# Recommended: run at least to 0.5 (paper runs to 1.0); using 0.3 for speed in CI
Comment thread
svchb marked this conversation as resolved.
tspan = (0.0, 0.5)

initial_fluid_size = (1.0, 2.0)
plate_size = (1.0, 0.05)

fluid_density = 1000.0
structure_density = 2700.0

E = 67.5e9
nu = 0.3
sound_speed = 50.0

# Particle spacings (structure and fluid share same spacing)
structure_particle_spacing = plate_size[2] / (n_particles_plate_y - 1)
fluid_particle_spacing = structure_particle_spacing
boundary_particle_spacing = fluid_particle_spacing / spacing_ratio

# Analytical solution (constant)
D = E * plate_size[2]^3 / (12 * (1 - nu^2))
analytical_value = -0.0026 * gravity *
(fluid_density * initial_fluid_size[2] +
structure_density * plate_size[2]) / D

# ==========================================================================================
# ==== Geometry Definitions: Tank, Beam, and Fixed Particles
n_particles_plate_x = round(Int, plate_size[1] / structure_particle_spacing + 1)
n_particles_per_dimension = (n_particles_plate_x, n_particles_plate_y)

plate = RectangularShape(structure_particle_spacing, n_particles_per_dimension,
(0.0, -plate_size[2]), density=structure_density,
place_on_shell=true)

left_wall = RectangularShape(structure_particle_spacing, (3, n_particles_plate_y),
(-3 * structure_particle_spacing, -plate_size[2]),
density=structure_density, place_on_shell=true)
right_wall = RectangularShape(structure_particle_spacing, (3, n_particles_plate_y),
(plate_size[1] + structure_particle_spacing,
-plate_size[2]), density=structure_density,
place_on_shell=true)
fixed_particles = union(left_wall, right_wall)

structure_geometry = union(plate, fixed_particles)

# ==========================================================================================
# ==== Smoothing Kernel, Boundary, and Related Quantities
smoothing_kernel = WendlandC2Kernel{2}()
smoothing_length_structure = sqrt(2) * structure_particle_spacing

smoothing_length_fluid = sqrt(2) * fluid_particle_spacing

hydrodynamic_densities = fluid_density * ones(size(structure_geometry.density))
hydrodynamic_masses = hydrodynamic_densities *
structure_particle_spacing^ndims(structure_geometry)
boundary_density_calculator = AdamiPressureExtrapolation()

# ==========================================================================================
# ==== Run Simulations
state_equation = use_edac ? nothing :
StateEquationCole(; sound_speed, reference_density=fluid_density,
exponent=7, clip_negative_pressure=false)

tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, (plate_size[1], 3.0),
min_coordinates=(0.0, fluid_particle_spacing / 2),
fluid_density, n_layers=boundary_layers,
spacing_ratio=spacing_ratio,
faces=(true, true, false, false),
acceleration=(0.0, -gravity),
state_equation=state_equation)

if use_edac
fluid_system = EntropicallyDampedSPHSystem(tank.fluid, smoothing_kernel,
smoothing_length_fluid, sound_speed,
acceleration=(0.0, -gravity),
correction=ShepardKernelCorrection(),
source_terms=SourceTermDamping(;
damping_coefficient=0.05))
else
fluid_density_calculator = ContinuityDensity()
density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1)
Comment thread
efaulhaber marked this conversation as resolved.
# density_diffusion = DensityDiffusionAntuono(tank.fluid, delta=0.1)
fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator,
state_equation, smoothing_kernel,
smoothing_length_fluid,
density_diffusion=density_diffusion,
acceleration=(0.0, -gravity),
source_terms=SourceTermDamping(;
damping_coefficient=0.05))
end

boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass,
state_equation=state_equation,
boundary_density_calculator,
smoothing_kernel, smoothing_length_fluid)
boundary_system = WallBoundarySystem(tank.boundary, boundary_model)
boundary_model_structure = BoundaryModelDummyParticles(hydrodynamic_densities,
hydrodynamic_masses,
state_equation=state_equation,
boundary_density_calculator,
smoothing_kernel,
smoothing_length_structure)
structure_system = TotalLagrangianSPHSystem(structure_geometry, smoothing_kernel,
smoothing_length_structure,
E, nu, boundary_model=boundary_model_structure,
n_clamped_particles=nparticles(fixed_particles),
acceleration=(0.0, -gravity))

min_corner = min.(minimum(structure_geometry.coordinates, dims=2),
minimum(tank.boundary.coordinates, dims=2),
minimum(tank.fluid.coordinates, dims=2)) .- smoothing_length_fluid
max_corner = max.(maximum(structure_geometry.coordinates, dims=2),
maximum(tank.boundary.coordinates, dims=2),
maximum(tank.fluid.coordinates, dims=2)) .+ smoothing_length_fluid

cell_list = FullGridCellList(; min_corner, max_corner)
neighborhood_search = GridNeighborhoodSearch{2}(; update_strategy=ParallelUpdate(),
cell_list)
semi = Semidiscretization(structure_system, fluid_system, boundary_system,
neighborhood_search=neighborhood_search,
parallelization_backend=PolyesterBackend())
ode = semidiscretize(semi, tspan)

split_integration = SplitIntegrationCallback(CarpenterKennedy2N54(williamson_condition=false),
callback=StepsizeCallback(cfl=1.6),
dt=1.0) # dt will be overwritten by the stepsize cb

Comment thread
svchb marked this conversation as resolved.
# This can be overwritten with `trixi_include`
extra_callback = nothing

info_callback = InfoCallback(interval=100)
saving_callback = SolutionSavingCallback(dt=0.1, prefix="")
callbacks = CallbackSet(info_callback, saving_callback, split_integration, extra_callback)

sol = solve(ode, RDPK3SpFSAL49(), dt=1e-8, reltol=1e-6, save_everystep=false,
callback=callbacks)
5 changes: 5 additions & 0 deletions src/callbacks/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ function set_callbacks_used!(semi, integrator)
return semi
end

function set_callbacks_used!(p::NamedTuple{(:v_ode, :u_ode, :semi, :semi_split)},
integrator)
set_callbacks_used!(p.semi_split, integrator)
end

include("info.jl")
include("solution_saving.jl")
include("density_reinit.jl")
Expand Down
12 changes: 12 additions & 0 deletions src/general/custom_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ function kinetic_energy(system, dv_ode, du_ode, v_ode, u_ode, semi, t)
end
end

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
end
end

Comment thread
svchb marked this conversation as resolved.
function kinetic_energy(system::AbstractBoundarySystem,
dv_ode, du_ode, v_ode, u_ode, semi, t)
return zero(eltype(system))
Expand Down
2 changes: 1 addition & 1 deletion src/schemes/schemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include("structure/discrete_element_method/discrete_element_method.jl")
# Monaghan-Kajtar repulsive boundary particles require the `WallBoundarySystem`
# and the `TotalLagrangianSPHSystem`.
include("boundary/wall_boundary/monaghan_kajtar.jl")
# Implicit incompressible SPH requires the `BoundarySPHSystem`
# Implicit incompressible SPH requires the `WallBoundarySystem`
include("fluid/implicit_incompressible_sph/implicit_incompressible_sph.jl")

# Include rhs for all schemes
Expand Down
40 changes: 40 additions & 0 deletions test/examples/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,46 @@
@test count_rhs_allocations(sol, semi) == 0
end
end

@trixi_testset "fsi/hydrostatic_water_column_2d.jl" begin
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(examples_dir(), "fsi",
"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"
# Older Julia versions produce allocations because `get_neighborhood_search`
# is not type-stable with TLSPH.
@test count_rhs_allocations(sol, semi) < 500
else
@test count_rhs_allocations(sol, semi) == 0
end
end
@trixi_testset "fsi/hydrostatic_water_column_2d.jl with EDAC" begin
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(examples_dir(), "fsi",
"hydrostatic_water_column_2d.jl"),
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"
# Older Julia versions produce allocations because `get_neighborhood_search`
# is not type-stable with TLSPH.
@test count_rhs_allocations(sol, semi) < 500
else
@test count_rhs_allocations(sol, semi) == 0
end
end
end

@testset verbose=true "N-Body" begin
Expand Down
3 changes: 2 additions & 1 deletion test/systems/tlsph_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@
for particle in TrixiParticles.eachparticle(system)
system.deformation_grad[:, :, particle] = [1.0 0.2; 0.2 1.0]
system.pk1_rho2[:, :,
particle] = [1.0 0.5; 0.5 1.0] / material_densities[particle]^2
particle] = [1.0 0.5; 0.5 1.0] /
material_densities[particle]^2
end

von_mises_stress = TrixiParticles.von_mises_stress(system)
Expand Down
18 changes: 18 additions & 0 deletions test/validation/validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@
@test length(axs_wcsph[1].scene.plots) >= 2
end

@trixi_testset "hydrostatic_water_column_2d" begin
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(),
"hydrostatic_water_column_2d",
"validation.jl"), tspan=(0.0, 0.3),
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",
Comment thread
svchb marked this conversation as resolved.
r"\[ Info: To create the self-interaction neighborhood search.*\n"
]

# We compare the relative error to the analytical solution
@test isapprox(errors[:edac][2], 0.0, atol=0.033)
@test isapprox(errors[:wcsph][2], 0.0, atol=0.045)
end
@trixi_testset "TGV_2D" begin
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(),
Expand Down
Loading
Loading