Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
PharmCat committed Feb 27, 2024
1 parent 5c09706 commit 76bd9da
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 4 deletions.
66 changes: 63 additions & 3 deletions docs/src/details.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,53 @@
## Details

`m_i, m_j`
### Denotation

`m_0`
Particle indexes: ``i``, ``j``;

``W`` - kernel function value;

``\nabla W`` - kernel function gradient;

``h`` - smoothing length;

``H ~ 2h`` - kernel support length;

``m, m_i, m_j`` - mass;

``m_0`` - reference mass;

``\rho. \rho_i, \rho_j`` - dencity;

``\rho_0`` - reference dencity;

``p, p_i, p_j`` - pressure;

``\Pi`` - artificial viscosity term;

``\textbf{r}, \textbf{r}_i, \textbf{r}_j`` - particle location (vector);

``\textbf{r}_{ij} = \textbf{r}_{i} - \textbf{r}_{j}`` - particle ``i`` to ``j`` distance (vector);

``r_{ij} = \sqrt{\textbf{r}_{ji} \cdot \textbf{r}_{ji}}`` - particle ``i`` to ``j`` distance;

``\textbf{v}, \textbf{v}_i, \textbf{v}_j`` - velocity (vector);

``\textbf{v}_{ij} = \textbf{v}_{i} - \textbf{v}_{j}`` - relative velocity (vector);

``V, V_i, V_j`` - volume;

``V_i = \frac{m_i}{\rho_i}; V_j = \frac{m_j}{\rho_j}``


### Constants

``g`` - gravity;

``c₀`` - speed of sound;

``γ = 7`` - gamma costant (pressure equation of state);

``\delta_{\Phi}`` - coefficient for density diffusion;



Expand All @@ -15,10 +60,12 @@
\\
\\
\overline{c}_{ij} = \frac{c_i + c_j}{2}
\\
\\
\overline{\rho}_{ij} = \frac{\rho_i + \rho_j}{2}
```
Expand All @@ -28,6 +75,7 @@ Monaghan style artificial viscosity:
```math
\frac{\partial \textbf{v}_i}{\partial t} = - \sum m_j \Pi_{ij} \nabla_i W_{ij}
```

J. Monaghan, “Smoothed particle hydrodynamics”, Reports on Progress in Physics, 68 (2005), pp. 1703-1759.
Expand All @@ -36,7 +84,7 @@ J. Monaghan, “Smoothed particle hydrodynamics”, Reports on Progress in Physi
### Momentum Equation with Artificial Viscosity

```math
\frac{\partial \textbf{v}_i}{\partial t} = - \sum m_j \left( \frac{b_i}{\rho^2_i} + \frac{b_j}{\rho^2_j} + \Pi_{ij} \right) \nabla_i W_{ij}
\frac{\partial \textbf{v}_i}{\partial t} = - \sum m_j \left( \frac{p_i}{\rho^2_i} + \frac{p_j}{\rho^2_j} + \Pi_{ij} \right) \nabla_i W_{ij}
```

Expand All @@ -51,6 +99,12 @@ J. Monaghan, Smoothed Particle Hydrodynamics, “Annual Review of Astronomy and
\frac{\partial \rho_i}{\partial t} = \sum m_j \textbf{v}_{ij} \cdot \nabla_i W_{ij} + \delta_{\Phi} h c_0 \sum \Psi_{ij} \cdot \nabla_i W_{ij} \frac{m_j}{\rho_j}
\\
\\
\Psi_{ij} = 2 (\rho_{ij}^T + \rho_{ij}^H) \frac{\textbf{r}_{ij}}{r_{ij}^2 + \eta^2}
```


Expand All @@ -67,24 +121,30 @@ J. Monaghan, Smoothed Particle Hydrodynamics, “Annual Review of Astronomy and


```math
\delta \textbf{v}_i^{DPC} = \sum k_{ij}\frac{m_j}{m_i + m_j}v_{ij}^{coll} + \frac{\Delta t}{\rho_i}\sum \phi_{ij} \frac{2V_j}{V_i + V_j}\frac{p_{ij}^b}{r_{ij}^2 + \eta^2}\textbf{r}_{ij}
\\
\\
(v_{ij}^{coll} , \quad \phi_{ij}) = \begin{cases} (\frac{\textbf{v}_{ij}\cdot \textbf{r}_{ij}}{r_{ij}^2 + \eta^2}\textbf{r}_{ji}, \quad 0) & \textbf{v}_{ij}\cdot \textbf{r}_{ij} < 0 \\ (0, \quad 1) & otherwise \end{cases}
\\
\\
p_{ij}^b = \tilde{p}_{ij} \chi_{ij}
\\
\\
\tilde{p}_{ij} = max(min(\lambda |p_i + p_j|, \lambda p_{max}), p_{min})
\\
\\
\chi_{ij} = \sqrt{\frac{\omega({r}_{ij}, l_0)}{\omega(l_0/2, l_0)}}
\\
\\
k_{ij} = \begin{cases} \chi_{ij} & 0.5 \le {r}_{ij}/l_0 < 1 \\ 1 & {r}_{ij}/l_0 < 0.5 \end{cases}
Expand Down
10 changes: 9 additions & 1 deletion src/gpukernels2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,11 @@ Compute ∂ρ∂t - density derivative includind density diffusion.
```math
\\frac{\\partial \\rho_i}{\\partial t} = \\sum m_j \\textbf{v}_{ij} \\cdot \\nabla_i W_{ij} + \\delta_{\Phi} h c_0 \\sum \\Psi_{ij} \\cdot \\nabla_i W_{ij} \\frac{m_j}{\\rho_j}
\\frac{\\partial \\rho_i}{\\partial t} = \\sum m_j \\textbf{v}_{ij} \\cdot \\nabla_i W_{ij} + \\delta_{\\Phi} h c_0 \\sum \\Psi_{ij} \\cdot \\nabla_i W_{ij} \\frac{m_j}{\\rho_j}
\\\\
\\Psi_{ij} = 2 (\\rho_{ij}^T + \\rho_{ij}^H) \\frac{\\textbf{r}_{ij}}{r_{ij}^2 + \\eta^2}
```
"""
Expand Down Expand Up @@ -901,6 +904,11 @@ end
∂v∂t!(∑∂v∂t, ∇Wₙ, pairs, m, ρ, c₀, γ, ρ₀)
The momentum equation (without dissipation).
\\frac{\\partial \\textbf{v}_i}{\\partial t} = - \\sum m_j \\left( \\frac{p_i}{\\rho^2_i} + \\frac{p_j}{\\rho^2_j} \\right) \\nabla_i W_{ij}
"""
function ∂v∂t!(∑∂v∂t, ∇W, P, pairs, m, ρ)
gpukernel = @cuda launch=false kernel_∂v∂t!(∑∂v∂t, ∇W, P, pairs, m, ρ)
Expand Down

0 comments on commit 76bd9da

Please sign in to comment.