Skip to content

Commit

Permalink
Merge branch 'main' into save_TLSPH
Browse files Browse the repository at this point in the history
  • Loading branch information
efaulhaber authored Feb 6, 2024
2 parents 50a5b5d + 58fc2b0 commit 4d06ca8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
21 changes: 19 additions & 2 deletions docs/src/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
```
4 changes: 2 additions & 2 deletions examples/fsi/dam_break_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions examples/fsi/dam_break_gate_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
30 changes: 26 additions & 4 deletions examples/solid/oscillating_beam_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
E, nu, nothing, #No boundary model
Expand All @@ -60,7 +61,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)

Expand Down

0 comments on commit 4d06ca8

Please sign in to comment.