-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: main
Are you sure you want to change the base?
Changes from 28 commits
e031507
d88dd72
7d4ee69
b3a88a0
e079dc0
7f85a3f
b4c5ace
e555f03
6222872
dcc7001
0b3043c
3335386
7d4016c
28e9c2f
8837a5a
d8d6d4b
f9e2202
c6b0c72
77493f5
4192cf7
b15fe3e
1db1507
3065a5d
c47850b
aa53a4d
eefcd6c
9402b4a
f1de160
ba98d18
e0ede3e
d4016a6
7afffb4
3dfa4e4
1467107
fc4f61b
c4fcc16
e0eb153
33a704a
2533ed0
4899d08
d5e7c63
276436d
1781da0
2fb587d
eeca819
c18b774
514ffcf
223bcd0
f5dac70
cc50150
38ba683
5f96dab
9286097
b330a07
ca3a3c0
f73614e
14ec982
96e1cf6
bcfa0d8
d9227bb
747bf1c
3c5fd08
969dedd
c6371eb
4bf25e6
ebf6602
8659850
5b0ed25
7a6331e
3c80adf
4f66fa7
8faa548
2ba1902
503bc8b
801b274
d09b163
593c746
3180897
ba69a80
73b5749
67d5b87
f276a7b
b17a629
ad7a11f
7b076e6
23cbd38
537df19
cb227d5
20b77d7
d7b6af1
01bddb0
dc6fa70
28b28b8
ffc83d3
96d1a17
e424cfa
ec407ad
041861e
21f08b2
93067f3
0b63bca
4501847
b7f448c
a2cda84
ccf94c6
8851385
57ab0a6
a690b52
f4fbbb3
589d416
1263e1a
39a8f79
dd56f47
306f96d
eab49a1
7c7a1f0
2223ee8
9ad0526
93630aa
64396ef
2cc151c
9f758be
f74ac4e
170e314
3618010
ec75fab
d9325ad
1dfd1fe
cd26885
80e51ba
1141a12
4721aec
3a0413e
98a5f6c
e05edea
36741d7
ba8765f
c83c95e
9936e5d
4dc0cf8
5e83f0c
55e6557
ee5c2da
cfe7626
e174b1c
3398e91
fa6274d
2c9b033
8a413d6
43f2c56
fb70487
c737197
a411d1e
5f3c7ed
1c5afca
dafb7df
40d1e0a
1ce2af5
34c60ed
71d609f
73cfc8f
f90c5d3
7439e53
7da18f8
4b5a1ab
8b3f91b
2466eaa
a7764d2
f4b3c6f
ca0de6a
dd30511
32f12de
d64343a
4db3601
f7f8620
9924bac
e783541
6fd934e
5b2c988
9d92605
1ec50c8
41f69e4
9408a42
2defd31
aee3349
d438237
9681e08
21b92f8
face89a
540ee3f
1832335
6f1e8a9
97f3b06
3d1006a
0796b3f
bba3bd8
d4d4067
523c5e2
abcd3ac
1771434
f4088c0
65101db
a878534
c2f675e
648744e
e31e843
4a9e333
42b24ba
767eb9b
27b5089
fc73ebf
fddf47a
646fbfc
870ae4c
6f30a9a
b94742e
c9bd0bd
43c9670
d64982c
19f2e88
e229687
0982834
c1dfa83
c3b4474
657b530
43de9be
d992e67
aa0b985
133a515
ccd58bf
0e1efb5
0776aa7
1887aed
3eab67f
7c9ebb0
ecb9719
7fdc925
9cae162
ca322f1
081d2fb
50110be
dbf36c9
47cb6f5
0edf873
355d23e
ac1ce31
1d875ba
0de653d
9f568b0
cc14ce5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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" | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,11 +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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
- 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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Source? |
||||||
|
||||||
|
||||||
### API | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
It probably makes more sense to do this in a new PR to avoid complicating this PR further. |
||||||
|
||||||
```@autodocs | ||||||
Modules = [TrixiParticles] | ||||||
|
@@ -19,40 +59,44 @@ Modules = [TrixiParticles] | |||||
Pages = [joinpath("general", "corrections.jl")] | ||||||
``` | ||||||
|
||||||
|
||||||
--- | ||||||
|
||||||
## [Surface Normals](@id surface_normal) | ||||||
|
||||||
### Overview of Surface Normal Calculation in SPH | ||||||
### 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. | ||||||
Surface normals are essential for modeling surface tension as they provide the directionalit | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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 | ||||||
#### 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 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: | ||||||
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 \). | ||||||
- ``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 | ||||||
#### 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 | ||||||
#### 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: | ||||||
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. | ||||||
|
||||||
|
@@ -65,17 +109,38 @@ 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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good explanation! But a source would be nice. |
||||||
|
||||||
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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||||||
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. | ||||||
|
@@ -97,15 +162,17 @@ C(r)=\frac{32}{\pi h_c^9} | |||||
|
||||||
#### 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: | ||||||
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), | ||||||
svchb marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
``` | ||||||
where \( n_a \) and \( n_b \) are the surface normals of the interacting particles. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Please check the rendered docs. C(r) above and A(r) below also don't work. |
||||||
|
||||||
#### 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: | ||||||
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}, | ||||||
``` | ||||||
|
@@ -120,32 +187,57 @@ A(r) = \frac{0.007}{h_c^{3.25}} | |||||
|
||||||
--- | ||||||
|
||||||
### Morris Surface Tension Model | ||||||
|
||||||
The method estimates curvature by combining particle color gradients and smoothing functions to derive surface normals. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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}``. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||||||
--- | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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. | ||||||
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 force is calculated as: | ||||||
The surface tension force can be seen as a divergence of a stress tensor ``S`` | ||||||
```math | ||||||
F_{\text{surface tension}} = \nabla \cdot S, | ||||||
svchb marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
``` | ||||||
where \( S \) is the stress tensor: | ||||||
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. | ||||||
- ``\delta_s``: Surface delta function, | ||||||
- ``\hat{n}``: Unit normal vector, | ||||||
- ``I``: Identity matrix. | ||||||
|
||||||
That can be calculated as | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
```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. | ||||||
While momentum conservation makes this model attractive, it requires additional computational effort and stabilization | ||||||
techniques to address instabilities in high-density regions. | ||||||
|
||||||
### API | ||||||
|
||||||
svchb marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
```@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. | ||||||
``` |
This file was deleted.
There was a problem hiding this comment.
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.