AQUAgpusph 4.1.2
|
Variable time step computation. More...
#include "resources/Scripts/types/types.h"
Functions | |
__kernel void | entry (__global float *dt_var, __global vec *u, __global vec *dudt, unsigned int N, float dt, float dt_min, float courant, float h) |
Compute the maximum time step for each particle. | |
Variable time step computation.
__kernel void entry | ( | __global float * | dt_var, |
__global vec * | u, | ||
__global vec * | dudt, | ||
unsigned int | N, | ||
float | dt, | ||
float | dt_min, | ||
float | courant, | ||
float | h | ||
) |
Compute the maximum time step for each particle.
In SPH the time step is selected to enforce the particles may not move more than \( 0.1 h \), where the Courant factor is not taken into account yet.
Along this line, the distance moved by a particle can be written as follows:
\( \vert \mathbf{r}_{n+1} - \mathbf{r}_{n} \vert = \vert \mathbf{u} \vert \Delta t + \frac{1}{2} \left\vert \frac{\mathrm{d} \mathbf{u}}{\mathrm{d} t} \right\vert {\Delta t}^2 + \mathcal{O}({\Delta t}^3) \)
Such that, taking maximums, and rearraging the equation:
\( \Delta t = \frac{1}{20} \min \left( \frac{h}{\vert \mathbf{u} \vert}, \sqrt{\frac{2 h}{\left\vert \frac{\mathrm{d} \mathbf{u}}{\mathrm{d} t} \right\vert}} \right) \)
dt_var | Variable time step \( \mathrm{min} \left( C_f \frac{h}{c_s}, C_f \frac{h}{10 \vert \mathbf{u} \vert}\right)\). |
u | Velocity \( \mathbf{u}_{n+1/2} \). |
dudt | Velocity rate of change \( \frac{d \mathbf{u}}{d t} \). |
N | Number of particles. |
dt | Fixed time step \( \Delta t = C_f \frac{h}{c_s} \). |
dt_min | Minimum time step \( \Delta t_{\mathrm{min}} \). |
courant | Courant factor \( C_f \). |
h | Kernel characteristic length \( h \). |