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 515 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
515 commits
Select commit Hold shift + click to select a range
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
f7f8620
fix error
svchb Jan 22, 2025
9924bac
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 22, 2025
e783541
fix
svchb Jan 22, 2025
6fd934e
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 27, 2025
5b2c988
review comments
svchb Jan 27, 2025
9d92605
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 27, 2025
1ec50c8
review comments
svchb Jan 28, 2025
41f69e4
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 28, 2025
9408a42
review comments
svchb Jan 28, 2025
2defd31
format
svchb Jan 28, 2025
aee3349
Merge branch 'main' into generalize_surface_normal_calc
svchb Jan 28, 2025
d438237
merge
svchb Jan 28, 2025
9681e08
format
svchb Jan 28, 2025
21b92f8
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 28, 2025
face89a
add comment
svchb Jan 28, 2025
540ee3f
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 28, 2025
1832335
remove ideal_neighbor()
svchb Jan 28, 2025
6f1e8a9
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 28, 2025
97f3b06
format
svchb Jan 28, 2025
3d1006a
format
svchb Jan 28, 2025
0796b3f
typo
svchb Jan 28, 2025
bba3bd8
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 28, 2025
d4d4067
fix tests
svchb Jan 28, 2025
523c5e2
format
svchb Jan 28, 2025
abcd3ac
add missing docs
svchb Jan 28, 2025
1771434
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 28, 2025
f4088c0
cleanup
svchb Jan 29, 2025
65101db
only initialize necessary values
svchb Jan 29, 2025
a878534
Merge branch 'generalize_surface_normal_calc' of github.com:svchb/Tri…
svchb Jan 29, 2025
c2f675e
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 29, 2025
648744e
fix test
svchb Jan 29, 2025
e31e843
fix examples
svchb Jan 29, 2025
4a9e333
Merge branch 'main' into generalize_surface_normal_calc
svchb Jan 29, 2025
42b24ba
Merge branch 'generalize_surface_normal_calc' into morris_surface_ten…
svchb Jan 29, 2025
767eb9b
Merge branch 'main' into morris_surface_tension
svchb Jan 30, 2025
27b5089
format
svchb Jan 30, 2025
fc73ebf
fix tests
svchb Jan 30, 2025
fddf47a
typo
svchb Jan 30, 2025
646fbfc
remove validation case
svchb Jan 30, 2025
870ae4c
rectangular test
svchb Jan 30, 2025
6f30a9a
update
svchb Jan 31, 2025
b94742e
format
svchb Jan 31, 2025
c9bd0bd
typo
svchb Jan 31, 2025
43c9670
move stress calculation
svchb Jan 31, 2025
d64982c
fix test
svchb Jan 31, 2025
19f2e88
format
svchb Jan 31, 2025
e229687
update
svchb Feb 10, 2025
0982834
format
svchb Feb 10, 2025
c1dfa83
update
svchb Feb 12, 2025
c3b4474
update
svchb Feb 12, 2025
657b530
more line breaks
svchb Feb 12, 2025
43de9be
remove fluff
svchb Feb 12, 2025
d992e67
doc fixes
svchb Feb 12, 2025
aa0b985
define sigma
svchb Feb 12, 2025
133a515
improve docs
svchb Feb 12, 2025
ccd58bf
more doc improvements
svchb Feb 12, 2025
0e1efb5
fix docs
svchb Feb 12, 2025
0776aa7
Merge branch 'main' into morris_surface_tension
svchb Feb 12, 2025
1887aed
remove unnecessary example
svchb Feb 13, 2025
3eab67f
fix allocations
svchb Feb 14, 2025
7c9ebb0
Merge branch 'main' into morris_surface_tension
svchb Feb 14, 2025
ecb9719
add descriptions
svchb Feb 14, 2025
7fdc925
reduce example runtime
svchb Feb 14, 2025
9cae162
move fluid examples to separate file
svchb Feb 14, 2025
ca322f1
format
svchb Feb 14, 2025
081d2fb
add missing comment
svchb Feb 14, 2025
50110be
fix stress_tensor()
svchb Feb 14, 2025
dbf36c9
fix docs
svchb Feb 14, 2025
47cb6f5
improve coverage
svchb Feb 14, 2025
0edf873
reduce example run time
svchb Feb 14, 2025
355d23e
further reduce runtime
svchb Feb 14, 2025
ac1ce31
format
svchb Feb 14, 2025
1d875ba
fix merge error
svchb Feb 14, 2025
0de653d
now for real
svchb Feb 14, 2025
9f568b0
fix
svchb Feb 14, 2025
cc14ce5
fix test
svchb Feb 14, 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: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
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.7

### Features

- Adds the classic **Continuum Surface Force (CSF)** model based on Morris 2000 (#584), which computes
Copy link
Member

Choose a reason for hiding this comment

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

Why bold? Nothing else is bold in this file.

surface tension as a **body force** proportional to curvature and directed along the interface normal.
This method is efficient and accurate for capillary effects but does not explicitly conserve momentum.

- Added the classic **Continuum Surface Stress (CSS)** model based on Morris 2000 (#584), which is
a **momentum-conserving** approach that formulates surface tension as the **divergence of a stress tensor**.
However, it requires additional computation and stabilization to handle **high-density interfaces** and reduce numerical instabilities.

## Version 0.2.6

### Features
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.7-dev"
version = "0.2.7"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
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
230 changes: 192 additions & 38 deletions docs/src/systems/fluid.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@

# [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).
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.
Viscosity is a critical physical property governing momentum diffusion within a fluid.
In the context of SPH, viscosity determines how rapidly velocity gradients are smoothed out,
influencing key flow characteristics such as boundary layer formation, vorticity diffusion,
and dissipation of kinetic energy. It also helps determine whether a flow is laminar or turbulent
under a given set of conditions.

Implementing viscosity correctly in SPH is essential for producing physically accurate results,
and different methods exist to capture both numerical stabilization and true viscous effects.

### Artificial (numerical) viscosity

- Goal: Stabilize the simulation, capture shocks, and prevent unphysical particle interpenetration.
Copy link
Member

Choose a reason for hiding this comment

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

  1. What do you mean by unphysical particle interpenetration?
  2. It should be mentioned that this is mostly used when modeling inviscid flow to stabilize the simulation and not to add physical viscosity. Also that we usually want to add as little artificial viscosity as possible to stabilize the simulation but not to change the physical behavior.

- Method: Adds a dissipative (artificial) term to the momentum equations.
- Typical Use: High-speed flows with strong shocks, astrophysical simulations, or situations where numerical damping is needed for stability.
Copy link
Member

Choose a reason for hiding this comment

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

Is there any situation where we would use a fluid without any kind of viscosity? If not, the typical use is all simulations where we want to model inviscid flow.


### Physical (real) viscosity

- Goal: Model the actual viscous stresses of a fluid, aligned with a target Reynolds number or experimentally measured fluid properties.
- Method: Introduces a force consistent with the Navier–Stokes viscous stress term.
- Typical Use: Low-speed, incompressible or weakly compressible flows where matching real fluid behavior is important.
Copy link
Member

Choose a reason for hiding this comment

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

Artificial viscosity is often used for low-speed weakly compressible flows as well. This is a bit confusing IMO. @LasNikas ?


### Model comparison

#### ArtificialViscosityMonaghan

- Best For: Compressible/high-speed flows, shock capturing, general purpose damping.
- If you need: Stability in challenging flow regimes with potentially large density/pressure variations.

#### ViscosityMorris

- Best For: Moderate to low Mach number flows where realistic viscous behavior is desired.
- If you need: Straightforward approach to physical viscosity that still works well in weakly compressible scenarios.

#### ViscosityAdami

- Best For: Incompressible or weakly compressible flows requiring accurate shear stress treatment.
- If you need: Good boundary layer representation and accurate laminar flow with minimal compressibility effects.
Comment on lines +32 to +45
Copy link
Member

Choose a reason for hiding this comment

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

Source?



### API
Copy link
Member

Choose a reason for hiding this comment

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

This should be properly refactored. The equations and mathematical explanation of the models should be moved above to the docs and the API should be reduced to just

    ViscosityMorris(; nu, epsilon=0.01)

Viscosity by [Morris (1997)](http://localhost:8000/references/#Morris1997) also used by [Fourtakas (2019)](http://localhost:8000/references/#Fourtakas2019).

# Keywords
...

It probably makes more sense to do this in a new PR to avoid complicating this PR further.


```@autodocs
Modules = [TrixiParticles]
Expand All @@ -18,72 +59,185 @@ 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 directionalit
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Surface normals are essential for modeling surface tension as they provide the directionalit
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.

#### 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 a 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)

### 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 support radius ``h_c`` and the distance between particles.
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 particles from 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:
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
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand "due to particle interactions".

simulation of capillary effects, droplet coalescence, and fragmentation.

The surface tension coefficient ``\sigma`` is a physical parameter that quantifies the energy required to increase the surface area
of a fluid by a unit amount. A higher value of ``\sigma`` indicates that the fluid resists changes to its surface area more strongly,
causing droplets or bubbles to assume shapes (often spherical) that minimize their surface. In practice, ``\sigma`` can be measured
experimentally through techniques such as the pendant drop method, the Wilhelmy plate method, or the du Noüy ring method,
each of which relates a measurable force or change in shape to the fluid’s surface tension. For pure substances,
tabulated reference values of ``\sigma`` at given temperatures are commonly used, while for mixtures or complex fluids,
direct experimental measurements or specialized equations of state may be necessary.

| **Fluid** | **Surface Tension (``\sigma``) [N/m at 20°C]** |
|--------------|----------------------------------------------:|
| **Water** | 0.0728 |
| **Mercury** | 0.485 |
| **Ethanol** | 0.0221 |
| **Acetone** | 0.0237 |
| **Glycerol** | 0.0634 |
| **Olive Oil**| ~0.032 |
| **Gasoline** | ~0.022 |
| **Mineral Oil** | ~0.030 |
Comment on lines +116 to +133
Copy link
Member

Choose a reason for hiding this comment

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

Good explanation! But a source would be nice.



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

Choose a reason for hiding this comment

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

Please check capitalization in all captions.


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:
- ``\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
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}
(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
#### 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)
F_{\text{curvature}} = -\sigma (n_a - n_b),
```
where \( n_a \) and \( n_b \) are the surface normals of the interacting particles.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
where \( n_a \) and \( n_b \) are the surface normals of the interacting particles.
where ``n_a`` and ``n_b`` are the surface normals of the interacting particles.

Please check the rendered docs. C(r) above and A(r) below also don't work.


#### Wall Adhesion Force

#### 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
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},
```
with ``A`` being the adhesion kernel defined as
where \( A(r) \) is the adhesion kernel:
```math
A(r)= \frac{0.007}{h_c^{3.25}}
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 \\
\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 Surface Tension Model

The method estimates curvature by combining particle color gradients and smoothing functions to derive surface normals.
Copy link
Member

Choose a reason for hiding this comment

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

Are color gradients explained somewhere? If so, could you please add a link here?

The computed curvature is then used to determine forces acting perpendicular to the interface.
While this method provides accurate surface tension forces, it does not explicitly conserve momentum.

In the Morris model, surface tension is computed based on local interface curvature ``\kappa`` and the unit surface normal ``\hat{n}``.
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why the period is put in the next line. Can you maybe slightly reformulate this sentence?

By estimating ``\hat{n}`` and ``\kappa`` at each particle near the interface, the surface tension force for particle a can be written as:

```math
F_{\text{surface tension}} = - \sigma \frac{\kappa_a}{\rho_a}\hat{n}_a
```
This formulation focuses directly on geometric properties of the interface, making it relatively straightforward to implement when a reliable interface detection
(e.g., a color function) is available. However, accurately estimating ``\kappa`` and ``n`` may require fine resolutions.
---
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't render correctly.


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

In addition to the simpler curvature-based formulation, Morris (2000) introduced a momentum-conserving approach.
This method treats surface tension forces as arising from the divergence of a stress tensor, ensuring exact conservation
of linear momentum and offering more robust behavior for high-resolution or long-duration simulations
where accumulated numerical error can be significant.

#### Stress Tensor Formulation

The surface tension force can be seen as a divergence of a stress tensor ``S``
```math
F_{\text{surface tension}} = \nabla \cdot S,
```
with ``S`` defined as
```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.

That can be calculated as
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
That can be calculated as
This divergence can be computed numerically in the SPH framework as

```math
\sum_b \frac{m_b}{\rho_a \rho_b} (S_a + S_b) \nabla W_{ab}
```

#### 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.

### API

```@autodocs
Modules = [TrixiParticles]
Pages = [joinpath("schemes", "fluid", "surface_tension.jl")]
```
```
17 changes: 17 additions & 0 deletions examples/fluid/dam_break_oil_film_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ 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,
Expand Down Expand Up @@ -60,6 +70,13 @@ oil_system = WeaklyCompressibleSPHSystem(oil, fluid_density_calculator,
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
semi = Semidiscretization(fluid_system, oil_system, boundary_system,
Expand Down
2 changes: 1 addition & 1 deletion examples/fluid/falling_water_spheres_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ trixi_include(@__MODULE__,
fluid_smoothing_length=fluid_smoothing_length,
fluid_smoothing_kernel=SchoenbergCubicSplineKernel{3}(),
nu=nu, alpha=10 * nu / (fluid_smoothing_length * sound_speed),
surface_tension_coefficient=10, adhesion_coefficient=0.1)
surface_tension=SurfaceTensionAkinci(surface_tension_coefficient=0.05))
Loading
Loading