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

Implement Morris surface tension model #584

Open
wants to merge 439 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
439 commits
Select commit Hold shift + click to select a range
dcecbe0
fix tests
svchb Aug 21, 2024
6151f7f
fix tests
svchb Aug 21, 2024
83ebc5f
add exmaple
svchb Aug 21, 2024
aa9348c
format
svchb Aug 21, 2024
43e89fd
fix bug
svchb Aug 21, 2024
f65eb5a
fix
svchb Aug 22, 2024
da719c8
Merge remote-tracking branch 'origin/apply_samesys_dd' into fix_obs_f…
svchb Aug 22, 2024
1ba97a5
Merge remote-tracking branch 'origin/remove_soundspeed' into fix_obs_…
svchb Aug 22, 2024
3678983
Merge remote-tracking branch 'origin/skip_empty_system_io' into fix_o…
svchb Aug 22, 2024
b164e7a
Merge branch 'fix-moving-boundaries' into fix_obs_for_free_surface
svchb Aug 22, 2024
0091cc3
fix
svchb Aug 22, 2024
fbaf108
check dimensionality of reference functions
svchb Aug 23, 2024
e720529
propagate characteristics
svchb Aug 23, 2024
d14fd19
Merge branch 'main' into generalize_surface_normal_calc
svchb Sep 25, 2024
7400487
update
svchb Sep 27, 2024
c77b1cf
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Sep 27, 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
881c503
Merge remote-tracking branch 'origin/generalize_surface_normal_calc' …
svchb Sep 30, 2024
fb9a927
Merge branch 'main' into morris_surface_tension
svchb Oct 7, 2024
a2ca4c1
format
svchb Oct 7, 2024
318720c
fix typo
svchb Oct 7, 2024
5ebc4e7
Merge remote-tracking branch 'upstream/main' into fix_obs_for_free_su…
svchb Oct 7, 2024
7baeec4
Merge branch 'fix_obs_for_free_surface' into morris_surface_tension
svchb Oct 7, 2024
550146f
cleanup
svchb Oct 8, 2024
90766fe
update
svchb Oct 8, 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
139e282
Merge remote-tracking branch 'origin/prepare_for_1.11' into fix_obs_f…
svchb Oct 10, 2024
1a9f3f5
Update test/validation/validation.jl
svchb Oct 10, 2024
da9be38
revert changes that had no benefit
svchb Oct 10, 2024
95be0e9
update
svchb Oct 10, 2024
4b87c7c
cleanup
svchb Oct 10, 2024
8c72576
include in test run
svchb Oct 10, 2024
782f9de
remove redundancy
svchb Oct 10, 2024
fa45125
Merge branch 'main' into morris_surface_tension
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
f266682
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Oct 10, 2024
b0d24cc
Merge remote-tracking branch 'origin/prepare_for_1.11' into fix_obs_f…
svchb Oct 10, 2024
ff75223
Merge branch 'fix_obs_for_free_surface' into morris_surface_tension
svchb Oct 10, 2024
796b1d1
Merge branch 'main' into add_ideal_gas
svchb Oct 10, 2024
c402975
Merge remote-tracking branch 'origin/prepare_for_1.11' into add_ideal…
svchb Oct 10, 2024
83514da
Merge remote-tracking branch 'origin/add_ideal_gas' into add_ideal_gas
svchb Oct 10, 2024
e94218c
Merge branch 'add_ideal_gas'
svchb Oct 10, 2024
6f5ca10
revert
svchb Oct 10, 2024
5e688d2
fix tests
svchb Oct 11, 2024
7557879
fix
svchb Oct 11, 2024
83ba221
Merge remote-tracking branch 'origin/morris_surface_tension' into mor…
svchb Oct 11, 2024
b4f7a2e
Merge branch 'fix_obs_for_free_surface' into morris_surface_tension
svchb Oct 11, 2024
8294aa9
fix test
svchb Oct 11, 2024
b5663f5
Merge branch 'fix_obs_for_free_surface' into morris_surface_tension
svchb Oct 11, 2024
76e5354
Merge branch 'main' into generalize_surface_normal_calc
svchb Oct 11, 2024
f267d43
Merge branch 'main' into add_ideal_gas
svchb Oct 11, 2024
bdd6756
fix test
svchb Oct 11, 2024
d8f9b1a
Merge branch 'fix_obs_for_free_surface' into morris_surface_tension
svchb Oct 11, 2024
cde7990
Merge branch 'main' into fix_obs_for_free_surface
svchb Oct 11, 2024
6c93850
Merge branch 'main' into morris_surface_tension
svchb Oct 11, 2024
1191c3a
update
svchb Oct 11, 2024
c3683e9
fix division by zero
svchb Oct 11, 2024
1ec7eac
fix the test
svchb Oct 16, 2024
d0f475e
Merge branch 'fix_obs_for_free_surface' into morris_surface_tension
svchb Oct 16, 2024
8d58435
implement CFL condition
svchb Oct 16, 2024
e1ee75c
Merge branch 'morris_surface_tension' of https://github.com/svchb/Tri…
svchb Oct 16, 2024
77eafc0
fixes
svchb Oct 16, 2024
4ace40d
fix
svchb Oct 17, 2024
e031507
implement momentum conserving morris surface tension form
svchb Oct 22, 2024
d88dd72
update
svchb Oct 23, 2024
7d4ee69
update
svchb Oct 24, 2024
b3a88a0
make properties settable
svchb Oct 24, 2024
e079dc0
Merge remote-tracking branch 'refs/remotes/origin/main'
svchb Nov 13, 2024
7f85a3f
Merge branch 'generalize_surface_normal_calc'
svchb Nov 13, 2024
b4c5ace
format
svchb Nov 13, 2024
e555f03
Merge branch 'generalize_surface_normal_calc'
svchb Nov 13, 2024
6222872
format
svchb Nov 13, 2024
dcc7001
Merge branch 'main'
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
28e9c2f
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Nov 13, 2024
8837a5a
Merge branch 'fix_obs_for_free_surface'
svchb Nov 13, 2024
d8d6d4b
fix error
svchb Nov 13, 2024
f9e2202
Merge branch 'main' into add_ideal_gas
svchb Nov 13, 2024
c6b0c72
fix tests
svchb Nov 13, 2024
77493f5
format
svchb Nov 13, 2024
4192cf7
format
svchb Nov 13, 2024
b15fe3e
fix tests
svchb Nov 13, 2024
1db1507
fix test
svchb Nov 14, 2024
3065a5d
cleanup
svchb Nov 14, 2024
c47850b
Update NEWS.md
svchb Nov 14, 2024
aa53a4d
Update src/schemes/boundary/open_boundary/method_of_characteristics.jl
svchb Nov 15, 2024
eefcd6c
Update test/schemes/boundary/open_boundary/boundary_zone.jl
svchb Nov 15, 2024
9402b4a
Update src/setups/extrude_geometry.jl
svchb Nov 15, 2024
f1de160
Update src/schemes/boundary/open_boundary/method_of_characteristics.jl
svchb Nov 15, 2024
ba98d18
Update src/schemes/boundary/open_boundary/boundary_zones.jl
svchb Nov 15, 2024
e0ede3e
Update examples/fluid/pipe_flow_3d.jl
svchb Nov 15, 2024
d4016a6
review fixes
svchb Nov 16, 2024
7afffb4
Merge branch 'add_ideal_gas' of https://github.com/svchb/TrixiParticl…
svchb Nov 16, 2024
3dfa4e4
Merge branch 'main' into add_ideal_gas
svchb Nov 16, 2024
1467107
add test
svchb Nov 16, 2024
fc4f61b
fix example
svchb Nov 16, 2024
c4fcc16
Merge branch 'main' into fix_obs_for_free_surface
svchb Nov 16, 2024
e0eb153
fix test
svchb Nov 16, 2024
33a704a
fix test
svchb Nov 16, 2024
2533ed0
fix test
svchb Nov 16, 2024
4899d08
format
svchb Nov 16, 2024
d5e7c63
Merge branch 'main' into generalize_surface_normal_calc
svchb Nov 17, 2024
276436d
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Nov 17, 2024
1781da0
Merge branch 'fix_obs_for_free_surface' into morris_surface_tension
svchb Nov 17, 2024
2fb587d
Merge branch 'add_ideal_gas' into morris_surface_tension
svchb Nov 17, 2024
eeca819
review comments
svchb Nov 18, 2024
c18b774
Merge branch 'main' into add_ideal_gas
svchb Nov 18, 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
f5dac70
Merge branch 'main' into add_ideal_gas
svchb Nov 18, 2024
cc50150
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Nov 18, 2024
38ba683
format
svchb Nov 18, 2024
5f96dab
fix test
svchb Nov 18, 2024
9286097
fix test
svchb Nov 18, 2024
b330a07
fix test
svchb Nov 19, 2024
ca3a3c0
fix
svchb Nov 19, 2024
f73614e
remove some allocations
svchb Nov 19, 2024
14ec982
format
svchb Nov 19, 2024
96e1cf6
fix docs
svchb Nov 19, 2024
bcfa0d8
Merge branch 'add_ideal_gas' into morris_surface_tension
svchb Nov 19, 2024
d9227bb
some fixes
svchb Nov 19, 2024
747bf1c
Update src/schemes/fluid/weakly_compressible_sph/state_equations.jl
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
4f66fa7
forgot to edit the other doc
svchb Nov 19, 2024
8faa548
Merge branch 'main' into add_ideal_gas
svchb Nov 19, 2024
2ba1902
Merge branch 'add_ideal_gas' into morris_surface_tension
svchb Nov 19, 2024
503bc8b
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Nov 19, 2024
801b274
format
svchb Nov 19, 2024
d09b163
Update NEWS.md
svchb Nov 19, 2024
593c746
forgot some renames
svchb Nov 19, 2024
3180897
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Nov 19, 2024
ba69a80
fix doc tests
svchb Nov 19, 2024
73b5749
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Nov 19, 2024
67d5b87
fix docs
svchb Nov 19, 2024
f276a7b
fix tests
svchb Nov 19, 2024
b17a629
format
svchb Nov 19, 2024
ad7a11f
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Nov 19, 2024
7b076e6
cleanup
svchb Nov 20, 2024
23cbd38
format
svchb Nov 20, 2024
537df19
Merge branch 'main' into generalize_surface_normal_calc
svchb Nov 20, 2024
cb227d5
Merge branch 'main' into morris_surface_tension
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
28b28b8
Merge branch 'generalize_surface_normal_calc'
svchb Nov 20, 2024
ffc83d3
Merge branch 'main'
svchb Nov 20, 2024
96d1a17
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Nov 20, 2024
e424cfa
Merge branch 'main' into generalize_surface_normal_calc
svchb Nov 20, 2024
ec407ad
fixers
svchb Nov 20, 2024
041861e
fix
svchb Nov 20, 2024
21f08b2
fix
svchb Nov 21, 2024
93067f3
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Nov 21, 2024
0b63bca
fix
svchb Nov 21, 2024
4501847
Merge branch 'generalize_surface_normal_calc'
svchb Nov 21, 2024
b7f448c
fix
svchb Nov 21, 2024
a2cda84
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Nov 21, 2024
ccf94c6
improve documentation
svchb Nov 21, 2024
8851385
fixes
svchb Nov 21, 2024
57ab0a6
format
svchb Nov 21, 2024
a690b52
adding this again
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
39a8f79
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
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
eab49a1
Merge remote-tracking branch 'refs/remotes/origin/generalize_surface_…
svchb Dec 4, 2024
7c7a1f0
fix test
svchb Dec 4, 2024
2223ee8
update
svchb Dec 4, 2024
9ad0526
format
svchb Dec 4, 2024
93630aa
fix test
svchb Dec 4, 2024
64396ef
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Dec 4, 2024
2cc151c
merge
svchb Dec 4, 2024
9f758be
typo
svchb Dec 4, 2024
f74ac4e
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Dec 4, 2024
170e314
merge error
svchb Dec 4, 2024
3618010
typo
svchb Dec 4, 2024
ec75fab
update
svchb Dec 5, 2024
d9325ad
update
svchb Dec 12, 2024
1dfd1fe
Merge branch 'main' into morris_surface_tension
svchb Dec 12, 2024
cd26885
Merge branch 'main' into generalize_surface_normal_calc
svchb Dec 12, 2024
80e51ba
review updates
svchb Dec 12, 2024
1141a12
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Dec 12, 2024
4721aec
review update
svchb Dec 12, 2024
3a0413e
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
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
c83c95e
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Dec 13, 2024
9936e5d
format
svchb Dec 13, 2024
4dc0cf8
fix merge
svchb Dec 13, 2024
5e83f0c
format
svchb Dec 13, 2024
55e6557
another merge error
svchb Dec 13, 2024
ee5c2da
format
svchb Dec 13, 2024
cfe7626
reset to original version
svchb Dec 13, 2024
e174b1c
Merge branch 'main' into generalize_surface_normal_calc
svchb Jan 17, 2025
3398e91
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 20, 2025
fa6274d
Merge branch 'main' into generalize_surface_normal_calc
svchb Jan 20, 2025
2c9b033
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 20, 2025
8a413d6
remove color since it is unused in this PR
svchb Jan 21, 2025
43f2c56
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 21, 2025
fb70487
readd color since it is used here
svchb Jan 21, 2025
c737197
review comment
svchb Jan 21, 2025
a411d1e
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 21, 2025
5f3c7ed
format
svchb Jan 21, 2025
1c5afca
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 21, 2025
dafb7df
merge error
svchb Jan 21, 2025
40d1e0a
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 21, 2025
1ce2af5
review comment
svchb Jan 21, 2025
34c60ed
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 21, 2025
71d609f
format
svchb Jan 21, 2025
73cfc8f
fix
svchb Jan 21, 2025
f90c5d3
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 21, 2025
7439e53
format
svchb Jan 21, 2025
7da18f8
fix
svchb Jan 21, 2025
4b5a1ab
remove surface_normal_method()
svchb Jan 21, 2025
8b3f91b
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 21, 2025
2466eaa
readd surface_normal_method()
svchb Jan 21, 2025
a7764d2
merge error
svchb Jan 21, 2025
f4b3c6f
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 21, 2025
ca0de6a
function was renamed in PN
svchb Jan 21, 2025
dd30511
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 21, 2025
32f12de
format
svchb Jan 21, 2025
d64343a
fix test
svchb Jan 21, 2025
4db3601
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 21, 2025
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
12 changes: 11 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@
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.6

### Features

- Support for surface tension was added to EDAC (#539)

### Refactored

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

## Version 0.2.5

### Features

- Add particle packing for 2D (.asc) and 3D (.stl) geometries (#529)

### Compatibility Changes
Expand All @@ -26,7 +37,6 @@ used in the Julia ecosystem. Notable changes will be documented in this file for
- A new user tutorial was added (#514)
- Several docs fixes (#663, #659, #637, #658, #664)


## Version 0.2.3

### Highlights
Expand Down
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 <[email protected]>"]
version = "0.2.6-dev"
version = "0.2.6"

[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 @@ -140,8 +140,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
13 changes: 13 additions & 0 deletions docs/src/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,19 @@ @Article{Morris1997
publisher = {Elsevier BV},
}

@article{Morris2000,
author = {Morris, Joseph P.},
title = {Simulating surface tension with smoothed particle hydrodynamics},
journal = {International Journal for Numerical Methods in Fluids},
volume = {33},
number = {3},
pages = {333-353},
keywords = {interfacial flow, meshless methods, surface tension},
doi = {https://doi.org/10.1002/1097-0363(20000615)33:3<333::AID-FLD11>3.0.CO;2-7},
year = {2000}
}


@InProceedings{Mueller2003,
author = {M{\"u}ller, Matthias and Charypar, David and Gross, Markus},
booktitle = {Proceedings of the 2003 ACM SIGGRAPH/Eurographics Symposium on Computer Animation},
Expand Down
151 changes: 151 additions & 0 deletions docs/src/systems/fluid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@

# [Fluid Models](@id fluid_models)
Currently available fluid methods are the [weakly compressible SPH method](@ref wcsph) and the [entropically damped artificial compressibility for SPH](@ref edac).
This page lists models and techniques that apply to both of these methods.

## [Viscosity](@id viscosity_wcsph)

TODO: Explain viscosity.

```@autodocs
Modules = [TrixiParticles]
Pages = [joinpath("schemes", "fluid", "viscosity.jl")]
```

## [Corrections](@id corrections)

```@autodocs
Modules = [TrixiParticles]
Pages = [joinpath("general", "corrections.jl")]
```


---

## [Surface Normals](@id surface_normal)

### Overview of Surface Normal Calculation in SPH

Surface normals are essential for modeling surface tension as they provide the directionality of forces acting at the fluid interface. They are calculated based on the particle properties and their spatial distribution within the smoothed particle hydrodynamics (SPH) framework.

#### Color Field and Gradient-Based Surface Normals

The surface normal at a particle is derived from the color field, a scalar field assigned to particles to distinguish between different fluid phases or between fluid and air. The color field gradients point towards the interface, and the normalized gradient defines the surface normal direction.

The simplest SPH formulation for surface normal, \( n_a \), is given as:
```math
n_a = \sum_b m_b \frac{c_b}{\rho_b} \nabla_a W_{ab},
```
where:
- \( c_b \) is the color field value for particle \( b \),
- \( m_b \) is the mass of particle \( b \),
- \( \rho_b \) is the density of particle \( b \),
- \( \nabla_a W_{ab} \) is the gradient of the smoothing kernel \( W_{ab} \) with respect to particle \( a \).

#### Normalization of Surface Normals

The calculated normals are normalized to unit vectors:
```math
\hat{n}_a = \frac{n_a}{\Vert n_a \Vert}.
```
Normalization ensures that the magnitude of the normals does not bias the curvature calculations or the resulting surface tension forces.

#### Handling Noise and Errors in Normal Calculation

In regions distant from the interface, the calculated normals may be small or inaccurate due to the smoothing kernel's support radius. To mitigate this:
1. Normals below a threshold are excluded from further calculations.
2. Curvature calculations use a corrected formulation to reduce errors near interface fringes.

```@autodocs
Modules = [TrixiParticles]
Pages = [joinpath("schemes", "fluid", "surface_normal_sph.jl")]
```

---

## [Surface Tension](@id surface_tension)

### Introduction to Surface Tension in SPH

Surface tension is a key phenomenon in fluid dynamics, influencing the behavior of droplets, bubbles, and fluid interfaces. In SPH, surface tension is modeled as forces arising due to surface curvature and particle interactions, ensuring realistic simulation of capillary effects, droplet coalescence, and fragmentation.

### Akinci-Based Intra-Particle Force Surface Tension and Wall Adhesion Model

The Akinci model divides surface tension into distinct force components:

#### Cohesion Force

The cohesion force captures the attraction between particles at the fluid interface, creating the effect of surface tension. It is defined by the distance between particles and the support radius \( h_c \), using a kernel-based formulation.

**Key Features:**
- Particles within half the support radius experience a repulsive force to prevent clustering.
- Particles beyond half the radius but within the support radius experience an attractive force to simulate cohesion.

Mathematically:
```math
F_{\text{cohesion}} = -\sigma m_b C(r) \frac{r}{\Vert r \Vert},
```
where \( C(r) \), the cohesion kernel, 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

The surface area minimization force models the curvature reduction effects, aligning particle motion to reduce the interface's total area. It acts based on the difference in surface normals:
```math
F_{\text{curvature}} = -\sigma (n_a - n_b),
```
where \( n_a \) and \( n_b \) are the surface normals of the interacting particles.

#### Wall Adhesion Force

This force models the interaction between fluid and solid boundaries, simulating adhesion effects at walls. It uses a custom kernel with a peak at 0.75 times the support radius:
```math
F_{\text{adhesion}} = -\beta m_b A(r) \frac{r}{\Vert r \Vert},
```
where \( A(r) \) is the adhesion kernel:
```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}
```

---

### Morris-Based Momentum-Conserving Surface Tension Model

In addition to the Akinci model, Morris (2000) introduced a momentum-conserving approach to surface tension. This model uses stress tensors to ensure exact conservation of linear momentum, providing a robust method for high-resolution simulations.

#### Stress Tensor Formulation

The force is calculated as:
```math
F_{\text{surface tension}} = \nabla \cdot S,
```
where \( S \) is the stress tensor:
```math
S = \sigma \delta_s (I - \hat{n} \otimes \hat{n}),
```
with:
- \( \delta_s \): Surface delta function,
- \( \hat{n} \): Unit normal vector,
- \( I \): Identity matrix.

#### Advantages and Limitations

While momentum conservation makes this model attractive, it requires additional computational effort and stabilization techniques to address instabilities in high-density regions.

```@autodocs
Modules = [TrixiParticles]
Pages = [joinpath("schemes", "fluid", "surface_tension.jl")]
```

This extended documentation provides a comprehensive view of the theoretical foundations and practical implementations of surface tension and surface normal calculations in SPH models.
78 changes: 0 additions & 78 deletions docs/src/systems/weakly_compressible_sph.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ Modules = [TrixiParticles]
Pages = [joinpath("schemes", "fluid", "weakly_compressible_sph", "state_equations.jl")]
```

## [Viscosity](@id viscosity_wcsph)

TODO: Explain viscosity.

```@autodocs
Modules = [TrixiParticles]
Pages = [joinpath("schemes", "fluid", "viscosity.jl")]
```

## [Density Diffusion](@id density_diffusion)

Density diffusion can be used with [`ContinuityDensity`](@ref) to remove the noise in the
Expand Down Expand Up @@ -118,72 +109,3 @@ term is very expensive and adds about 40--50% of computational cost.
Modules = [TrixiParticles]
Pages = [joinpath("schemes", "fluid", "weakly_compressible_sph", "density_diffusion.jl")]
```

## [Corrections](@id corrections)

```@autodocs
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
30 changes: 25 additions & 5 deletions examples/fluid/dam_break_oil_film_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,31 @@ nu_ratio = nu_water / nu_oil
nu_sim_oil = max(0.01 * smoothing_length * sound_speed, nu_oil)
nu_sim_water = nu_ratio * nu_sim_oil

oil_viscosity = ViscosityMorris(nu=nu_sim_oil)
# Physical values
nu_water = 8.9E-7
nu_oil = 6E-5
nu_ratio = nu_water / nu_oil

nu_sim_oil = max(0.01 * smoothing_length * sound_speed, nu_oil)
nu_sim_water = nu_ratio * nu_sim_oil

oil_viscosity = ViscosityMorris(nu=nu_sim_oil)

# TODO: broken if both are set to surface tension
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 +63,19 @@ 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)

# oil_system = WeaklyCompressibleSPHSystem(oil, fluid_density_calculator,
# oil_eos, smoothing_kernel,
# smoothing_length, viscosity=oil_viscosity,
# acceleration=(0.0, -gravity),
# surface_tension=SurfaceTensionMorris(surface_tension_coefficient=0.03),
# reference_particle_spacing=fluid_particle_spacing)

# ==========================================================================================
# ==== Simulation
Expand Down
Loading
Loading