Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize surface normal calc #539

Open
wants to merge 235 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 221 commits
Commits
Show all changes
235 commits
Select commit Hold shift + click to select a range
f90f017
Merge remote-tracking branch 'origin/main' into main
svchb Sep 5, 2023
372d67c
Merge branch 'trixi-framework:main' into main
svchb Sep 7, 2023
f564478
Merge branch 'main' of github.com:svchb/TrixiParticles.jl
svchb Sep 20, 2023
9c9e182
Merge branch 'trixi-framework:main' into main
svchb Sep 25, 2023
90897f6
Merge branch 'main' of github.com:svchb/TrixiParticles.jl
svchb Sep 29, 2023
1df6912
Merge branch 'main' of github.com:svchb/TrixiParticles.jl
svchb Oct 5, 2023
6449b5f
Merge branch 'main' of github.com:svchb/TrixiParticles.jl
svchb Oct 10, 2023
439210f
merge by hand
svchb Oct 11, 2023
b31640f
Merge branch 'HEAD' into ipf_surface_tension
svchb Jan 25, 2024
675c030
Merge branch 'HEAD' into ipf_surface_tension
svchb Jan 25, 2024
2b0b09c
Merge branch 'HEAD' into ipf_surface_tension
svchb Jan 25, 2024
b812869
Merge branch 'HEAD' into ipf_surface_tension
svchb Jan 25, 2024
c3884d7
Merge branch 'HEAD' into ipf_surface_tension
svchb Jan 25, 2024
45938eb
Merge branch 'HEAD' into ipf_surface_tension
svchb Jan 25, 2024
3bdfc20
Merge tag 'HEAD' into ipf_surface_tension
svchb Jan 25, 2024
de4f0e8
Merge branch 'conflict1'
svchb Jan 25, 2024
c49dd87
fix merge problems
svchb Jan 25, 2024
780cee3
fix merge
svchb Jan 25, 2024
7550c3d
fix merge
svchb Jan 25, 2024
87c21b9
fix merge
svchb Jan 25, 2024
9cab05f
fix merge
svchb Jan 25, 2024
896faef
fix merge
svchb Jan 25, 2024
b567c55
more merge fixes
svchb Jan 25, 2024
3de9a75
format
svchb Jan 25, 2024
06a1223
fix
svchb Jan 25, 2024
31d4404
fix
svchb Jan 25, 2024
a95a54a
fix
svchb Jan 25, 2024
ce74643
fix
svchb Jan 25, 2024
17da7ef
fix
svchb Jan 25, 2024
f002d2b
more fixes
svchb Jan 25, 2024
120eb80
fix
svchb Jan 25, 2024
31208ad
fix
svchb Jan 25, 2024
81591ad
fix
svchb Jan 25, 2024
066f967
more fixes
svchb Jan 25, 2024
df6e1ac
fix
svchb Jan 25, 2024
b58fbca
Merge branch 'main'
svchb Jan 25, 2024
df44891
fix
svchb Jan 25, 2024
bd8cd98
Merge branch 'main' into ipf_surface_tension
svchb Mar 21, 2024
23d72d8
format
svchb Mar 21, 2024
82d6b71
running
svchb Mar 21, 2024
3338a3f
update
svchb Mar 21, 2024
eae775c
update
svchb Mar 21, 2024
53e6afd
optimization
svchb Mar 22, 2024
75983ac
update
svchb Mar 22, 2024
3aec5c6
update
svchb Mar 22, 2024
651790c
update
svchb Mar 25, 2024
f721ac2
update
svchb Mar 25, 2024
e4b9a75
format
svchb Mar 25, 2024
66f2a03
up
svchb Mar 26, 2024
d4893fb
update
svchb Mar 27, 2024
e95151d
remove unused code
svchb Apr 2, 2024
8c8a3cc
Merge branch 'ipf_surface_tension' of github.com:svchb/TrixiParticles…
svchb Apr 2, 2024
4bd3c22
switch to support radius
svchb Apr 2, 2024
79fac64
update
svchb Apr 2, 2024
af7c748
fix doc
svchb Apr 2, 2024
ccde44a
add adhesion coefficient
svchb Apr 2, 2024
dd53390
update_broken
svchb Apr 3, 2024
7e504a9
update
svchb Apr 3, 2024
2d230bf
format
svchb Apr 4, 2024
d0d6408
add to examples
svchb Apr 4, 2024
6ddd51c
fix tests
svchb Apr 4, 2024
dbfc4db
Merge branch 'main' into ipf_surface_tension
svchb Apr 4, 2024
35a3e3e
fix merge
svchb Apr 4, 2024
43b45f4
fix typos
svchb Apr 4, 2024
a5e3ab1
add basic test
svchb Apr 4, 2024
4e2059d
format
svchb Apr 4, 2024
08c662e
rename
svchb Apr 4, 2024
a9a5b98
format
svchb Apr 4, 2024
6060b04
rename container system
svchb Apr 4, 2024
fb762b9
reduce example run time
svchb Apr 5, 2024
9685cdb
update news and readme
svchb Apr 5, 2024
a6892f4
format
svchb Apr 5, 2024
f598b98
fix test
svchb Apr 5, 2024
d2303ec
reduce run time
svchb Apr 5, 2024
bb68e90
format
svchb Apr 5, 2024
1fbc7cb
Merge branch 'main' into ipf_surface_tension
svchb Apr 19, 2024
5a59211
fix
svchb Apr 19, 2024
451e1e6
correct merge
svchb Apr 19, 2024
755e768
update doc test
svchb Apr 19, 2024
aaf3bd9
revert
svchb Apr 19, 2024
f50d436
Merge branch 'main'
svchb May 3, 2024
493c6ea
Merge branch 'main'
svchb May 3, 2024
c0c1227
fix tests
svchb May 3, 2024
8031c01
fix
svchb May 3, 2024
f9dfe29
Merge branch 'main' into ipf_surface_tension
svchb May 7, 2024
14c7999
fix
svchb May 7, 2024
a00f254
review comments
svchb May 7, 2024
367f2fa
fix
svchb May 7, 2024
e9be23a
fix
svchb May 7, 2024
4626383
correct some stuff
svchb May 7, 2024
03618b9
init with empty initial condition
svchb May 7, 2024
6a5f5ad
Merge branch 'main' into ipf_surface_tension
svchb May 10, 2024
ab72434
review update
svchb May 13, 2024
a4e3d92
rename function
svchb May 13, 2024
fc6432f
Merge branch 'ipf_surface_tension' of https://github.com/svchb/TrixiP…
svchb May 13, 2024
f5c59dd
remove unnecessary if
svchb May 13, 2024
702e833
docs
svchb May 13, 2024
89af7de
fix doc
svchb May 13, 2024
3e0ca33
revert one change
svchb May 13, 2024
050e42d
fix typo
svchb May 13, 2024
67630d6
update
svchb May 13, 2024
2f25b28
try to avoid allocs
svchb May 14, 2024
d0c5d2d
fix mem allocs
svchb May 15, 2024
069be49
review update
svchb May 16, 2024
4ba6e9c
update docs
svchb May 16, 2024
15a3446
update
svchb May 16, 2024
56678f4
Merge branch 'main' into ipf_surface_tension
svchb May 16, 2024
b8c4d89
Merge remote-tracking branch 'upstream/main'
svchb May 16, 2024
0409873
Merge branch 'main' into ipf_surface_tension
svchb May 17, 2024
ed1fca0
review
svchb May 22, 2024
414adcf
Merge branch 'main' into ipf_surface_tension
svchb May 23, 2024
cde0fa5
fix
svchb May 24, 2024
7d778a7
format
svchb May 24, 2024
fd523fc
Merge remote-tracking branch 'upstream/main'
svchb May 27, 2024
cc992b6
Merge branch 'ipf_surface_tension' of https://github.com/svchb/TrixiP…
svchb May 27, 2024
707c4ab
make examples smaller
svchb May 27, 2024
70ff163
reduce resolution
svchb May 27, 2024
4d1062f
review
svchb May 27, 2024
5a26313
rename
svchb May 27, 2024
760eddb
use trixi_include
svchb May 27, 2024
5c40040
format
svchb May 27, 2024
624d66f
use trixi_include
svchb May 27, 2024
1692242
update
svchb May 27, 2024
3c0f684
update
svchb May 27, 2024
c8cd876
review update
svchb May 27, 2024
a197fbe
Merge branch 'main' into ipf_surface_tension
svchb May 27, 2024
78e99e1
format
svchb May 27, 2024
dfbcf2b
Merge branch 'ipf_surface_tension' of https://github.com/svchb/TrixiP…
svchb May 27, 2024
51c2ec0
fix test errors
svchb May 27, 2024
8f78cd4
update
svchb May 27, 2024
a795fbc
fix
svchb May 28, 2024
b6a62d7
remove invalid surface normals
svchb May 28, 2024
63535a6
add
svchb May 28, 2024
7a2d704
Merge branch 'main' of github.com:svchb/TrixiParticles.jlOpen
svchb May 29, 2024
63537a6
Merge branch 'main'
svchb May 29, 2024
7bbb3a5
fix
svchb May 30, 2024
ff84aea
update
svchb May 30, 2024
7aa1e84
update
svchb Jun 18, 2024
06976eb
Merge branch 'main' into generalize_surface_normal_calc
svchb Jul 16, 2024
341886d
update
svchb Jul 16, 2024
61e3325
fix
svchb Jul 16, 2024
c53246d
update
svchb Jul 17, 2024
6bc5567
update
svchb Jul 18, 2024
c017b45
update
svchb Jul 22, 2024
6de5f70
remove unused
svchb Jul 22, 2024
3a083a6
remove unused
svchb Jul 22, 2024
f759fb3
format
svchb Jul 22, 2024
1c5d0aa
Merge branch 'main' into generalize_surface_normal_calc
svchb Jul 22, 2024
54dc3ed
fix tests
svchb Jul 22, 2024
0326b98
fix
svchb Jul 22, 2024
dbb9d75
Merge branch 'main' into generalize_surface_normal_calc
svchb Jul 26, 2024
643dfa8
fix
svchb Jul 26, 2024
50dc742
fix naming
svchb Jul 26, 2024
7a77c11
format
svchb Jul 26, 2024
1969525
fix test
svchb Jul 29, 2024
ed83ea1
set test up for 1.11
svchb Aug 8, 2024
5142d13
Merge branch 'main' into generalize_surface_normal_calc
svchb Aug 8, 2024
493e26b
Merge branch 'main' into prepare_for_1.11
svchb Aug 12, 2024
1c1cd58
Merge branch 'main' into generalize_surface_normal_calc
svchb Aug 12, 2024
612fd43
fix test
svchb Aug 13, 2024
35b7c4a
rename to number_density
svchb Aug 14, 2024
3733c21
back merge
svchb Aug 14, 2024
e1fc1bb
fix
svchb Aug 15, 2024
04595af
format
svchb Aug 15, 2024
7b91e09
fix
svchb Aug 15, 2024
0acdcc5
fix tests
svchb Aug 15, 2024
d14fd19
Merge branch 'main' into generalize_surface_normal_calc
svchb Sep 25, 2024
bb12fb8
back merge from #584
svchb Sep 27, 2024
f84cafa
move additonal changes from #584
svchb Sep 27, 2024
7cbfd72
add test
svchb Sep 27, 2024
528c2fd
add test
svchb Sep 30, 2024
a4381aa
format
svchb Sep 30, 2024
eab774a
Merge branch 'main' into generalize_surface_normal_calc
svchb Sep 30, 2024
31b2f75
Merge branch 'main' into prepare_for_1.11
svchb Oct 9, 2024
1d05304
Merge branch 'main' into prepare_for_1.11
svchb Oct 9, 2024
4ed0b91
Increase errors for 1.11
svchb Oct 9, 2024
1ce0460
Fix invalidations
svchb Oct 9, 2024
1774f5a
Fix tests
svchb Oct 9, 2024
4daf984
Update ci.yml
svchb Oct 9, 2024
ac2eb2c
revert
svchb Oct 9, 2024
258f2ba
Update ci.yml
svchb Oct 9, 2024
1a9f3f5
Update test/validation/validation.jl
svchb Oct 10, 2024
8946b45
Merge branch 'main' into generalize_surface_normal_calc
svchb Oct 10, 2024
ddfab3e
Merge remote-tracking branch 'origin/prepare_for_1.11' into generaliz…
svchb Oct 10, 2024
76e5354
Merge branch 'main' into generalize_surface_normal_calc
svchb Oct 11, 2024
e079dc0
Merge remote-tracking branch 'refs/remotes/origin/main'
svchb Nov 13, 2024
b4c5ace
format
svchb Nov 13, 2024
0b3043c
Update news and set to 0.2.4
svchb Nov 13, 2024
3335386
update
svchb Nov 13, 2024
7d4016c
fix MD format
svchb Nov 13, 2024
c47850b
Update NEWS.md
svchb Nov 14, 2024
d5e7c63
Merge branch 'main' into generalize_surface_normal_calc
svchb Nov 17, 2024
514ffcf
Merge branch 'main' into generalize_surface_normal_calc
svchb Nov 18, 2024
223bcd0
Merge branch 'main' into generalize_surface_normal_calc
svchb Nov 18, 2024
d9227bb
some fixes
svchb Nov 19, 2024
3c5fd08
add docs
svchb Nov 19, 2024
969dedd
review fixes
svchb Nov 19, 2024
c6371eb
remove independent setting of smoothing_kernel and smoothing_length
svchb Nov 19, 2024
4bf25e6
remove calls to surface_normal method smoothing kernel
svchb Nov 19, 2024
ebf6602
format
svchb Nov 19, 2024
8659850
Merge branch 'main' into generalize_surface_normal_calc
svchb Nov 19, 2024
5b0ed25
Merge branch 'generalize_surface_normal_calc' of https://github.com/s…
svchb Nov 19, 2024
7a6331e
update news
svchb Nov 19, 2024
3c80adf
typo
svchb Nov 19, 2024
d09b163
Update NEWS.md
svchb Nov 19, 2024
593c746
forgot some renames
svchb Nov 19, 2024
ba69a80
fix doc tests
svchb Nov 19, 2024
67d5b87
fix docs
svchb Nov 19, 2024
f276a7b
fix tests
svchb Nov 19, 2024
b17a629
format
svchb Nov 19, 2024
537df19
Merge branch 'main' into generalize_surface_normal_calc
svchb Nov 20, 2024
20b77d7
Update NEWS.md
svchb Nov 20, 2024
d7b6af1
fix tests
svchb Nov 20, 2024
01bddb0
Merge branch 'generalize_surface_normal_calc' of https://github.com/s…
svchb Nov 20, 2024
dc6fa70
Update NEWS.md
svchb Nov 20, 2024
ffc83d3
Merge branch 'main'
svchb Nov 20, 2024
e424cfa
Merge branch 'main' into generalize_surface_normal_calc
svchb Nov 20, 2024
041861e
fix
svchb Nov 20, 2024
21f08b2
fix
svchb Nov 21, 2024
0b63bca
fix
svchb Nov 21, 2024
b7f448c
fix
svchb Nov 21, 2024
f4fbbb3
Merge branch 'main' into generalize_surface_normal_calc
svchb Dec 2, 2024
589d416
review fixes
svchb Dec 2, 2024
1263e1a
Merge branch 'generalize_surface_normal_calc' of https://github.com/s…
svchb Dec 2, 2024
dd56f47
review comments
svchb Dec 4, 2024
306f96d
Merge branch 'generalize_surface_normal_calc' of https://github.com/s…
svchb Dec 4, 2024
93630aa
fix test
svchb Dec 4, 2024
9f758be
typo
svchb Dec 4, 2024
cd26885
Merge branch 'main' into generalize_surface_normal_calc
svchb Dec 12, 2024
80e51ba
review updates
svchb Dec 12, 2024
4721aec
review update
svchb Dec 12, 2024
98a5f6c
add boundary system
svchb Dec 13, 2024
e05edea
update
svchb Dec 13, 2024
36741d7
update
svchb Dec 13, 2024
ba8765f
format
svchb Dec 13, 2024
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
35 changes: 35 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,85 @@
TrixiParticles.jl follows the interpretation of [semantic versioning (semver)](https://julialang.github.io/Pkg.jl/dev/compatibility/#Version-specifier-format-1)
used in the Julia ecosystem. Notable changes will be documented in this file for human readability.

## Version 0.2.4

### Features

- Support for surface tension was added to EDAC (#539)
- A method to prevent penetration of fast moving particles with solids was added (#498)
- Added the callback `SteadyStateReachedCallback` to detect converging simulations (#601)
svchb marked this conversation as resolved.
Show resolved Hide resolved
- Added Ideal Gas State Equation (#607)

### Documentation

- GPU Support Documentation was added (#660)
- A new user tutorial was added (#514)

### Fixes

- Diverse Doc fixes (#663, #659, #637, #658, #664)
- Simulations can be run with `Float32` (#662)

### Refactored

- Surface normal calculation was moved from surface_tension.jl to surface_normal_sph.jl (#539)

## Version 0.2.3

### Highlights

Transport Velocity Formulation (TVF) based on the work of Ramachandran et al. "Entropically damped artificial compressibility for SPH" (2019) was added.

## Version 0.2.2

### Highlights

Hotfix for threaded sampling of complex geometries.

## Version 0.2.1

### Highlights

Particle sampling of complex geometries from `.stl` and `.asc` files.

## Version 0.2.0

### Removed

Use of the internal neighborhood search has been removed and replaced with PointNeighbors.jl.

## Development Cycle 0.1

### Highlights

#### Discrete Element Method

A basic implementation of the discrete element method was added.

#### Surface Tension and Adhesion Model

A surface tension and adhesion model based on the work by Akinci et al., "Versatile Surface Tension and Adhesion for SPH Fluids" (2013) was added to WCSPH.

#### Support for Open Boundaries

Open boundaries using the method of characteristics based on the work of Lastiwka et al., "Permeable and non-reflecting boundary conditions in SPH" (2009) were added for WCSPH and EDAC.

## Pre Initial Release (v0.1.0)

This section summarizes the initial features that TrixiParticles.jl was released with.

### Highlights
#### EDAC

An implementation of EDAC (Entropically Damped Artificial Compressibility) was added,
which allows for more stable simulations compared to basic WCSPH and reduces spurious pressure oscillations.

#### WCSPH

An implementation of WCSPH (Weakly Compressible Smoothed Particle Hydrodynamics), which is the classical SPH approach.

Features:

- Correction schemes (Shepard (0. Order) ... MixedKernelGradient (1. Order))
- Density reinitialization
- Kernel summation and Continuity equation density formulations
Expand All @@ -57,4 +91,5 @@ Features:


#### TLSPH

An implementation of TLSPH (Total Lagrangian Smoothed Particle Hydrodynamics) for solid bodies enabling FSI (Fluid Structure Interactions).
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"
authors = ["erik.faulhaber <44124897+efaulhaber@users.noreply.github.com>"]
version = "0.2.4-dev"
version = "0.2.4"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes more sense to wait for #529 before we release.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on how long that still will take...


[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ makedocs(sitename="TrixiParticles.jl",
"Util" => joinpath("general", "util.md")
],
"Systems" => [
"Discrete Element Method (Solid)" => joinpath("systems",
"dem.md"),
"Fluid Models" => joinpath("systems", "fluid.md"),
"Discrete Element Method (Solid)" => joinpath("systems", "dem.md"),
"Weakly Compressible SPH (Fluid)" => joinpath("systems",
"weakly_compressible_sph.md"),
"Entropically Damped Artificial Compressibility for SPH (Fluid)" => joinpath("systems",
Expand Down
71 changes: 71 additions & 0 deletions docs/src/systems/fluid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# [Fluid Models](@id fluid_models)
In the following are common models for fluid effects that are used by both EDAC and WCSPH.
svchb marked this conversation as resolved.
Show resolved Hide resolved


## [Surface Normals](@id surface_normal)
```@autodocs
Modules = [TrixiParticles]
Pages = [joinpath("schemes", "fluid", "surface_normal_sph.jl")]
```

## [Surface Tension](@id surface_tension)

### Akinci-based intra-particle force surface tension and wall adhesion model
The work by Akinci proposes three forces:
- a cohesion force
- a surface area minimization force
- a wall adhesion force

The classical model is composed of the curvature minimization and cohesion force.

#### Cohesion force
The model calculates the cohesion force based on the distance between particles and the support radius ``h_c``.
This force is determined using two distinct regimes within the support radius:
- For particles closer than half the support radius,
a repulsive force is calculated to prevent particle clustering too tightly,
enhancing the simulation's stability and realism.
- Beyond half the support radius and within the full support radius,
an attractive force is computed, simulating the effects of surface tension that draw particles together.
The cohesion force, ``F_{\text{cohesion}}``, for a pair of particles is given by:
```math
F_{\text{cohesion}} = -\sigma m_b C(r) \frac{r}{\Vert r \Vert},
```
where:
- ``\sigma`` represents the surface tension coefficient, adjusting the overall strength of the cohesion effect.
- ``C`` is a scalar function of the distance between particles.

The cohesion kernel ``C`` is defined as
```math
C(r)=\frac{32}{\pi h_c^9}
\begin{cases}
(h_c-r)^3 r^3, & \text{if } 2r > h_c \\
2(h_c-r)^3 r^3 - \frac{h^6}{64}, & \text{if } r > 0 \text{ and } 2r \leq h_c \\
0, & \text{otherwise}
\end{cases}
```

#### Surface area minimization force
To model the minimization of the surface area and curvature of the fluid, a curvature force is used, which is calculated as
```math
F_{\text{curvature}} = -\sigma (n_a - n_b)
```

#### Wall adhesion force
The wall adhesion model proposed by Akinci et al. is based on a kernel function which is 0 from 0.0 to 0.5 support radiia with a maximum at 0.75.
With the force calculated with an adhesion coefficient ``\beta`` as
```math
F_{\text{adhesion}} = -\beta m_b A(r) \frac{r}{\Vert r \Vert},
```
with ``A`` being the adhesion kernel defined as
```math
A(r)= \frac{0.007}{h_c^{3.25}}
\begin{cases}
\sqrt[4]{- \frac{4r^2}{h_c} + 6r - 2h_c}, & \text{if } 2r > h_c \text{ and } r \leq h_c \\
0, & \text{otherwise.}
\end{cases}
```

```@autodocs
Modules = [TrixiParticles]
Pages = [joinpath("schemes", "fluid", "surface_tension.jl")]
```
61 changes: 0 additions & 61 deletions docs/src/systems/weakly_compressible_sph.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,64 +126,3 @@ Modules = [TrixiParticles]
Pages = [joinpath("general", "corrections.jl")]
```

## [Surface Tension](@id surface_tension)

### Akinci-based intra-particle force surface tension and wall adhesion model
The work by Akinci proposes three forces:
- a cohesion force
- a surface area minimization force
- a wall adhesion force

The classical model is composed of the curvature minimization and cohesion force.

#### Cohesion force
The model calculates the cohesion force based on the distance between particles and the support radius ``h_c``.
This force is determined using two distinct regimes within the support radius:
- For particles closer than half the support radius,
a repulsive force is calculated to prevent particle clustering too tightly,
enhancing the simulation's stability and realism.
- Beyond half the support radius and within the full support radius,
an attractive force is computed, simulating the effects of surface tension that draw particles together.
The cohesion force, ``F_{\text{cohesion}}``, for a pair of particles is given by:
```math
F_{\text{cohesion}} = -\sigma m_b C(r) \frac{r}{\Vert r \Vert},
```
where:
- ``\sigma`` represents the surface tension coefficient, adjusting the overall strength of the cohesion effect.
- ``C`` is a scalar function of the distance between particles.

The cohesion kernel ``C`` is defined as
```math
C(r)=\frac{32}{\pi h_c^9}
\begin{cases}
(h_c-r)^3 r^3, & \text{if } 2r > h_c \\
2(h_c-r)^3 r^3 - \frac{h^6}{64}, & \text{if } r > 0 \text{ and } 2r \leq h_c \\
0, & \text{otherwise}
\end{cases}
```

#### Surface area minimization force
To model the minimization of the surface area and curvature of the fluid, a curvature force is used, which is calculated as
```math
F_{\text{curvature}} = -\sigma (n_a - n_b)
```

#### Wall adhesion force
The wall adhesion model proposed by Akinci et al. is based on a kernel function which is 0 from 0.0 to 0.5 support radiia with a maximum at 0.75.
With the force calculated with an adhesion coefficient ``\beta`` as
```math
F_{\text{adhesion}} = -\beta m_b A(r) \frac{r}{\Vert r \Vert},
```
with ``A`` being the adhesion kernel defined as
```math
A(r)= \frac{0.007}{h_c^{3.25}}
\begin{cases}
\sqrt[4]{- \frac{4r^2}{h_c} + 6r - 2h_c}, & \text{if } 2r > h_c \text{ and } r \leq h_c \\
0, & \text{otherwise.}
\end{cases}
```

```@autodocs
Modules = [TrixiParticles]
Pages = [joinpath("schemes", "fluid", "surface_tension.jl")]
```
3 changes: 2 additions & 1 deletion examples/fluid/dam_break_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator,
smoothing_length, viscosity=viscosity,
density_diffusion=density_diffusion,
acceleration=(0.0, -gravity), correction=nothing,
surface_tension=nothing)
surface_tension=nothing,
reference_particle_spacing=fluid_particle_spacing)

# ==========================================================================================
# ==== Boundary
Expand Down
13 changes: 8 additions & 5 deletions examples/fluid/dam_break_oil_film_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ oil_viscosity = ViscosityMorris(nu=nu_sim_oil)
trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"),
sol=nothing, fluid_particle_spacing=fluid_particle_spacing,
viscosity=ViscosityMorris(nu=nu_sim_water), smoothing_length=smoothing_length,
gravity=gravity, density_diffusion=nothing, sound_speed=sound_speed)
gravity=gravity, tspan=tspan, density_diffusion=nothing,
sound_speed=sound_speed, prefix="")

# ==========================================================================================
# ==== Setup oil layer

oil_size = (W, 0.1 * H)
oil_density = 700.0
oil_eos = StateEquationCole(; sound_speed, reference_density=oil_density, exponent=1,
clip_negative_pressure=false)

oil = RectangularShape(fluid_particle_spacing,
round.(Int, oil_size ./ fluid_particle_spacing),
Expand All @@ -50,12 +53,12 @@ end
oil_state_equation = StateEquationCole(; sound_speed, reference_density=oil_density,
exponent=1, clip_negative_pressure=false)
oil_system = WeaklyCompressibleSPHSystem(oil, fluid_density_calculator,
oil_state_equation, smoothing_kernel,
oil_eos, smoothing_kernel,
smoothing_length, viscosity=oil_viscosity,
density_diffusion=density_diffusion,
acceleration=(0.0, -gravity),
surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.02),
correction=AkinciFreeSurfaceCorrection(oil_density))
surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.01),
correction=AkinciFreeSurfaceCorrection(oil_density),
reference_particle_spacing=fluid_particle_spacing)

# ==========================================================================================
# ==== Simulation
Expand Down
18 changes: 9 additions & 9 deletions examples/fluid/falling_water_spheres_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ sphere2 = SphereShape(fluid_particle_spacing, sphere_radius, sphere2_center,

# ==========================================================================================
# ==== Fluid
fluid_smoothing_length = 1.0 * fluid_particle_spacing
fluid_smoothing_length = 1.0 * fluid_particle_spacing - eps()
fluid_smoothing_kernel = SchoenbergCubicSplineKernel{2}()

fluid_density_calculator = ContinuityDensity()
Expand All @@ -50,13 +50,13 @@ alpha = 8 * nu / (fluid_smoothing_length * sound_speed)
viscosity = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0)
density_diffusion = DensityDiffusionAntuono(sphere2, delta=0.1)

sphere_surface_tension = WeaklyCompressibleSPHSystem(sphere1, fluid_density_calculator,
state_equation, fluid_smoothing_kernel,
sphere_surface_tension = EntropicallyDampedSPHSystem(sphere1, fluid_smoothing_kernel,
fluid_smoothing_length,
viscosity=viscosity,
sound_speed, viscosity=viscosity,
density_calculator=ContinuityDensity(),
acceleration=(0.0, -gravity),
surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.05),
correction=AkinciFreeSurfaceCorrection(fluid_density))
reference_particle_spacing=fluid_particle_spacing)

sphere = WeaklyCompressibleSPHSystem(sphere2, fluid_density_calculator,
state_equation, fluid_smoothing_kernel,
Expand All @@ -75,16 +75,16 @@ boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundar
viscosity=ViscosityAdami(nu=wall_viscosity))

boundary_system = BoundarySPHSystem(tank.boundary, boundary_model,
adhesion_coefficient=0.001)
adhesion_coefficient=1.0)

# ==========================================================================================
# ==== Simulation
semi = Semidiscretization(boundary_system, sphere_surface_tension, sphere)
semi = Semidiscretization(sphere_surface_tension, sphere, boundary_system)
ode = semidiscretize(semi, tspan)

info_callback = InfoCallback(interval=50)
saving_callback = SolutionSavingCallback(dt=0.01, output_directory="out", prefix="",
write_meta_data=true)
saving_callback = SolutionSavingCallback(dt=0.01, output_directory="out",
prefix="", write_meta_data=true)

callbacks = CallbackSet(info_callback, saving_callback)

Expand Down
16 changes: 8 additions & 8 deletions examples/fluid/falling_water_spheres_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ using OrdinaryDiffEq

# ==========================================================================================
# ==== Resolution
fluid_particle_spacing = 0.008
fluid_particle_spacing = 0.005

# ==========================================================================================
# ==== Experiment Setup
gravity = 9.81
nu = 0.01
nu = 0.001
fluid_density = 1000.0
sound_speed = 50

sphere1_radius = 0.05

sphere1_center = (0.5, 0.5, 0.2)
sphere2_center = (1.5, 0.5, 0.2)
sphere1_center = (0.5, 0.5, 0.075)
sphere2_center = (1.5, 0.5, 0.075)
sphere1 = SphereShape(fluid_particle_spacing, sphere1_radius, sphere1_center,
fluid_density, sphere_type=VoxelSphere(), velocity=(0.0, 0.0, -2.0))
fluid_density, sphere_type=VoxelSphere(), velocity=(0.0, 0.0, -1.0))
sphere2 = SphereShape(fluid_particle_spacing, sphere1_radius, sphere2_center,
fluid_density, sphere_type=VoxelSphere(), velocity=(0.0, 0.0, -2.0))
fluid_density, sphere_type=VoxelSphere(), velocity=(0.0, 0.0, -1.0))

# `compact_support` needs to be `2.0 * particle_spacing` to be correct
fluid_smoothing_length = 1.0 * fluid_particle_spacing

trixi_include(@__MODULE__,
joinpath(examples_dir(), "fluid", "falling_water_spheres_2d.jl"),
fluid_particle_spacing=fluid_particle_spacing, tspan=(0.0, 0.2),
fluid_particle_spacing=fluid_particle_spacing, tspan=(0.0, 0.1),
initial_fluid_size=(0.0, 0.0, 0.0),
tank_size=(2.0, 1.0, 0.1), sound_speed=sound_speed,
faces=(true, true, true, true, true, false),
acceleration=(0.0, 0.0, -gravity), sphere1=sphere1, sphere2=sphere2,
fluid_smoothing_length=fluid_smoothing_length,
fluid_smoothing_kernel=SchoenbergCubicSplineKernel{3}(),
nu=nu, alpha=10 * nu / (fluid_smoothing_length * sound_speed),
surface_tension_coefficient=1.5, adhesion_coefficient=0.5)
surface_tension_coefficient=10, adhesion_coefficient=0.1)
Loading
Loading