SmoothedParticleHydrodynamics
Documentation for SmoothedParticleHydrodynamics.
The fluid is represented by a set of discrete particles. Each particle is centered at the location $\mathbf r_i$. The position varies in time:
\[\frac{d \mathbf r_i}{dt} = \mathbf v_i\]
where $\mathbf v_i$ is the velocity of the i-th particle. Each particle can have a property $A$:
\[A(\mathbf r) = \int A(\mathbf r') W(|\mathbf r - \mathbf r'|,h) d^n r'\]
The function $W$ is the kernel function which has a characteristic length-scale $h$ and it normalized:
\[\int W(|\mathbf r - \mathbf r'|,h) d^n r' = 1\]
and converges to the Dirac function $\delta(\mathbf r - \mathbf r')$ if $h$ tends to zero.
\[\lim_{h \rightarrow 0} W(|\mathbf r - \mathbf r'|,h) = \delta(\mathbf r - \mathbf r')\]
For small $h$ enought and sufficiently many particles, we can therefore approximate the integral using the discrete sum:
\[A(\mathbf r) = \sum_i V_i A_i W(|\mathbf r - \mathbf r_i|,h)\]
where $V_i$ is the volume associated to the i-th particle. Knowing the mass $m_j$ of every particle, we can calculate the density as:
\[\rho(r) = \sum_j m_j W(|\mathbf r - \mathbf r_j|,h)\]
since $m_i = V_i \rho_i$. The density at the particle location $\mathbf r_i$ becomes:
\[\rho_i = \rho(\mathbf r_i) = \sum_j m_j W(|\mathbf r_i - \mathbf r_j|,h)\]
If we differentiate the density relative to time:
\[\frac{d\rho_i}{dt} = \sum_j m_j (\mathbf v_i - \mathbf v_j) \nabla W_{ij}\]
which can be seen as a discretized form of:
\[\frac{d\rho}{dt} = -\rho \nabla \cdot v\]
The pressure gradient is computed using the symmetric form by analogy of the evolution equation of density:
\[\nabla p(r_i) = \rho_i \sum_j m_j \left(\frac{p_i}{\rho_i^2} + \frac{p_j}{\rho_j^2}\right) ∇W(|\mathbf r - \mathbf r_i|,h)\]
Similarly the viscosity force is given by:
\[F_i = \mu \nabla^2 \mathbf v(r_i) \mu \sum_j m_j \frac{\mathbf v_j - \mathbf v_i}{\rho_j} \left(\frac{p_i}{\rho_i^2} + \frac{p_j}{\rho_j^2}\right) ∇²W\]
SmoothedParticleHydrodynamics.KernelSpiky
SmoothedParticleHydrodynamics.Location
SmoothedParticleHydrodynamics.surface_hypersphere
SmoothedParticleHydrodynamics.KernelSpiky
— Methodk = KernelSpiky(n,h)
Kernel in n
dimension with characteristic radius h
given by the following expression:
\[W(r,h) = c \; (h - r)^3\]
for $r \le h$ where $r$ is the radial distance and where the normalization coefficient $c$ is given by:
\[\frac{1}{S_n \, c} = \int_0^h\left(h-r\right)^3 r^{n-1}dr =\frac{h^{n+3}}{n}-\frac{3h^{n+3}}{n+1}+\frac{3h^{n+3}}{n+2}-\frac{h^{n+3}}{n+3}\]
where $S_n$ is the surface of the unit n-sphere.
SmoothedParticleHydrodynamics.Location
— Typeloc = Location(p)
Adapter type for SpatialHashing such that loc[i]
returns p.x[i]
where p
is a list of particles.
SmoothedParticleHydrodynamics.surface_hypersphere
— MethodS = surface_hypersphere(N)
Surface of a N-sphere. For example if N=3, its surface is 4π.