Skip to content

Commit

Permalink
Merge branch 'main' into update-callback
Browse files Browse the repository at this point in the history
  • Loading branch information
LasNikas authored Apr 5, 2024
2 parents d587376 + 2bff6c4 commit daf750d
Show file tree
Hide file tree
Showing 25 changed files with 706 additions and 135 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/typos@v1.18.2
uses: crate-ci/typos@v1.19.0
30 changes: 30 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Security Policy

The Trixi.jl development team takes security issues seriously. We appreciate
all efforts to responsibly disclose any security issues and will make every
effort to acknowledge contributions.


## Supported Versions

The current stable release following the interpretation of
[semantic versioning (SemVer)](https://julialang.github.io/Pkg.jl/dev/compatibility/#Version-specifier-format-1)
used in the Julia ecosystem is supported with security updates.


## Reporting a Vulnerability

To report a security issue, please use the GitHub Security Advisory
["Report a Vulnerability"](https://github.com/trixi-framework/TrixiParticles.jl/security/advisories/new)
tab.

We will send a response indicating the next steps in handling your report.
After the initial reply to your report, we will keep you informed of the
progress towards a fix and full announcement, and may ask for additional
information or guidance.

Please report security bugs in third-party modules directly to the person
or team maintaining the module.

Public notifications of vulnerabilities will be shared in community channels
such as Slack.
6 changes: 4 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,19 @@ DocMeta.setdocmeta!(TrixiParticles, :DocTestSetup, :(using TrixiParticles); recu
makedocs(sitename="TrixiParticles.jl",
# Run doctests and check docs for the following modules
modules=[TrixiParticles],
format=Documenter.HTML(),
# Explicitly specify documentation structure
pages=[
"Home" => "index.md",
"News" => "news.md",
"Installation" => "install.md",
"Getting started" => "getting_started.md",
"Development" => "development.md",
"Tutorial" => "tutorial.md",
"Examples" => "examples.md",
"Visualization" => "visualization.md",
"Components" => [
"Overview" => "overview.md",
"General" => [
"Semidiscretization" => joinpath("general", "semidiscretization.md"),
"Initial Condition and Setups" => joinpath("general",
Expand Down Expand Up @@ -132,5 +135,4 @@ makedocs(sitename="TrixiParticles.jl",
])

deploydocs(repo="github.com/trixi-framework/TrixiParticles.jl",
devbranch="main",
push_preview=true)
devbranch="main", push_preview=true)
23 changes: 23 additions & 0 deletions docs/src/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# [Development](@id development)


## Preview of the documentation

To generate the Documentation, first instantiate the `docs` environment
by executing the following command from the TrixiParticles.jl root directory:
```bash
julia --project=docs -e "using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()"
```
This command only has to be run once. After that, maintain the `docs` environment
as described under [Installation](@ref installation-issues).

With an instantiated `docs` environment, generate the docs with the following command (again from the TrixiParticles.jl root directory):
```bash
julia --project=docs --color=yes docs/make.jl
```
You can then open the generated files in `docs/build` with your webbrowser.
Alternatively, run
```bash
python3 -m http.server -d docs/build
```
and open `localhost:8000` in your webbrowser.
64 changes: 59 additions & 5 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,68 @@
# Examples


## Fluid

### Accelerated Tank 2D (`fluid/accelerated_tank_2d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/4c4c537a-8585-4456-9a1b-8b5adbf68533" width="60%"/>
```

## Structure Mechanics

### Dam Break 2D (`fluid/dam_break_2d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/683e9363-5705-49cc-9a5c-3b47d73ea4b8" width="60%"/>
```

### Dam Break 3D (`fluid/dam_break_3d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/76a2b235-1b49-465f-a207-76859410b783" width="60%"/>
```

### Falling Water Column (`fluid/falling_water_column_2d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/06a522f0-424f-49d3-afd0-29593373aa29" width="60%"/>
```

### Hydrostatic Water Column (`fluid/hydrostatic_water_column_*.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/fac6c41f-7af8-4936-9dd5-b6ff2b9f6ff4" width="60%"/>
```

### Moving Wall (`fluid/moving_wall_2d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/c10faddf-0400-47c9-b225-f5d286a8ecb8" width="60%"/>
```

### Oscillating Drop (`fluid/oscillating_drop_2d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/1dfa9dcf-7fc1-4221-ad83-a54c5d9ab9fb" width="60%"/>
```

### Periodic Channel (`fluid/periodic_channel_2d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/f9a542bf-956b-4647-843b-94cbb085a4fa" width="60%"/>
```

## Fluid Structure Interaction

### Dam Break with Elastic Plate (`fsi/dam_break_plate_2d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/ada0d554-e0ba-44ed-923d-2b77ef252258" width="60%"/>
```

### Falling Sphere 2D (`fsi/falling_sphere_2d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/217c80b5-3472-41c9-8003-7163641dd452" width="60%"/>
```

### Falling Spheres 2D (`fsi/falling_spheres_2d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/b3964f68-2782-43e6-b6ff-be96f9f224ae" width="60%"/>
```

## Structure Mechanics

## Postprocessing

### Oscillating Beam (`solid/oscillating_beam_2d.jl`)
```@raw html
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/e05ace63-e330-441a-a391-eda3d2764074" width="60%"/>
```

27 changes: 25 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,36 @@ TrixiParticles.jl is a numerical simulation framework designed for particle-base
- VTK

## Examples

```@raw html
<table align="center" border="0">
<tr>
<td align="center">
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/683e9363-5705-49cc-9a5c-3b47d73ea4b8" style="width: 80% !important;"/><br><figcaption>2D Dam Break</figcaption>
</td>
<td align="center">
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/c10faddf-0400-47c9-b225-f5d286a8ecb8" style="width: 80% !important;"/><br><figcaption>Moving Wall</figcaption>
</td>
</tr>
<tr>
<td align="center">
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/e05ace63-e330-441a-a391-eda3d2764074" style="width: 80% !important;"/><br><figcaption>Oscillating Beam</figcaption>
</td>
<td align="center">
<img src="https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/ada0d554-e0ba-44ed-923d-2b77ef252258" style="width: 80% !important;"/><br><figcaption>Dam Break with Elastic Plate</figcaption>
</td>
</tr>
</table>
```

## Quickstart
1. [Installation](@ref installation)
2. [Getting started](@ref getting_started)

If you have any questions concerning **TrixiParticles.jl** you can join our community [on Slack](https://join.slack.com/t/trixi-framework/shared_invite/zt-sgkc6ppw-6OXJqZAD5SPjBYqLd8MU~g) or open an issue with your question.

## Start with development
To get started with development have a look at these pages:

1. [Installation](@ref installation)
2. [Contributing](@ref)
2. [Development](@ref development)
3. [Contributing](@ref)
2 changes: 1 addition & 1 deletion docs/src/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ and always have a reproducible environment at hand to share with others.
- [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
## [Common issues](@id installation-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,
Expand Down
23 changes: 23 additions & 0 deletions docs/src/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Overview
The following page gives a rough overview of important parts of the code.

## Program flow

To initiate a simulation, the goal is to solve an ordinary differential equation, for example,
by employing the time integration schemes provided by OrdinaryDiffEq.jl. These schemes are then
utilized to integrate ``\mathrm{d}u/\mathrm{d}t`` and ``\mathrm{d}v/\mathrm{d}t``, where ``u``
represents the particles' positions and ``v`` their properties such as velocity and density.
During a single time step or an intermediate step of the time integration scheme, the functions
`drift!` and `kick!` are invoked, followed by the functions depicted in this diagram
(with key parts highlighted in orange/yellow).

![Main Program Flow](https://github.com/trixi-framework/TrixiParticles.jl/assets/10238714/d7c6eedd-7173-4879-b62e-3e6d4bc5091f)


## Structure
What we refer to as schemes are various models such as Weakly Compressible Smoothed Particle Hydrodynamics (WCSPH)
or Total Lagrangian Smoothed Particle Hydrodynamics (TLSPH). These schemes are categorized based on the applicable
physical regimes, namely fluid, solid, gas, and others. Each scheme comprises at least two files: a `system.jl` file
and an `rhs.jl` file. The `system.jl` file provides the data structure holding the particles of this scheme and some
routines, particularly those for allocation and the main update routines, excluding system interactions.
The interactions between particles of this scheme (and with particles of other schemes) are handled in the `rhs.jl` file.
7 changes: 6 additions & 1 deletion examples/fluid/periodic_channel_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator,
# ==========================================================================================
# ==== Boundary
boundary_density_calculator = AdamiPressureExtrapolation()
viscosity_wall = nothing
# Activate to switch to no-slip walls
#viscosity_wall = ViscosityAdami(nu=0.0025 * smoothing_length * sound_speed / 8)

boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass,
state_equation=state_equation,
boundary_density_calculator,
smoothing_kernel, smoothing_length)
smoothing_kernel, smoothing_length,
viscosity=viscosity_wall)

boundary_system = BoundarySPHSystem(tank.boundary, boundary_model)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fluid_particle_spacing = 0.01
n_particles_x = 5

# Change spacing ratio to 3 and boundary layers to 1 when using Monaghan-Kajtar boundary model
boundary_layers = 3
boundary_layers = 4
spacing_ratio = 1

# ==========================================================================================
Expand All @@ -29,7 +29,7 @@ tank_size = 4 .* initial_fluid_size
fluid_density = 1000.0
sound_speed = 20 * sqrt(gravity * initial_fluid_size[2])
state_equation = StateEquationCole(; sound_speed, reference_density=fluid_density,
exponent=7)
exponent=1)

tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fluid_density,
n_layers=boundary_layers, spacing_ratio=spacing_ratio,
Expand Down Expand Up @@ -65,8 +65,8 @@ solid = union(plate, fixed_particles)

# ==========================================================================================
# ==== Fluid
smoothing_length = 1.2 * fluid_particle_spacing
smoothing_kernel = SchoenbergCubicSplineKernel{2}()
smoothing_length = 3.5 * fluid_particle_spacing
smoothing_kernel = WendlandC2Kernel{2}()

fluid_density_calculator = ContinuityDensity()
viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0)
Expand Down
2 changes: 1 addition & 1 deletion examples/fsi/falling_sphere_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ trixi_include(@__MODULE__,
joinpath(examples_dir(), "fsi", "falling_spheres_2d.jl"),
solid_system_2=nothing, fluid_particle_spacing=0.02,
initial_fluid_size=(1.0, 0.9), tank_size=(1.0, 1.0),
tspan=(0.0, 2.0), abstol=1e-6, reltol=1e-3)
tspan=(0.0, 1.0), abstol=1e-6, reltol=1e-3)
2 changes: 1 addition & 1 deletion examples/fsi/falling_sphere_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ trixi_include(@__MODULE__,
sphere_type=RoundSphere(),
output_directory="out", prefix="",
write_meta_data=false, # Files with meta data can't be read by meshio
tspan=(0.0, 2.0), abstol=1e-6, reltol=1e-3)
tspan=(0.0, 1.0), abstol=1e-6, reltol=1e-3)
2 changes: 1 addition & 1 deletion examples/fsi/falling_spheres_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spacing_ratio = 1
# ==========================================================================================
# ==== Experiment Setup
gravity = 9.81
tspan = (0.0, 2.0)
tspan = (0.0, 1.0)

# Boundary geometry and initial fluid particle positions
initial_fluid_size = (2.0, 0.9)
Expand Down
2 changes: 1 addition & 1 deletion src/TrixiParticles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export GridNeighborhoodSearch, TrivialNeighborhoodSearch
export examples_dir, validation_dir, trixi_include
export trixi2vtk
export RectangularTank, RectangularShape, SphereShape
export VoxelSphere, RoundSphere, reset_wall!
export VoxelSphere, RoundSphere, reset_wall!, extrude_geometry
export SourceTermDamping
export ShepardKernelCorrection, KernelCorrection, AkinciFreeSurfaceCorrection,
GradientCorrection, BlendedGradientCorrection, MixedKernelGradientCorrection
Expand Down
15 changes: 12 additions & 3 deletions src/general/file_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ function system_names(systems)
end

function get_git_hash()
pkg_directory = pkgdir(@__MODULE__)
git_directory = joinpath(pkg_directory, ".git")

# Check if the .git directory exists
if !isdir(git_directory)
return "UnknownVersion"
end

try
return string(readchomp(Cmd(`git describe --tags --always --first-parent --dirty`,
dir=pkgdir(@__MODULE__))))
git_cmd = Cmd(`git describe --tags --always --first-parent --dirty`,
dir=pkg_directory)
return string(readchomp(git_cmd))
catch e
return "Git is not installed or not accessible"
return "UnknownVersion"
end
end
Loading

0 comments on commit daf750d

Please sign in to comment.