From c4d9c5fec8de046a0eebae50d792e6a81a2cbb3d Mon Sep 17 00:00:00 2001 From: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:00:16 +0100 Subject: [PATCH 1/2] Add docs for common issues with installation (#372) * Add docs for common issues with installation * Implement suggestions * Remove actions in root environment --------- Co-authored-by: Michael Schlottke-Lakemper --- docs/src/install.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/src/install.md b/docs/src/install.md index c633634f3..110aef029 100644 --- a/docs/src/install.md +++ b/docs/src/install.md @@ -30,11 +30,28 @@ The advantage of using a separate `run` directory is that you can also add other related packages (e.g., OrdinaryDiffEq.jl, see above) to the project in the `run` folder and always have a reproducible environment at hand to share with others. -## Optional Software/Packages -- [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) -- a Julia package of ordinary differential equation solvers that is used in the examples +## Optional software/packages +- [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) -- A Julia package of ordinary differential equation solvers that is used in the examples - [Plots.jl](https://github.com/JuliaPlots/Plots.jl) -- Julia Plotting library that is used in some examples - [PythonPlot.jl](https://github.com/JuliaPy/PythonPlot.jl) -- Plotting library that can be used instead of Plots.jl - [ParaView](https://www.paraview.org/) -- Software that can be used for visualization of results ## Common issues +If you followed the [installation instructions for developers](@ref for-developers) and you +run into any problems with packages when pulling the latest version of TrixiParticles.jl, +start Julia with the project in the `run` folder, +```bash + julia --project=run +``` +update all packages in that project, resolve all conflicts in the project, and install all +new dependencies: +```julia +julia> using Pkg + +julia> Pkg.update() + +julia> Pkg.resolve() + +julia> Pkg.instantiate() +``` From 58fc2b05d701cfae3054e21238490cc10157a1e9 Mon Sep 17 00:00:00 2001 From: Niklas Neher <73897120+LasNikas@users.noreply.github.com> Date: Tue, 6 Feb 2024 14:56:27 +0100 Subject: [PATCH 2/2] `WendlandC2Kernel` for `TotalLagrangianSPHSystem` (#371) * change kernel for tlsph * implement suggestions * implement suggestions --- examples/fsi/dam_break_2d.jl | 4 ++-- examples/fsi/dam_break_gate_2d.jl | 4 ++-- examples/solid/oscillating_beam_2d.jl | 30 +++++++++++++++++++++++---- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/examples/fsi/dam_break_2d.jl b/examples/fsi/dam_break_2d.jl index 1e886aff6..9e6a58506 100644 --- a/examples/fsi/dam_break_2d.jl +++ b/examples/fsi/dam_break_2d.jl @@ -88,8 +88,8 @@ boundary_system = BoundarySPHSystem(tank.boundary, boundary_model) # ========================================================================================== # ==== Solid -solid_smoothing_length = sqrt(2) * solid_particle_spacing -solid_smoothing_kernel = SchoenbergCubicSplineKernel{2}() +solid_smoothing_length = 2 * sqrt(2) * solid_particle_spacing +solid_smoothing_kernel = WendlandC2Kernel{2}() # For the FSI we need the hydrodynamic masses and densities in the solid boundary model hydrodynamic_densites = fluid_density * ones(size(solid.density)) diff --git a/examples/fsi/dam_break_gate_2d.jl b/examples/fsi/dam_break_gate_2d.jl index 0300cd529..d3a3e9d3a 100644 --- a/examples/fsi/dam_break_gate_2d.jl +++ b/examples/fsi/dam_break_gate_2d.jl @@ -117,8 +117,8 @@ boundary_system_gate = BoundarySPHSystem(gate, boundary_model_gate, movement=gat # ========================================================================================== # ==== Solid -solid_smoothing_length = sqrt(2) * solid_particle_spacing -solid_smoothing_kernel = SchoenbergCubicSplineKernel{2}() +solid_smoothing_length = 2 * sqrt(2) * solid_particle_spacing +solid_smoothing_kernel = WendlandC2Kernel{2}() # For the FSI we need the hydrodynamic masses and densities in the solid boundary model hydrodynamic_densites = fluid_density * ones(size(solid.density)) diff --git a/examples/solid/oscillating_beam_2d.jl b/examples/solid/oscillating_beam_2d.jl index 3791197ff..fc1ffc1c9 100644 --- a/examples/solid/oscillating_beam_2d.jl +++ b/examples/solid/oscillating_beam_2d.jl @@ -45,9 +45,10 @@ solid = union(beam, fixed_particles) # ========================================================================================== # ==== Solid - -smoothing_length = sqrt(2) * particle_spacing -smoothing_kernel = SchoenbergCubicSplineKernel{2}() +# The kernel in the reference uses a differently scaled smoothing length, +# so this is equivalent to the smoothing length of `sqrt(2) * particle_spacing` used in the paper. +smoothing_length = 2 * sqrt(2) * particle_spacing +smoothing_kernel = WendlandC2Kernel{2}() solid_system = TotalLagrangianSPHSystem(solid, smoothing_kernel, smoothing_length, @@ -62,7 +63,28 @@ semi = Semidiscretization(solid_system) ode = semidiscretize(semi, tspan) info_callback = InfoCallback(interval=100) -saving_callback = SolutionSavingCallback(dt=0.02, prefix="") + +# Track the position of the particle in the middle of the tip of the beam. +particle_id = Int(n_particles_per_dimension[1] * (n_particles_per_dimension[2] + 1) / 2) + +shift_x = beam.coordinates[1, particle_id] +shift_y = beam.coordinates[2, particle_id] + +function x_deflection(v, u, t, system) + particle_position = TrixiParticles.current_coords(u, system, particle_id) + + return particle_position[1] - shift_x +end + +function y_deflection(v, u, t, system) + particle_position = TrixiParticles.current_coords(u, system, particle_id) + + return particle_position[2] - shift_y +end + +saving_callback = SolutionSavingCallback(dt=0.02, prefix="", + x_deflection=x_deflection, + y_deflection=y_deflection) callbacks = CallbackSet(info_callback, saving_callback)