AQUAgpusph 5.0.4
|
Variable time step computation. More...
#include "resources/Scripts/types/types.h"
#include "resources/Scripts/KernelFunctions/Kernel.h"
#include "resources/Scripts/cfd/ideal_gas/sound_speed.hcl"
Functions | |
__kernel void | entry (__global float *dt_var, const __global int *imove, const __global unsigned int *iset, const __global vec *u, const __global vec *dudt, const __global float *rho, const __global float *p, const __global float *m, const usize N, const float dt, const float dt_min, const float courant, const float h, const __global float *div_u, const __global vec *grad_p, __constant float *gamma) |
Compute the maximum time step for each particle. |
Variable time step computation.
__kernel void entry | ( | __global float * | dt_var, |
const __global int * | imove, | ||
const __global unsigned int * | iset, | ||
const __global vec * | u, | ||
const __global vec * | dudt, | ||
const __global float * | rho, | ||
const __global float * | p, | ||
const __global float * | m, | ||
const usize | N, | ||
const float | dt, | ||
const float | dt_min, | ||
const float | courant, | ||
const float | h, | ||
const __global float * | div_u, | ||
const __global vec * | grad_p, | ||
__constant float * | gamma ) |
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 \). |