-
Notifications
You must be signed in to change notification settings - Fork 19
Implement Implicit Incompressible SPH (IISPH) #751
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
Merged
Merged
Changes from 86 commits
Commits
Show all changes
97 commits
Select commit
Hold shift + click to select a range
e4c88ff
Add stuff
noahstruschka 83d76fc
add stuff
noahstruschka 59774ed
add stuff
noahstruschka 32def7c
add stuff
noahstruschka a96b2e6
IISPH Code almost finished and started IISPH doc.
noahstruschka 241c866
add
noahstruschka 330fa90
add math
noahstruschka ed75e3f
$
noahstruschka c0e78e9
changed `` to $
noahstruschka 0685b40
add
noahstruschka 0112869
removed $.$$
noahstruschka 11add87
changes in dij / sumdij function
noahstruschka 232d2b1
Abbruchbedingung
noahstruschka 78efa93
...
noahstruschka 21e55e1
```math
noahstruschka e45c6ea
remove mathbb{d}
noahstruschka aadea53
fixes
noahstruschka 0e720a6
further md fixes
noahstruschka 0421280
bold F
noahstruschka 5547c6c
fixes and bold v
noahstruschka 8c92200
.
noahstruschka 6e4538d
Überarbeitung
noahstruschka 3305999
.
noahstruschka 86e3efc
.
noahstruschka 276d8bf
Inhaltliche Anpassungen (Bug Fixes und vieles weitere) ,Code aufgeräu…
noahstruschka 9a22e6a
Pre-merger
noahstruschka db615da
FluidSystem(NDIMS)
noahstruschka 071d83c
Gemergte Version
noahstruschka 4580abc
Rechtschreibfehler behebeb
noahstruschka fec43e2
Ready for Review
noahstruschka 20cdfeb
Finale Fixes am Code. Erstellung des IISPH Dam Break examples
noahstruschka 0fb044f
Fix Falling Water Column 2D IISPH
noahstruschka 91bbea9
Fix falling_water_column_2d_IISPH
noahstruschka 7defc6e
Changes from the latest PR
noahstruschka 3ed0986
Fixes resulting from the checks and tests for iisph
noahstruschka e91166b
Added tests for the iisph system
noahstruschka 0c2c821
Changes trough JuliaFormatter
noahstruschka f744cac
fiix error in documentation, nd spelling error
noahstruschka b51eb2a
Resolving conflicts in semidiscretization.jl
noahstruschka c007f16
Zitieranpassungen
noahstruschka 9442562
Resolve errors
noahstruschka 612cec9
Add latest suggested changes from the PR
noahstruschka e5981b6
Neccessary changes for the PR
noahstruschka 97aa108
Changes requested from Erik for the Pull Request
noahstruschka 2f65086
Bug fix
noahstruschka 30f0ef6
Versuch Bug zu fixen
noahstruschka 2a98782
Fix Error from last push
noahstruschka 8a32a19
auskommentierte Zeile entfernt
noahstruschka 81eec7c
Changes requested from Pull Request
noahstruschka 9c546b2
delete submodule
noahstruschka 2b0363d
Changes for the docs from the PR Review (part 1)
noahstruschka 2b3c917
Changes for the docs from the PR (part 2)
noahstruschka abc47bd
Fix bug in the termination condition (avg_density_error)
noahstruschka 9969166
Fixed the error with the wrong calculation of the
noahstruschka decd086
.
noahstruschka 6e2f889
Fix errors
noahstruschka 441f4df
Add the information that the max_error is given in
noahstruschka 8597c82
Changes requested from the PR (in system.jl and in
noahstruschka a455563
Merge branch 'main' into ma_noah
efaulhaber e1bf25e
Added changes from the PR Review from LasNikas
noahstruschka b801c1d
Merge branch 'ma_noah' of github.com:noahstruschka/TrixiParticles.jl …
noahstruschka d334d58
Removed transport_velocity
noahstruschka cfb9b9b
Merge branch 'main' into ma_noah
efaulhaber d951d35
Fix example file, error because of changes in
noahstruschka b5fe7e9
Changes from the PR review
noahstruschka 502c668
Merge branch 'main' into ma_noah
efaulhaber e8858ed
Changes from the review of the PR
noahstruschka dcc71dc
Merge branch 'ma_noah' of github.com:noahstruschka/TrixiParticles.jl …
noahstruschka 77d47d7
Changes from the review of the PR
noahstruschka 7ddcc90
rename example file
noahstruschka c06c29d
Fix allocations
noahstruschka f6a7b7c
Change comment on density_error
noahstruschka 6ef4a59
Fix errors in docs
noahstruschka a9df938
Fix docs
noahstruschka da7dc26
.
noahstruschka b33be06
.
noahstruschka aa01873
Merge branch 'dev' into ma_noah
noahstruschka 0c37cb6
Fix merge
noahstruschka 32c1ff8
Change example file
noahstruschka 6f194e8
Change example file
noahstruschka 49f2d55
used JuliaFormatter
noahstruschka 098c395
Merge branch 'main' into ma_noah
efaulhaber 7b19977
used JuliaFormatter@2.1.1
noahstruschka b94e12e
Merge branch 'ma_noah' of github.com:noahstruschka/TrixiParticles.jl …
noahstruschka ce37246
Format change
noahstruschka 46997be
Added Version 0.4.1 to the NEWS.md file
noahstruschka 7d14749
Merge branch 'main' into ma_noah
svchb c7c9729
Changes from the PR review
noahstruschka f9fd8df
Add comment to the iisph example file regarding
noahstruschka a7edecb
Add comment in the iisph example file regarding the
noahstruschka d43eab9
Merge branch 'main' into ma_noah
LasNikas 44ff3f1
Changes from PR review
noahstruschka 6246754
Merge branch 'ma_noah' of github.com:noahstruschka/TrixiParticles.jl …
noahstruschka f3172d5
Changes from the PR review: system file, example file and test file
noahstruschka 0b3bd48
Format change
noahstruschka 3178fb0
Merge branch 'main' into ma_noah
efaulhaber a2e2d9d
Update examples/fluid/dam_break_2d_iisph.jl
noahstruschka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,295 @@ | ||
| # [Implicit Incompressible SPH](@id iisph) | ||
|
|
||
| Implicit Incompressible SPH (IISPH) as introduced by [Ihmsen et al. (2013)](@cite ihmsen2013) | ||
| is a method that achieves incompressibility by solving the pressure Poisson equation. | ||
| The resulting linear system is iteratively solved with the relaxed Jacobi method. | ||
| Unlike the [weakly compressible SPH method](@ref wcsph), incompressible methods determine | ||
| pressure by enforcing the incompressibility constraint rather than using an equation of | ||
| state. | ||
|
|
||
| ```@autodocs | ||
| Modules = [TrixiParticles] | ||
| Pages = [joinpath("schemes", "fluid", "implicit_incompressible_sph", "system.jl")] | ||
| ``` | ||
| ## Derivation | ||
| To derive the linear system of the pressure Poisson equation, we start by discretizing the | ||
|
noahstruschka marked this conversation as resolved.
|
||
| continuity equation | ||
| ```math | ||
| \frac{D\rho}{Dt} = - \rho \nabla \cdot \bm{v}. | ||
| ``` | ||
|
|
||
| For a particle ``i``, discretizing the left-hand side of the equation with a forward | ||
| difference yields | ||
|
|
||
| ```math | ||
| \frac{\rho_i(t+ \Delta t) - \rho_i(t)}{\Delta t}. | ||
| ``` | ||
|
|
||
| The divergence in the right-hand side is discretized with the SPH discretization for | ||
| particle ``i`` as | ||
| ```math | ||
| -\frac{1}{\rho_i} \sum_j m_j \bm{v}_{ij} \nabla W_{ij}, | ||
| ``` | ||
| where ``\bm{v}_{ij} = \bm{v}_i - \bm{v}_j``. | ||
|
|
||
| Together, the following discretized version of the continuity equation for a particle ``i`` | ||
| is achieved: | ||
| ```math | ||
| \frac{\rho_i(t + \Delta t) - \rho_i(t)}{\Delta t} = \sum_j m_j \bm{v}_{ij}(t+\Delta t) \nabla W_{ij}. | ||
| ``` | ||
|
|
||
| The right-hand side contains the unknown velocities ``\bm{v}_{ij}(t + \Delta t)`` at the | ||
| next time step, making it an implicit formulation. | ||
|
|
||
| Using the semi-implicit Euler method, we can obtain the velocity in the next time step as | ||
| ```math | ||
| \bm{v}_i(t + \Delta t) = \bm{v}_i(t) + \Delta t \frac{\bm{F}_i^\text{adv}(t) + \bm{F}_i^p(t)}{m_i}, | ||
| ``` | ||
|
noahstruschka marked this conversation as resolved.
|
||
|
|
||
| where ``\bm{F}_i^{\text{adv}}`` denotes all non-pressure forces such as gravity, viscosity, surface | ||
| tension and more, while ``\bm{F}_i^p``denotes the unknown pressure forces, which we | ||
| want to solve for. | ||
|
|
||
| Note that the IISPH is an incompressible method, which means that the density of the | ||
| fluid remain constant over time. By assuming a fixed reference density ``\rho_0`` for all | ||
| fluid particle over the whole time of the simulation, the density value at the next time | ||
| step ``\rho_i(t + \Delta t)`` also has to be this rest density. So ``\rho_0`` can be plugged in | ||
| for ``\rho_i(t + \Delta t)`` in the formula above. | ||
|
|
||
| The goal is to compute the pressure values required to obtain the pressure acceleration that | ||
| ensures each particle reaches the rest density in the next time step. At the moment these | ||
| pressure values are unknown in ``t``, but all the non-pressure forces are already known. | ||
| Therefore a predicted velocity can be calculated, which depends only on the non-pressure | ||
| forces ``\bm{F}_i^{\text{adv}}``: | ||
|
|
||
| ```math | ||
| \bm{v}_i^{\text{adv}}(t+\Delta t)= \bm{v}_i(t) + \Delta t \frac{\bm{F}_i^{\text{adv}}(t)}{m_i}, | ||
| ``` | ||
| Using this predicted velocity and the continuity equation, a predicted density can be defined | ||
| in a similar way as | ||
|
|
||
| ```math | ||
| \rho_i^{\text{adv}}(t + \Delta t)= \rho_i(t) + \Delta t \sum_j m_j \bm{v}_{ij}^{\text{adv}} \nabla W_{ij}(t). | ||
| ``` | ||
|
|
||
| To achieve the rest density, the unknown pressure forces must counteract the compression | ||
| caused by the non-pressure forces. In other words, they must resolve the deviation between | ||
| the predicted density and the reference density. | ||
|
|
||
| Therefore, the following equation needs to be fulfilled: | ||
| ```math | ||
| \Delta t ^2 \sum_j m_j \left( \frac{\bm{F}_i^p(t)}{m_i} - \frac{\bm{F}_j^p(t)}{m_j} \right) \nabla W_{ij}(t) = \rho_0 - \rho_i^{\text{adv}}. | ||
| ``` | ||
|
|
||
| This expression is derived by substituting the reference density ``\rho_0`` for | ||
| ``\rho_i(t+\Delta t)`` in the discretized continuity equation and inserting the definitions of | ||
| the predicted velocity ``\bm{v}_{ij}(t+\Delta t)`` and predicted density ``\rho_i^{\text{adv}}``. | ||
|
|
||
| The pressure force is defined as: | ||
|
|
||
| ```math | ||
| \bm{F}_i^p(t) = -\frac{m_i}{\rho_i} \nabla p_i = -m_i \sum_j m_j \left( \frac{p_i(t)}{\rho_i^2(t)} + \frac{p_j(t)}{\rho_j^2(t)} \right) \nabla W_{ij}. | ||
| ``` | ||
|
|
||
| Substituting this definition into the equation yields a linear system ``\bm{A}(t) \bm{p}(t) = \bm{b}(t)`` | ||
| with one equation and one unknown pressure value for each particle. | ||
| For ``n`` particles, this is a linear system with ``n`` equations and ``n`` unknowns: | ||
|
|
||
| ```math | ||
| \sum_j a_{ij} p_j = b_i = \rho_0 - \rho_i^{\text{adv}}. | ||
| ``` | ||
|
|
||
| To solve for the pressure values, a relaxed Jacobi scheme is used. | ||
| This is an iterative numerical method to solve a linear system ``Ap=b``. In each iteration, the | ||
| new values of ``p`` are obtained as computed as | ||
|
|
||
| ```math | ||
| p_i^{(k+1)} = (1-\omega) p_i^{(k)} + \omega \left( \frac{1}{a_{ii}} \left( b_i - \sum_{j \neq i} a_{ij} p_j^{(k)} \right)\right). | ||
| ``` | ||
|
|
||
| Substituting the right-hand side, we obtain | ||
|
|
||
| ```math | ||
| p_i^{l+1} = (1-\omega) p_i^l + \omega \frac{\rho_0 - \rho_i^{\text{adv}} - \sum_{j \neq i} a_{ij}p_j^l}{a_{ii}}. | ||
| ``` | ||
|
|
||
| Therefore the diagonal elements ``a_{ii}`` and the sum ``\sum_{j \neq i} a_{ij}p_j^l`` need to | ||
| be determined. | ||
| This can be done efficiently by separating the pressure force acceleration into two | ||
| components: One that describes the influence of particle ``i``'s own pressure on its | ||
| displacement, and one that describes the displacement due to the pressure values of the | ||
| neighboring particles ``j``. | ||
|
|
||
| The pressure acceleration is given by: | ||
| ```math | ||
| \Delta t^2 \frac{\bm{F}_i^p}{m_i} = -\Delta t^2 \sum_j m_j \left( \frac{p_i}{\rho_i^2} + \frac{p_j}{\rho_j^2} \right)\nabla W_{ij} = \underbrace{\left(- \Delta t^2 \sum_j \frac{m_j}{\rho_i^2} \nabla W_{ij} \right) }_{d_{ii}} p_i + \sum_j \underbrace{-\Delta t^2 \frac{m_j}{\rho_j^2} \nabla W_{ij}}_{d_{ij}}p_j. | ||
| ``` | ||
|
|
||
| The ``d_{ii}p_i`` value describes the displacement of particle ``i`` because of the particle ``i`` | ||
| and ``d_{ij}p_j`` describes the influence from the neighboring particles ``j``. | ||
| Using this new values the linear system can be rewritten as | ||
|
|
||
| ```math | ||
| \rho_0 - \rho_i^{\text{adv}} = \sum_j m_j \left( d_{ii}p_i + \sum_k d_{ik}p_k - d_{jj}p_j - \sum_k d_{jk}p_k \right) \nabla W_{ij}, | ||
| ``` | ||
|
|
||
| where the first sum over ``k`` loops over all neighbor particles of ``i`` and | ||
| the second sum over ``k`` loops over the neighbor particles of ``j`` | ||
| (which is a neighbor of ``i``). | ||
| So the sum over the neighboring pressure values ``p_j`` also includes the pressure values | ||
| ``p_i``, since ``i`` is a neighbor of ``j``. | ||
| To separate this sum, it can be written as | ||
|
|
||
| ```math | ||
| \sum_k d_{jk} p_k = \sum_{k \neq i} d_{jk} p_k + d_{ji} p_i. | ||
| ``` | ||
|
|
||
| With this separation, the equation for the linear system can again be rewritten as | ||
|
|
||
| ```math | ||
| \rho_0 - \rho_i^{\text{adv}} = p_i \sum_j m_j ( d_{ii} - d_{ji})\nabla W_{ij} + \sum_j m_j \left ( \sum_k d_{ik} p_k - d_{jj} p_j - \sum_{k \neq i} d_{jk}p_k \right) \nabla W_{ij}. | ||
| ``` | ||
|
|
||
| In this formulation all coefficients that are getting multiplied with the pressure value ``p_i`` | ||
| are separated from the other. The diagonal elements ``a_{ii}`` can therefore be defined as: | ||
|
|
||
| ```math | ||
| a_{ii} = \sum_j m_j ( d_{ii} - d_{ji})\nabla W_{ij}. | ||
| ``` | ||
|
|
||
| The remaining part of the equation represents the influence of the other pressure values ``p_j``. | ||
| Hence, the final relaxed Jacobi iteration takes the form: | ||
|
|
||
| ```math | ||
| p_i^{l+1} = (1 - \omega) p_i^{l} + \omega \frac{1}{a_{ii}} \left( \rho_0 -\rho_i^{\text{adv}} - \sum_j m_j \left( \sum_k d_{ik} p_k^l - d_{jj} p_j^l - \sum_{k \neq i} d_{jk} p_k^l \right) \nabla W_{ij} \right). | ||
| ``` | ||
|
|
||
| Because interactions are local, limited to particles within the kernel support defined by | ||
| the smoothing length, each particle's pressure ``p_i`` depends only on its own value and | ||
| nearby particles. | ||
| Consequently, the matrix ``A`` is sparse (most entries are zero). | ||
|
|
||
| The diagonal elements ``a_{ii}`` get computed and stored at the beginning of the simulation step | ||
| and remain unchanged throughout the relaxed Jacobi iterations. The same applies for the | ||
| ``d_{ii}``. The coefficients ``d_{ij}`` are computed, but not stored, as part of the calculation | ||
| of ``a_{ii}``. | ||
| During the Jacobi iterations, two loops over all particles are performed: | ||
| The first updates the values of ``\sum_j d_{ij}`` and the second computes the updated | ||
| pressure values ``p_i^{l+1}``. | ||
|
|
||
| The final pressure update follows the equation of the relaxed Jacobi scheme as stated above, with two | ||
| exceptions: | ||
| #### 1. Pressure clamping | ||
| To avoid negative pressure values, one can enable pressure clamping. In this case, the | ||
| pressure update is given by | ||
|
|
||
| ```math | ||
| p_i^{l+1} = \max \left(0, (1-\omega) p_i^l + \omega \frac{\rho_0 - \rho_i^{\text{adv}} - \sum_{j \neq i} a_{ij}p_j^l}{a_{ii}}\right). | ||
| ``` | ||
|
|
||
| #### 2. Small diagonal elements | ||
| If the diagonal element ``a_{ii}`` becomes too small or even zero, the simulation may become | ||
| unstable. This can occur, for example, if a particle is isolated and receives little or no | ||
| influence from neighboring particles, or due to numerical cancellations. In such cases, the | ||
| updated pressure value is set to zero. | ||
|
|
||
| There are also other options, like setting ``a_{ii}`` to the threshold value if it is beneath | ||
| and then update with the usual equation, or just don't update the pressure value at all, and | ||
| continue with the old value. The numerical error introduced by this technique remains small, | ||
| as only isolated or almost isolated particles are affected. | ||
|
|
||
|
|
||
| ## Boundary Handling | ||
|
|
||
| The previously introduced formulation only considered interactions between fluid particles | ||
| and neglected interactions between fluid and boundary particles. To account for boundary | ||
| interactions, a few modifications to the previous equations are required. | ||
|
|
||
| First, the discretized form of the continuity equation must be adapted for the case in which | ||
| a neighboring particle is a boundary particle. From now on, we distinguish between | ||
| neighboring fluid particles (indexed by ``j``) and neighboring boundary particles (indexed by | ||
| ``b``). | ||
|
|
||
| The updated discretized continuity equation becomes: | ||
|
|
||
| ```math | ||
| \frac{\rho_i(t + \Delta t) - \rho_i(t)}{\Delta t} = \sum_j m_j \bm{v}_{ij}(t+\Delta t) \nabla W_{ij} + \sum_b m_b \bm{v}_{ib}(t+\Delta t) \nabla W_{ib}. | ||
| ``` | ||
|
|
||
| Since boundary particles have zero velocity, the difference between the fluid | ||
| particle's velocity and the boundary particle's velocity simplifies to just the fluid | ||
| particle's velocity ``\bm{v}_{ib}(t+\Delta t) = \bm{v}_{i}(t+\Delta t)``. | ||
| Accordingly, the predicted density ``\rho^{\text{adv}}`` becomes: | ||
|
|
||
| ```math | ||
| \rho_i^{\text{adv}} = \rho_i (t) + \Delta t \sum_j m_j \bm{v}_{ij}^{\text{adv}} \nabla W_{ij}(t) + \Delta t \sum_b m_b \bm{v}_{i}^{\text{adv}} \nabla W_{ib}(t). | ||
| ``` | ||
|
|
||
| This leads to the following updated formulation of the linear system: | ||
|
|
||
| ```math | ||
| \Delta t^2 \sum_j m_j \left( \frac{\bm{F}_i^p(t)}{m_i} - \frac{\bm{F}_j^p(t)}{m_j} \right) \nabla W_{ij} + \Delta t^2 \sum_b m_b \frac{\bm{F}_i^p(t)}{m_i} \nabla W_{ib} = \rho_0 - \rho_i^{\text{adv}}. | ||
| ``` | ||
|
|
||
| Note that, since boundary particles are fixed, the force ``F_b^p`` is zero and does not appear in this equation. | ||
|
|
||
| The pressure force acting on a fluid particle is computed as: | ||
|
|
||
| ```math | ||
| \bm{F}_i^p(t) = -\sum_j m_j \left( \frac{p_i(t)}{\rho_i^2(t)} + \frac{p_j(t)}{\rho_j^2(t)} \right) \nabla W_{ij}(t) - \sum_b m_b \left( \frac{p_i(t)}{\rho_i^2(t)} + \frac{p_b(t)}{\rho_b^2(t)} \right) \nabla W_{ib}(t). | ||
| ``` | ||
|
|
||
| This also leads to an updated version of the equation for the diagonal elements: | ||
| ```math | ||
| a_{ii} = \sum_j m_j ( d_{ii} - d_{ji})\nabla W_{ij} + \sum_b m_b (-d_{bi}) \nabla W_{ib}. | ||
| ``` | ||
|
|
||
| From this point forward, the computation of the coefficients required for the Jacobi scheme | ||
| (such as ``d_{ii}``, ``d_{ij}`` etc.) depends on the specific boundary density evaluation method | ||
| used in the chosen boundary model. | ||
|
|
||
|
|
||
|
|
||
| ### Pressure Mirroring | ||
| When using pressure mirroring, the pressure value ``p_b`` of a boundary particle in the equation | ||
| above is defined to be equal to the pressure of the corresponding fluid particle ``p_i``. | ||
| In other words, the boundary particle "mirrors" the pressure of the fluid particle interacting | ||
| with it. As a result, the coefficient that describes the influence of a particle's own | ||
| pressure value ``p_i`` must also include contributions from boundary particles. Therefore, | ||
| the equation for calculating the coefficient ``d_{ii}`` must be adjusted as follows: | ||
|
|
||
| ```math | ||
| d_{ii} = -\Delta t^2 \sum_j \frac{m_j}{\rho_i^2} \nabla W_{ij} - \Delta t^2 \sum_b \frac{m_b}{\rho_i^2} \nabla W_{ib}. | ||
| ``` | ||
|
|
||
| The corresponding relaxed Jacobi iteration for pressure mirroring then becomes: | ||
|
|
||
| ```math | ||
| \begin{align*} | ||
| p_i^{l+1} = (1 - \omega) p_i^l + \omega \frac{1}{a_{ii}} &\left( \rho_0 - \rho_i^{\text{adv}} | ||
| - \sum_j m_j \left( \sum_k d_{ik} p_k^l - d_{jj}p_j^l - \sum_{k \neq i} d_{jk} p_k^l \right) \nabla W_{ij} \right. \\ | ||
| & \quad - \left. \sum_b m_b \sum_j d_{ij} p_j^l \nabla W_{ib} \right). | ||
| \end{align*} | ||
| ``` | ||
|
|
||
| ### Pressure Zeroing | ||
| If pressure zeroing is used instead, the pressure value of a boundary particle ``p_b`` | ||
| is assumed to be zero. Consequently, boundary particles do not contribute to the pressure | ||
| forces acting on fluid particles. | ||
| In this case, the computation of the coefficient ``d_{ii}`` remains unchanged and is given by: | ||
|
|
||
| ```math | ||
| d_{ii} = -\Delta t^2 \sum_j \frac{m_j}{\rho_i^2} \nabla W_{ij}. | ||
| ``` | ||
|
|
||
| The equation for the relaxed Jacobi iteration remains the same as in the pressure mirroring | ||
| approach. However, the contribution from boundary particles vanishes due to their zero | ||
| pressure: | ||
|
|
||
| ```math | ||
| \begin{align*} | ||
| p_i^{l+1} = (1 - \omega) p_i^l + \omega \frac{1}{a_{ii}} &\left( \rho_0 - \rho_i^{\text{adv}} | ||
| - \sum_j m_j \left( \sum_k d_{ik} p_k^l - d_{jj}p_j^l - \sum_{k \neq i} d_{jk} p_k^l \right) \nabla W_{ij} \right. \\ | ||
| & \quad - \left. \sum_b m_b \sum_j d_{ij} p_j^l \nabla W_{ib} \right). | ||
| \end{align*} | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # 2D dam break simulation using implicit incompressible SPH (IISPH) | ||
| using TrixiParticles | ||
|
|
||
| # Load setup from dam break example | ||
|
noahstruschka marked this conversation as resolved.
|
||
| trixi_include(@__MODULE__, | ||
| joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), | ||
|
noahstruschka marked this conversation as resolved.
|
||
| sol=nothing, ode=nothing) | ||
|
|
||
| # Change smoothing kernel and length | ||
| smoothing_length = 1.0 * fluid_particle_spacing | ||
| smoothing_kernel = SchoenbergCubicSplineKernel{2}() | ||
|
svchb marked this conversation as resolved.
Outdated
noahstruschka marked this conversation as resolved.
|
||
|
|
||
| # Calculate kinematic viscosity for the viscosity model | ||
|
noahstruschka marked this conversation as resolved.
Outdated
|
||
| nu = 0.02 * smoothing_length * sound_speed / 8 | ||
| viscosity = ViscosityAdami(; nu) | ||
|
noahstruschka marked this conversation as resolved.
|
||
|
|
||
| # Use IISPH as fluid system | ||
| time_step = 1e-3 | ||
| iisph_system = ImplicitIncompressibleSPHSystem(tank.fluid, smoothing_kernel, | ||
|
noahstruschka marked this conversation as resolved.
Outdated
|
||
| smoothing_length, fluid_density, | ||
| viscosity=ViscosityAdami(nu=nu), | ||
| acceleration=(0.0, -gravity), | ||
| min_iterations=2, | ||
| max_iterations=30, | ||
| time_step=time_step) | ||
|
|
||
| # Run the dam break simulation with these changes | ||
| trixi_include(@__MODULE__, | ||
| joinpath(examples_dir(), "fluid", "dam_break_2d.jl"), | ||
| viscosity_fluid=ViscosityAdami(nu=nu), | ||
| smoothing_kernel=smoothing_kernel, | ||
| smoothing_length=smoothing_length, | ||
| fluid_system=iisph_system, | ||
| boundary_density_calculator=PressureZeroing(), | ||
| tspan=tspan, | ||
| state_equation=nothing, | ||
| callbacks=CallbackSet(info_callback, saving_callback), | ||
| time_integration_algorithm=SymplecticEuler(), dt=time_step) | ||
|
svchb marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.