AQUAgpusph 4.1.2
|
Basic preset of tools to build more complex sets of tools later. More...
Files | |
file | Binormal.cl |
Compute the tangent vector in 2D sims, and the binormal in 3D sims. | |
file | deltaSPH.cl |
delta-SPH methods, including the correction terms | |
file | DensityClamp.cl |
Particles out of domain filter. | |
file | Domain.cl |
Particles out of domain filter. | |
file | EOS.cl |
Equation Of State (EOS) computation. | |
file | IdInverse.cl |
Permutations to move from the sorted indexes space to the unsorted one. | |
file | MLS.cl |
MLS kernel transformation matrix computation. | |
file | Coalesce.cl |
Splitting particles methods. | |
file | Cube.cl |
Splitting particles methods. | |
file | Remove.cl |
Set the mass of the particles according to the iterations since they were split/coalesced. | |
file | SetMass.cl |
Set the mass of the particles according to the iterations since they were split/coalesced. | |
file | Sort.cl |
Sort the multiresolution involved particle properties. | |
file | Sphere.cl |
Splitting particles methods. | |
file | Split.cl |
Splitting particles methods. | |
file | neighs.cl |
Compute the number of neighbours of each particle. | |
file | SetBuffer.cl |
Buffer particles identify and usage. | |
file | Shepard.cl |
Shepard renormalization factor computation. | |
file | Sort.cl |
Sort all the particle variables by the cell indexes. | |
file | adam_bashforth.cl |
Improved Euler time integration scheme. | |
file | euler.cl |
1st order Euler time integration scheme | |
file | implicit_midpoint_euler.cl |
Implicit Midpoint Euler time integration scheme. | |
file | improved_euler.cl |
Improved Euler time integration scheme. | |
file | deltaSPH.cl |
delta-SPH methods, including the correction terms | |
file | Shepard.cl |
Shepard renormalization factor computation, when variable kernel length is considered. | |
file | Sort.cl |
Sort all the particle variables by the cell indexes. | |
file | MLS.cl |
Shepard renormalization factor computation. | |
file | Shepard.cl |
Shepard renormalization factor computation. | |
file | Shepard.cl |
Shepard renormalization factor computation. | |
file | Predictor.cl |
Improved Euler time integration scheme predictor stage. | |
Macros | |
#define | EXCLUDED_PARTICLE(index) imove[index] <= 0 |
Condition to exclude a particle from the delta-SPH model. | |
#define | EXCLUDED_PARTICLE(index) (imove[index] <= 0) && (imove[index] != -1) |
Condition to exclude a particle from the EOS computation. | |
#define | M_ITERS 10 |
#define | CAPTURING_RADIUS 0.75f |
#define | CAPTURING_RADIUS2 (CAPTURING_RADIUS + 0.01f) |
#define | M_ITERS 10 |
#define | M_ITERS 10 |
Number of iterations to complete the mass transfer. | |
#define | N_DAUGHTER 8 |
#define | M_ITERS 10 |
#define | EXCLUDED_PARTICLE(index) imove[index] >= 3 |
Excluded particles from the Shepard renormalization factor computation. | |
#define | TSCHEME_ADAMS_BASHFORTH_STEPS 5u |
#define | DYDT_1(dydt_0) dydt_0 |
#define | DYDT_2(dydt_0, dydt_1) 1.5f * dydt_0 - 0.5f * dydt_1 |
#define | DYDT_3(dydt_0, dydt_1, dydt_2) 23.f / 12.f * dydt_0 - 4.f / 3.f * dydt_1 + 5.f / 12.f * dydt_2 |
#define | DYDT_4(dydt_0, dydt_1, dydt_2, dydt_3) |
#define | DYDT_5(dydt_0, dydt_1, dydt_2, dydt_3, dydt_4) |
#define | EXCLUDED_PARTICLE(index) imove[index] <= 0 |
Condition to exclude a particle from the delta-SPH model. | |
#define | EXCLUDED_PARTICLE(index) imove[index] >= 3 |
Excluded particles from the Shepard renormalization factor computation. | |
Functions | |
__kernel void | entry (const __global vec *normal, __global vec *tangent, __global vec *binormal, unsigned int N) |
Compute the tanget vector in 2D simulations, and the binormal vector in 3D simulations. | |
__kernel void | simple (const __global unsigned int *iset, const __global int *imove, __global vec *lap_p_corr, __constant float *refd, unsigned int N, vec g) |
Simple hidrostatic based correction term. | |
__kernel void | full (const __global int *imove, const __global vec *r, const __global float *rho, const __global float *m, const __global float *p, __global vec *lap_p_corr, const __global uint *icell, const __global uint *ihoc, uint N, uivec4 n_cells) |
MLS based correction term. | |
__kernel void | full_mls (const __global int *imove, const __global matrix *mls, __global vec *lap_p_corr, uint N) |
MLS based correction term. | |
__kernel void | lapp (const __global int *imove, const __global vec *r, const __global float *rho, const __global float *m, const __global float *p, __global float *lap_p, const __global uint *icell, const __global uint *ihoc, uint N, uivec4 n_cells) |
Laplacian of the pressure computation. | |
__kernel void | lapp_corr (const __global int *imove, const __global vec *r, const __global float *rho, const __global float *m, const __global vec *lap_p_corr, __global float *lap_p, const __global uint *icell, const __global uint *ihoc, uint N, uivec4 n_cells) |
Laplacian of the pressure correction. | |
__kernel void | deltaSPH (const __global unsigned int *iset, const __global int *imove, const __global float *rho, const __global float *lap_p, __global float *drhodt, __constant float *refd, __constant float *delta, unsigned int N, float dt) |
Density variation rates delta-SPH term. | |
__kernel void | entry (__global float *rho_in, uint N, float rho_min, float rho_max) |
Clamp the density. | |
__kernel void | entry (__global int *imove, __global vec *r, __global vec *u, __global vec *dudt, __global float *m, uint N, vec domain_min, vec domain_max) |
Check and destroy the particles out of the domain. | |
__kernel void | entry (__global unsigned int *iset, __global int *imove, __global float *rho, __global float *p, __constant float *refd, unsigned int N, float cs, float p0) |
Stiffness Equation Of State (EOS) computation. | |
__kernel void | entry (__global uint *id, __global uint *id_inverse, unsigned int N) |
Compute the permutations to move from the sorted indexes space to the unsorted one. | |
__kernel void | entry (const __global int *imove, const __global vec *r, const __global float *rho, const __global float *m, __global matrix *mls, const __global uint *icell, const __global uint *ihoc, uint N, uivec4 n_cells, uint mls_imove) |
Compute the MLS transformation matrix inverse, \( L_i^{-1} \). | |
__kernel void | mls_inv (const __global int *imove, __global matrix *mls, uint N, uint mls_imove) |
Invert the matrix computed in entry() to get the final MLS transformation matrix, \( L_i \). | |
__kernel void | seed_candidates (__global const unsigned int *iset, __global const int *imove, __global const unsigned int *ilevel, __global const unsigned int *level, __global const float *m0, __global int *miter, __global const vec *r, __global unsigned int *isplit, __global ivec *split_cell, __global float *split_dist, __constant float *dr_level0, unsigned int N) |
Look for all the seed candidates, i.e. all the particles which have a refinement level target lower than their current value. | |
__kernel void | seeds (__global const unsigned int *iset, __global const unsigned int *isplit_in, __global unsigned int *isplit, __global int *miter, __global const ivec *split_cell, __global const float *split_dist, __global const uint *icell, __global const uint *ihoc, unsigned int N, uivec4 n_cells) |
Get only one seed per cell. | |
__kernel void | set_isplit_in (__global const unsigned int *isplit, __global unsigned int *isplit_in, unsigned int N) |
Create a copy of isplit, where everything is 0 except the seeds, which take the value 1. Such array can be used to count the number of new particles to become generated. | |
__kernel void | children (__global const int *imove, __global const unsigned int *iset, __global const vec *r, __global const unsigned int *ilevel, __global unsigned int *isplit, __global int *miter, __global const uint *icell, __global const uint *ihoc, __constant float *dr_level0, unsigned int N, uivec4 n_cells) |
Look for all children, close enough to the seed. | |
__kernel void | weights (__global const unsigned int *iset, __global const unsigned int *ilevel, __global const vec *r, __global const unsigned int *isplit, __global float *split_weight, __global const uint *icell, __global const uint *ihoc, __constant float *dr_level0, unsigned int N, uivec4 n_cells) |
Compute the contribution weight of each children particle. | |
__kernel void | generate (__global int *imove, __global int *iset, __global const unsigned int *isplit, __global unsigned int *split_invperm, __global unsigned int *ilevel, __global unsigned int *level, __global int *miter, __global uint *mybuffer, unsigned int N, unsigned int nbuffer) |
Associate a buffer particle to a seed. | |
__kernel void | fields (__global const unsigned int *iset, __global const uint *isplit, __global const uint *mybuffer, __global const unsigned int *ilevel, __global const float *split_weight, __global float *m0, __global float *m, __global vec *r, __global vec *u, __global vec *dudt, __global float *rho, __global float *drhodt, __global const uint *icell, __global const uint *ihoc, __constant float *dr_level0, unsigned int N, uivec4 n_cells) |
Collect the children, and the seed itself, in order to compute the field values of the buffer partner particle. | |
__kernel void | entry (__global const int *imove, __global const unsigned int *ilevel, __global const vec *r, __global unsigned int *level, unsigned int N, vec multiresolution_cube_min, vec multiresolution_cube_max, unsigned int multiresolution_cube_level) |
Set the refinement level of the particles inside. | |
__kernel void | entry (__global int *imove, __global const int *miter, __global vec *r, vec domain_max, unsigned int N) |
Set the mass of the particles according to their gamma value. | |
__kernel void | set_mass (__global const int *imove, __global const float *m0, __global int *miter, __global float *m, unsigned int N) |
Set the mass of the particles according to their gamma value. | |
__kernel void | entry (const __global float *m0_in, __global float *m0, const __global int *miter_in, __global int *miter, const __global uint *ilevel_in, __global uint *ilevel, const __global uint *level_in, __global uint *level, const __global unit *id_sorted, unsigned int N) |
Sort the multiresolution involved particle properties. | |
__kernel void | entry (__global const int *imove, __global const unsigned int *ilevel, __global const vec *r, __global unsigned int *level, unsigned int N, vec multiresolution_sphere_center, float multiresolution_sphere_radius, unsigned int multiresolution_sphere_level) |
Set the refinement level of the particles inside. | |
__kernel void | check_split (__global const int *imove, __global const float *m, __global const int *miter, __global const unsigned int *ilevel, __global const unsigned int *level, __global unsigned int *isplit, unsigned int N) |
Check and store wether a particle should become split or not. | |
__kernel void | generate (__global int *imove, __global int *iset, __global unsigned int *isplit, __global unsigned int *split_invperm, __global unsigned int *ilevel, __global unsigned int *level, __global float *m0, __global int *miter, __global float *m, __global vec *r, __global vec *u, __global vec *dudt, __global float *rho, __global float *drhodt, unsigned int N, unsigned int nbuffer) |
Split a particle in a set of daughter particles. | |
__kernel void | entry (const __global int *imove, __global uint *n_neighs, const __global uint *icell, const __global uint *ihoc, uint neighs_limit, uint N, uivec4 n_cells) |
Number of neighbours of each particle. | |
__kernel void | count (__global const int *imove, __global unsigned int *ibuffer, uint N) |
Identify the buffer particles. | |
__kernel void | set_imove (__global int *imove, uint N) |
Replace the particles with the imove flag imove=-256 by imove=-255. | |
__kernel void | entry (const __global int *imove, const __global vec *r, const __global float *rho, const __global float *m, __global float *shepard, const __global uint *icell, const __global uint *ihoc, uint N, uivec4 n_cells) |
Shepard factor computation. | |
__kernel void | stage1 (const __global uint *id_in, __global uint *id, const __global uint *iset_in, __global uint *iset, const __global int *imove_in, __global int *imove, const __global vec *r_in, __global vec *r, const __global vec *normal_in, __global vec *normal, const __global vec *tangent_in, __global vec *tangent, const __global unit *id_sorted, unsigned int N) |
Sort all the particle variables by the cell indexes. | |
__kernel void | stage2 (const __global float *rho_in, __global float *rho, const __global float *m_in, __global float *m, const __global vec *u_in, __global vec *u, const __global vec *dudt, __global vec *dudt_in, const __global float *drhodt, __global float *drhodt_in, const __global unit *id_sorted, unsigned int N) |
Sort all the particle variables by the cell indexes. | |
__kernel void | predictor (__global vec *r, __global vec *u, __global vec *dudt, __global float *rho, __global float *drhodt, __global vec *r_in, __global vec *u_in, __global vec *dudt_in, __global float *rho_in, __global float *drhodt_in, unsigned int N) |
Adams-Bashforth time integration scheme predictor stage. | |
__kernel void | sort (const __global vec *dudt_as1_in, __global vec *dudt_as1, const __global vec *dudt_as2_in, __global vec *dudt_as2, const __global vec *dudt_as3_in, __global vec *dudt_as3, const __global vec *dudt_as4_in, __global vec *dudt_as4, const __global float *drhodt_as1_in, __global float *drhodt_as1, const __global float *drhodt_as2_in, __global float *drhodt_as2, const __global float *drhodt_as3_in, __global float *drhodt_as3, const __global float *drhodt_as4_in, __global float *drhodt_as4, const __global unit *id_sorted, unsigned int N) |
Sort the stored Adams-Bashforth stored variation rates. | |
__kernel void | corrector (__global int *imove, __global unsigned int *iset, __global vec *r, __global vec *u, __global vec *dudt, __global float *rho, __global float *drhodt, __global vec *dudt_as1, __global float *drhodt_as1, __global vec *dudt_as2, __global float *drhodt_as2, __global vec *dudt_as3, __global float *drhodt_as3, __global vec *dudt_as4, __global float *drhodt_as4, unsigned int N, float dt, unsigned int iter) |
Improved Euler time integration scheme corrector stage. | |
__kernel void | postcorrector (const __global vec *dudt_as1, const __global float *drhodt_as1, const __global vec *dudt_as2, const __global float *drhodt_as2, const __global vec *dudt_as3, const __global float *drhodt_as3, const __global vec *dudt, const __global float *drhodt, __global vec *dudt_as1_in, __global float *drhodt_as1_in, __global vec *dudt_as2_in, __global float *drhodt_as2_in, __global vec *dudt_as3_in, __global float *drhodt_as3_in, __global vec *dudt_as4_in, __global float *drhodt_as4_in, unsigned int N) |
Backup de data for the sorting algorithm. | |
__kernel void | corrector (__global int *imove, __global unsigned int *iset, __global vec *r, __global vec *u, __global vec *dudt, __global float *rho, __global float *drhodt, unsigned int N, float dt) |
1st orderv Euler time integration scheme corrector stage | |
__kernel void | predictor (const __global int *imove, const __global vec *r, const __global vec *u_0, const __global vec *dudt, const __global float *rho_0, const __global float *drhodt, __global vec *r_in, __global vec *u_in, __global vec *dudt_in, __global float *rho_in, __global float *drhodt_in, unsigned int N, float dt) |
Implicit Midpoint Euler time integration scheme predictor stage. | |
__kernel void | sort (const __global float *rho_0_in, __global float *rho_0, const __global vec *u_0_in, __global vec *u_0, const __global unit *id_sorted, unsigned int N) |
Implicit Midpoint Euler time integration scheme variables sorting. | |
__kernel void | corrector (const __global int *imove, const __global vec *dudt_in, const __global float *drhodt_in, __global vec *dudt, __global float *drhodt, unsigned int N, float subiter_relax) |
Relax the variation rates modification at the fixed point iterative solution. | |
__kernel void | integrate (const __global int *imove, const __global vec *r_in, const __global vec *u_0, const __global vec *dudt, const __global float *rho_0, const __global float *drhodt, __global vec *r, __global vec *u, __global float *rho, unsigned int N, float dt) |
Integrate the system to the next time step, when the implicit subiterator already finished his job. | |
__kernel void | predictor (__global int *imove, __global vec *r, __global vec *u, __global vec *dudt, __global float *rho, __global float *drhodt, __global vec *r_in, __global vec *u_in, __global vec *dudt_in, __global float *rho_in, __global float *drhodt_in, unsigned int N, float dt) |
Improved Euler time integration scheme predictor stage. | |
__kernel void | corrector (__global int *imove, __global unsigned int *iset, __global vec *r, __global vec *u, __global vec *dudt, __global float *rho, __global float *drhodt, __global vec *dudt_in, __global float *drhodt_in, unsigned int N, float dt) |
Improved Euler time integration scheme corrector stage. | |
__kernel void | lapp (const __global int *imove, const __global vec *r, const __global float *rho, const __global float *m, const __global float *p, const __global float *h_var, __global float *lap_p, const __global uint *icell, const __global uint *ihoc, uint N, uivec4 n_cells) |
Laplacian of the pressure computation. | |
__kernel void | entry (const __global int *imove, const __global vec *r, const __global float *rho, const __global float *m, const __global float *h_var, __global float *shepard, const __global uint *icell, const __global uint *ihoc, uint N, uivec4 n_cells) |
Shepard factor computation. | |
__kernel void | entry (const __global float *h_var_in, __global float *h_var, const __global unit *id_sorted, unsigned int N) |
Sort all the particle variables by the cell indexes. | |
__kernel void | entry (const __global int *imove, const __global int *imirrored, const __global vec *r, const __global float *rho, const __global float *m, __global matrix *mls, const __global uint *icell, const __global uint *ihoc, uint N, uivec4 n_cells, uint mls_imove) |
Compute the MLS transformation matrix inverse, \( L_i^{-1} \), due to the particles at the other portal side. | |
__kernel void | entry (const __global int *imove, const __global int *imirrored, const __global vec *r, const __global float *rho, const __global float *m, __global float *shepard, const __global uint *icell, const __global uint *ihoc, uint N, uivec4 n_cells) |
Shepard factor computation, due to the particles at the other portal side. | |
__kernel void | entry (const __global int *imove, const __global int *imirrored, const __global vec *r, const __global float *rho, const __global float *m, const __global float *h_var, __global float *shepard, const __global uint *icell, const __global uint *ihoc, uint N, uivec4 n_cells) |
Shepard factor computation, due to the particles at the other portal side. | |
__kernel void | entry (const __global int *imove, const __global matrix *S, const __global matrix *dSdt, __global matrix *S_in, __global matrix *dSdt_in, unsigned int N, float dt) |
Improved Euler time integration scheme predictor stage. | |
Basic preset of tools to build more complex sets of tools later.
#define CAPTURING_RADIUS 0.75f |
#define CAPTURING_RADIUS2 (CAPTURING_RADIUS + 0.01f) |
#define DYDT_1 | ( | dydt_0 | ) | dydt_0 |
#define DYDT_2 | ( | dydt_0, | |
dydt_1 | |||
) | 1.5f * dydt_0 - 0.5f * dydt_1 |
#define DYDT_3 | ( | dydt_0, | |
dydt_1, | |||
dydt_2 | |||
) | 23.f / 12.f * dydt_0 - 4.f / 3.f * dydt_1 + 5.f / 12.f * dydt_2 |
#define DYDT_4 | ( | dydt_0, | |
dydt_1, | |||
dydt_2, | |||
dydt_3 | |||
) |
#define DYDT_5 | ( | dydt_0, | |
dydt_1, | |||
dydt_2, | |||
dydt_3, | |||
dydt_4 | |||
) |
#define EXCLUDED_PARTICLE | ( | index | ) | imove[index] <= 0 |
Condition to exclude a particle from the delta-SPH model.
By default all the boundary elements are excluded. Even though it is enough for simulation where fluid and solid mechanics are not combined, it is strongly recommended to conveniently overload this macro.
#define EXCLUDED_PARTICLE | ( | index | ) | (imove[index] <= 0) && (imove[index] != -1) |
Condition to exclude a particle from the EOS computation.
By default all the boundary elements are excluded, excepting the fixed particles (imove = -1)
#define EXCLUDED_PARTICLE | ( | index | ) | imove[index] >= 3 |
Excluded particles from the Shepard renormalization factor computation.
By default all the particles are included. Therefore it is strongly recommended to redefine this macro to specify whether the fluid particles (imove != 1) or the solid particles (imove != 2) are used
#define EXCLUDED_PARTICLE | ( | index | ) | imove[index] <= 0 |
Condition to exclude a particle from the delta-SPH model.
By default all the boundary elements are excluded. Even though it is enough for simulation where fluid and solid mechanics are not combined, it is strongly recommended to conveniently overload this macro.
#define EXCLUDED_PARTICLE | ( | index | ) | imove[index] >= 3 |
Excluded particles from the Shepard renormalization factor computation.
By default all the particles are included. Therefore it is strongly recommended to redefine this macro to specify whether the fluid particles (imove != 1) or the solid particles (imove != 2) are used
#define M_ITERS 10 |
#define M_ITERS 10 |
#define M_ITERS 10 |
Number of iterations to complete the mass transfer.
When a particle is split or coalesced, its mass is not inmediately removed, but a smooth transition is carried out
#define M_ITERS 10 |
#define N_DAUGHTER 8 |
#define TSCHEME_ADAMS_BASHFORTH_STEPS 5u |
__kernel void check_split | ( | __global const int * | imove, |
__global const float * | m, | ||
__global const int * | miter, | ||
__global const unsigned int * | ilevel, | ||
__global const unsigned int * | level, | ||
__global unsigned int * | isplit, | ||
unsigned int | N | ||
) |
Check and store wether a particle should become split or not.
A particle should be split if the target refinement level is bigger than its current one, and it is not already spliting/coalescing.
imove | Moving flags.
|
m | Current mass \( m \). |
miter | Mass transfer iteration (Positive for growing particles, negative for shrinking particles). |
ilevel | Current refinement level of the particle. |
level | Target refinement level of the particle. |
isplit | 0 if the particle should not become split, 1 otherwise |
N | Number of particles. |
__kernel void children | ( | __global const int * | imove, |
__global const unsigned int * | iset, | ||
__global const vec * | r, | ||
__global const unsigned int * | ilevel, | ||
__global unsigned int * | isplit, | ||
__global int * | miter, | ||
__global const uint * | icell, | ||
__global const uint * | ihoc, | ||
__constant float * | dr_level0, | ||
unsigned int | N, | ||
uivec4 | n_cells | ||
) |
Look for all children, close enough to the seed.
When a particle is not already splitting or coalescing, and is close enough to one or more seeds (which should has the same refinement level and belongs to the same particles set), then it is marked as coalescing child.
Hence, since a particle may be close enough to several partner particles, later we should compute contribution weights.
imove | Moving flags.
|
iset | Set of particles index. |
r | Position \( \mathbf{r} \). |
ilevel | Current refinement level of the particle. |
isplit | 0 if the particle should not become coalesced, 1 for the coalescing particles, 2 for the seeds. |
miter | Mass transfer iteration (Positive for growing particles, negative for shrinking particles). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
dr_level0 | Theoretical distance between particles at the lowest refinement level. |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void corrector | ( | __global int * | imove, |
__global unsigned int * | iset, | ||
__global vec * | r, | ||
__global vec * | u, | ||
__global vec * | dudt, | ||
__global float * | rho, | ||
__global float * | drhodt, | ||
__global vec * | dudt_as1, | ||
__global float * | drhodt_as1, | ||
__global vec * | dudt_as2, | ||
__global float * | drhodt_as2, | ||
__global vec * | dudt_as3, | ||
__global float * | drhodt_as3, | ||
__global vec * | dudt_as4, | ||
__global float * | drhodt_as4, | ||
unsigned int | N, | ||
float | dt, | ||
unsigned int | iter | ||
) |
Improved Euler time integration scheme corrector stage.
imove | Moving flags.
|
iset | Set of particles index. |
r | Position \( \mathbf{r}_{n+1/2} \). |
u | Velocity \( \mathbf{u}_{n+1/2} \). |
dudt | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
rho | Density \( \rho_{n+1/2} \). |
drhodt | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
dudt_as1 | Velocity rate of change of previous step \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n-1/2} \). |
drhodt_as1 | Density rate of change of previous step \( \left. \frac{d \rho}{d t} \right\vert_{n-1/2} \). |
N | Number of particles. |
dt | Time step \( \Delta t \). |
iter | Current iteration. |
__kernel void corrector | ( | __global int * | imove, |
__global unsigned int * | iset, | ||
__global vec * | r, | ||
__global vec * | u, | ||
__global vec * | dudt, | ||
__global float * | rho, | ||
__global float * | drhodt, | ||
__global vec * | dudt_in, | ||
__global float * | drhodt_in, | ||
unsigned int | N, | ||
float | dt | ||
) |
Improved Euler time integration scheme corrector stage.
imove | Moving flags.
|
iset | Set of particles index. |
r | Position \( \mathbf{r}_{n+1/2} \). |
u | Velocity \( \mathbf{u}_{n+1/2} \). |
dudt | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
rho | Density \( \rho_{n+1/2} \). |
drhodt | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
dudt_in | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n-1/2} \). |
drhodt_in | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n-1/2} \). |
N | Number of particles. |
dt | Time step \( \Delta t \). |
__kernel void corrector | ( | __global int * | imove, |
__global unsigned int * | iset, | ||
__global vec * | r, | ||
__global vec * | u, | ||
__global vec * | dudt, | ||
__global float * | rho, | ||
__global float * | drhodt, | ||
unsigned int | N, | ||
float | dt | ||
) |
1st orderv Euler time integration scheme corrector stage
imove | Moving flags.
|
iset | Set of particles index. |
r | Position \( \mathbf{r}_{n+1/2} \). |
u | Velocity \( \mathbf{u}_{n+1/2} \). |
dudt | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
rho | Density \( \rho_{n+1/2} \). |
drhodt | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
N | Number of particles. |
dt | Time step \( \Delta t \). |
__kernel void corrector | ( | const __global int * | imove, |
const __global vec * | dudt_in, | ||
const __global float * | drhodt_in, | ||
__global vec * | dudt, | ||
__global float * | drhodt, | ||
unsigned int | N, | ||
float | subiter_relax | ||
) |
Relax the variation rates modification at the fixed point iterative solution.
imove | Moving flags.
|
dudt_in | Velocity rate of change from the previous subiteration \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
drhodt_in | Density rate of change from the previous subiteration \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
dudt | New velocity rate of change, to be relaxed \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
drhodt | New density rate of change, to be relaxed \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
N | Number of particles. |
__kernel void count | ( | __global const int * | imove, |
__global unsigned int * | ibuffer, | ||
uint | N | ||
) |
Identify the buffer particles.
The buffer particles are signaled with an imove=-255 flag.
imove | Moving flags (imove = -255 for buffer particles). |
ibuffer | 0 if the particle is not a buffer particle, 1 otherwise. |
N | Number of particles. |
__kernel void deltaSPH | ( | const __global unsigned int * | iset, |
const __global int * | imove, | ||
const __global float * | rho, | ||
const __global float * | lap_p, | ||
__global float * | drhodt, | ||
__constant float * | refd, | ||
__constant float * | delta, | ||
unsigned int | N, | ||
float | dt | ||
) |
Density variation rates delta-SPH term.
iset | Set of particles index. |
imove | Moving flags.
|
rho | Density \( \rho_{n+1} \). |
lap_p | Pressure laplacian \( \Delta p \). |
drhodt | Density rate of change \( \frac{d \rho}{d t} \). |
refd | Density of reference of the fluid \( \rho_0 \). |
delta | Diffusive term \( \delta \) multiplier. |
N | Number of particles. |
dt | Time step \( \Delta t \). |
__kernel void entry | ( | __global const int * | imove, |
__global const unsigned int * | ilevel, | ||
__global const vec * | r, | ||
__global unsigned int * | level, | ||
unsigned int | N, | ||
vec | multiresolution_cube_min, | ||
vec | multiresolution_cube_max, | ||
unsigned int | multiresolution_cube_level | ||
) |
Set the refinement level of the particles inside.
imove | Moving flags.
|
ilevel | Current refinement level of the particle. |
r | Position \( \mathbf{r} \). |
level | Target refinement level of the particle. |
N | Number of particles. |
multiresolution_cube_min | Minimum point of the refinement area. |
multiresolution_cube_max | Maximum point of the refinement area. |
multiresolution_cube_level | Refinement level inside the area. |
__kernel void entry | ( | __global const int * | imove, |
__global const unsigned int * | ilevel, | ||
__global const vec * | r, | ||
__global unsigned int * | level, | ||
unsigned int | N, | ||
vec | multiresolution_sphere_center, | ||
float | multiresolution_sphere_radius, | ||
unsigned int | multiresolution_sphere_level | ||
) |
Set the refinement level of the particles inside.
imove | Moving flags.
|
ilevel | Current refinement level of the particle. |
r | Position \( \mathbf{r} \). |
level | Target refinement level of the particle. |
N | Number of particles. |
multiresolution_sphere_center | Center of the refinement area. |
multiresolution_sphere_radius | Radius of the refinement area. |
multiresolution_sphere_level | Refinement level inside the area. |
__kernel void entry | ( | __global float * | rho_in, |
uint | N, | ||
float | rho_min, | ||
float | rho_max | ||
) |
Clamp the density.
In some situations it can be convenient to define a minimum or maximum density values in order to avoid that a crazy particle may cause the simulation blow up. Use this tool only if you know exactly what you are doing
rho_in | Density \( \rho_{n+1/2} \). |
N | Number of particles. |
rho_min | Minimum tolerated density value \( \rho_{min} \). |
rho_max | Maximum tolerated density value \( \rho_{max} \). |
__kernel void entry | ( | __global int * | imove, |
__global const int * | miter, | ||
__global vec * | r, | ||
vec | domain_max, | ||
unsigned int | N | ||
) |
Set the mass of the particles according to their gamma value.
When a particle is split in a set of daughter particles, in order to avoid shocks, its effect is smoothly transfered to the daughters, using for that a \( \gamma_m \) mass multiplier.
imove | Moving flags.
|
miter | Mass transfer iteration (Positive for growing particles, negative for shrinking particles). |
r | Position \( \mathbf{r} \). |
domain_max | Maximum point of the computational domain. |
N | Number of particles. |
__kernel void entry | ( | __global int * | imove, |
__global vec * | r, | ||
__global vec * | u, | ||
__global vec * | dudt, | ||
__global float * | m, | ||
uint | N, | ||
vec | domain_min, | ||
vec | domain_max | ||
) |
Check and destroy the particles out of the domain.
Usually is a good methodology to impose a computational domain, such that a single lost particle will not cause the simulation blow up. Since the particles out of the domain will take 0 mass, you can control how many particles are lost controlling the total mass
imove | Moving flags.
|
r | Position \( \mathbf{r} \). |
u | Velocity \( \mathbf{u} \). |
dudt | Velocity rate of change \( \frac{d \mathbf{u}}{d t} \). |
m | Mass \( m \). |
N | Number of particles. |
domain_min | Minimum point of the domain. |
domain_max | Maximum point of the domain. |
__kernel void entry | ( | __global uint * | id, |
__global uint * | id_inverse, | ||
unsigned int | N | ||
) |
Compute the permutations to move from the sorted indexes space to the unsorted one.
id | Original index of each particle (sort -> unsort space) |
id_inverse | Sorted index of each particle (unsort -> sort space) |
N | Number of particles. |
__kernel void entry | ( | __global unsigned int * | iset, |
__global int * | imove, | ||
__global float * | rho, | ||
__global float * | p, | ||
__constant float * | refd, | ||
unsigned int | N, | ||
float | cs, | ||
float | p0 | ||
) |
Stiffness Equation Of State (EOS) computation.
The equation of state relates the pressure and the density fields, \( p = p_0 + c_s^2 \left(\rho - \rho_0 \right) \)
iset | Set of particles index. |
imove | Moving flags.
|
rho | Density \( \rho_{n+1/2} \). |
p | Pressure \( p_{n+1/2} \). |
refd | Density of reference of the fluid \( \rho_0 \). |
N | Number of particles. |
cs | Speed of sound \( c_s \). |
p0 | Background pressure \( p_0 \). |
__kernel void entry | ( | const __global float * | h_var_in, |
__global float * | h_var, | ||
const __global unit * | id_sorted, | ||
unsigned int | N | ||
) |
Sort all the particle variables by the cell indexes.
Due to the large number of registers consumed (21 global memory arrays are loaded), it is safer carrying out the sorting process in to stages. This is the first stage.
h_var_in | Unsorted variable kernel lenght \( h \). |
h_var | Sorted variable kernel lenght \( h \). |
id_sorted | Permutations list from the unsorted space to the sorted one. |
N | Number of particles. |
__kernel void entry | ( | const __global float * | m0_in, |
__global float * | m0, | ||
const __global int * | miter_in, | ||
__global int * | miter, | ||
const __global uint * | ilevel_in, | ||
__global uint * | ilevel, | ||
const __global uint * | level_in, | ||
__global uint * | level, | ||
const __global unit * | id_sorted, | ||
unsigned int | N | ||
) |
Sort the multiresolution involved particle properties.
m0_in | Unsorted original mass \( m_0 \). |
m0 | Sorted original mass \( m_0 \). |
miter_in | Unsorted iteration of the mass transfer. |
miter | Mass transfer iteration (Positive for shrinking particles, negative for growing particles). |
ilevel_in | Unsorted particle refinement level. |
ilevel | Sorted particle refinement level. |
level_in | Unsorted target refinement level. |
level | Sorted target refinement level. |
id_sorted | Permutations list from the unsorted space to the sorted one. |
N | Number of particles. |
__kernel void entry | ( | const __global int * | imove, |
__global uint * | n_neighs, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | neighs_limit, | ||
uint | N, | ||
uivec4 | n_cells | ||
) |
Number of neighbours of each particle.
One of the main targets of this kernel is checking that the number of neighbours is not excessively large. Along this line, if #neighs_limit neighbours are reached, the kernel will stop the execution.
imove | Moving flags.
|
r | Position \( \mathbf{r} \). |
n_neighs | Number of neighbours per particle. |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
neighs_limit | The largest number of neighbours accepted. |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void entry | ( | const __global int * | imove, |
const __global int * | imirrored, | ||
const __global vec * | r, | ||
const __global float * | rho, | ||
const __global float * | m, | ||
__global float * | shepard, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | N, | ||
uivec4 | n_cells | ||
) |
Shepard factor computation, due to the particles at the other portal side.
\[ \gamma(\mathbf{x}) = \int_{\Omega} W(\mathbf{y} - \mathbf{x}) \mathrm{d}\mathbf{x} \]
The shepard renormalization factor is applied for several purposes:
In the shepard factor computation the fluid extension particles are not taken into account.
imove | Moving flags.
|
imirrored | 0 if the particle has not been mirrored, 1 otherwise. |
r | Position \( \mathbf{r} \). |
rho | Density \( \rho \). |
m | Mass \( m \). |
shepard | Shepard term \( \gamma(\mathbf{x}) = \int_{\Omega} W(\mathbf{y} - \mathbf{x}) \mathrm{d}\mathbf{x} \). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void entry | ( | const __global int * | imove, |
const __global int * | imirrored, | ||
const __global vec * | r, | ||
const __global float * | rho, | ||
const __global float * | m, | ||
__global matrix * | mls, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | N, | ||
uivec4 | n_cells, | ||
uint | mls_imove | ||
) |
Compute the MLS transformation matrix inverse, \( L_i^{-1} \), due to the particles at the other portal side.
Such transformation matrix can be multiplied by the kernel gradient to produce a new kernel gradient, \( \nabla W^{L}_{ij} = L_i \cdot \nabla W_{ij} \), such that the lienar fields differential operators are consistently computed.
imove | Moving flags.
|
imirrored | 0 if the particle has not been mirrored, 1 otherwise. |
r | Position \( \mathbf{r} \). |
rho | Density \( \rho \). |
m | Mass \( m \). |
mls | Kernel MLS transformation matrix \( L \). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
mls_imove | Type of particles affected |
__kernel void entry | ( | const __global int * | imove, |
const __global int * | imirrored, | ||
const __global vec * | r, | ||
const __global float * | rho, | ||
const __global float * | m, | ||
const __global float * | h_var, | ||
__global float * | shepard, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | N, | ||
uivec4 | n_cells | ||
) |
Shepard factor computation, due to the particles at the other portal side.
\[ \gamma(\mathbf{x}) = \int_{\Omega} W(\mathbf{y} - \mathbf{x}) \mathrm{d}\mathbf{x} \]
The shepard renormalization factor is applied for several purposes:
In the shepard factor computation the fluid extension particles are not taken into account.
imove | Moving flags.
|
imirrored | 0 if the particle has not been mirrored, 1 otherwise. |
r | Position \( \mathbf{r} \). |
rho | Density \( \rho \). |
m | Mass \( m \). |
h_var | variable kernel lenght \( h \). |
shepard | Shepard term \( \gamma(\mathbf{x}) = \int_{\Omega} W(\mathbf{y} - \mathbf{x}) \mathrm{d}\mathbf{x} \). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void entry | ( | const __global int * | imove, |
const __global matrix * | S, | ||
const __global matrix * | dSdt, | ||
__global matrix * | S_in, | ||
__global matrix * | dSdt_in, | ||
unsigned int | N, | ||
float | dt | ||
) |
Improved Euler time integration scheme predictor stage.
Time integration is based in the following quasi-second order Predictor-Corrector integration scheme:
\( S_{n+1} = S_{n} + \Delta t \left. \frac{\mathrm{d}S}{\mathrm{d}t} \right\vert_{n+1/2} + \frac{\Delta t}{2} \left( \left. \frac{\mathrm{d}S}{\mathrm{d}t} \right\vert_{n + 1/2} - \left. \frac{\mathrm{d}S}{\mathrm{d}t} \right\vert_{n - 1/2} \right) \)
imove | Moving flags.
|
S | Deviatory stress \( S_{n+1} \). |
dSdt | Deviatory stress rate of change \( \left. \frac{d S}{d t} \right\vert_{n+1} \). |
S_in | Deviatory stress \( S_{n+1/2} \). |
dSdt_in | Deviatory stress rate of change \( \left. \frac{d S}{d t} \right\vert_{n+1/2} \). |
N | Number of particles. |
dt | Time step \( \Delta t \). |
__kernel void entry | ( | const __global int * | imove, |
const __global vec * | r, | ||
const __global float * | rho, | ||
const __global float * | m, | ||
__global float * | shepard, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | N, | ||
uivec4 | n_cells | ||
) |
Shepard factor computation.
\[ \gamma(\mathbf{x}) = \int_{\Omega} W(\mathbf{y} - \mathbf{x}) \mathrm{d}\mathbf{y} \]
The shepard renormalization factor is applied for several purposes:
In the shepard factor computation the fluid extension particles are not taken into account.
imove | Moving flags.
|
r | Position \( \mathbf{r} \). |
rho | Density \( \rho \). |
m | Mass \( m \). |
shepard | Shepard term \( \gamma(\mathbf{x}) = \int_{\Omega} W(\mathbf{y} - \mathbf{x}) \mathrm{d}\mathbf{y} \). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void entry | ( | const __global int * | imove, |
const __global vec * | r, | ||
const __global float * | rho, | ||
const __global float * | m, | ||
__global matrix * | mls, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | N, | ||
uivec4 | n_cells, | ||
uint | mls_imove | ||
) |
Compute the MLS transformation matrix inverse, \( L_i^{-1} \).
Such transformation matrix can be multiplied by the kernel gradient to produce a new kernel gradient, \( \nabla W^{L}_{ij} = L_i \cdot \nabla W_{ij} \), such that the lienar fields differential operators are consistently computed.
imove | Moving flags.
|
r | Position \( \mathbf{r}_{n+1} \). |
rho | Density \( \rho \). |
m | Mass \( m \). |
mls | Kernel MLS transformation matrix \( L \). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
mls_imove | Type of particles affected |
__kernel void entry | ( | const __global int * | imove, |
const __global vec * | r, | ||
const __global float * | rho, | ||
const __global float * | m, | ||
const __global float * | h_var, | ||
__global float * | shepard, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | N, | ||
uivec4 | n_cells | ||
) |
Shepard factor computation.
\[ \gamma(\mathbf{x}) = \int_{\Omega} W(\mathbf{y} - \mathbf{x}) \mathrm{d}\mathbf{x} \]
The shepard renormalization factor is applied for several purposes:
In the shepard factor computation the fluid extension particles are not taken into account.
imove | Moving flags.
|
r | Position \( \mathbf{r} \). |
rho | Density \( \rho \). |
m | Mass \( m \). |
h_var | variable kernel lenght \( h \). |
shepard | Shepard term \( \gamma(\mathbf{x}) = \int_{\Omega} W(\mathbf{y} - \mathbf{x}) \mathrm{d}\mathbf{x} \). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void entry | ( | const __global vec * | normal, |
__global vec * | tangent, | ||
__global vec * | binormal, | ||
unsigned int | N | ||
) |
Compute the tanget vector in 2D simulations, and the binormal vector in 3D simulations.
normal | Normal vector \( \mathbf{n} \). |
tangent | Tangent vector \( \mathbf{t} \). |
binormal | Binormal vector \( \mathbf{t} \). |
N | Number of particles. |
__kernel void fields | ( | __global const unsigned int * | iset, |
__global const uint * | isplit, | ||
__global const uint * | mybuffer, | ||
__global const unsigned int * | ilevel, | ||
__global const float * | split_weight, | ||
__global float * | m0, | ||
__global float * | m, | ||
__global vec * | r, | ||
__global vec * | u, | ||
__global vec * | dudt, | ||
__global float * | rho, | ||
__global float * | drhodt, | ||
__global const uint * | icell, | ||
__global const uint * | ihoc, | ||
__constant float * | dr_level0, | ||
unsigned int | N, | ||
uivec4 | n_cells | ||
) |
Collect the children, and the seed itself, in order to compute the field values of the buffer partner particle.
Since each children may contribute to several partners, we are weighting their field values.
isplit | 0 if the particle should not become coalesced, 1 for the coalescing particles, 2 for the seeds. |
split_weight | Coalescing contribution weight. |
m0 | Target mass, \( m_0 \). |
m | Current mass, \( m \). |
r | Position \( \mathbf{r} \). |
u | Velocity \( \mathbf{u} \). |
dudt | Velocity rate of change \( \frac{d \mathbf{u}}{d t} \). |
rho | Density \( \rho \). |
drhodt | Density rate of change \( \frac{d \rho}{d t} \). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void full | ( | const __global int * | imove, |
const __global vec * | r, | ||
const __global float * | rho, | ||
const __global float * | m, | ||
const __global float * | p, | ||
__global vec * | lap_p_corr, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | N, | ||
uivec4 | n_cells | ||
) |
MLS based correction term.
The term computed with this function should be later renormalized by MLS, using full_mls() function. Before calling such function the user must be sure that both lap_p_corr and mls have been computed (taking into account, for instance, the BCs)
imove | Moving flags.
|
r | Position \( \mathbf{r} \). |
rho | Density \( \rho \). |
m | Mass \( m \). |
p | Pressure \( p \). |
lap_p_corr | Correction term for the Morris Laplacian formula. |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void full_mls | ( | const __global int * | imove, |
const __global matrix * | mls, | ||
__global vec * | lap_p_corr, | ||
uint | N | ||
) |
MLS based correction term.
Here the MLS renormalization is applied to the correction term
imove | Moving flags.
|
r | Position \( \mathbf{r} \). |
mls | Kernel MLS transformation matrix \( L \). |
lap_p_corr | Correction term for the Morris Laplacian formula. |
N | Number of particles. |
__kernel void generate | ( | __global int * | imove, |
__global int * | iset, | ||
__global const unsigned int * | isplit, | ||
__global unsigned int * | split_invperm, | ||
__global unsigned int * | ilevel, | ||
__global unsigned int * | level, | ||
__global int * | miter, | ||
__global uint * | mybuffer, | ||
unsigned int | N, | ||
unsigned int | nbuffer | ||
) |
Associate a buffer particle to a seed.
Later we are looking for the rest of children, used to compute the variable values of this buffer/partner particle
imove | Moving flags.
|
iset | Index of the set of particles. |
isplit | 0 if the particle should not become coalesced, 1 for the coalescing particles, 2 for the seeds. |
split_invperm | Permutation to find the index of the particle in the list of particles to become split. |
mybuffer | Index of the partner buffer particle. |
ilevel | Current refinement level of the particle. |
level | Target refinement level of the particle. |
miter | Mass transfer iteration (Positive for growing particles, negative for shrinking particles). |
mybuffer | Partner particle associated to the seed |
N | Number of particles. |
nbuffer | Number of available buffer particles. |
__kernel void generate | ( | __global int * | imove, |
__global int * | iset, | ||
__global unsigned int * | isplit, | ||
__global unsigned int * | split_invperm, | ||
__global unsigned int * | ilevel, | ||
__global unsigned int * | level, | ||
__global float * | m0, | ||
__global int * | miter, | ||
__global float * | m, | ||
__global vec * | r, | ||
__global vec * | u, | ||
__global vec * | dudt, | ||
__global float * | rho, | ||
__global float * | drhodt, | ||
unsigned int | N, | ||
unsigned int | nbuffer | ||
) |
Split a particle in a set of daughter particles.
The daughter particles will be a duplicate of the mother split particle, but conveniently modifying the position and the mass (m0 and gamma_m).
imove | Moving flags.
|
iset | Index of the set of particles. |
isplit | 0 if the particle should not become split, 1 otherwise. |
split_invperm | Permutation to find the index of the particle in the list of particles to become split. |
ilevel | Current refinement level of the particle. |
level | Target refinement level of the particle. |
m0 | Target mass, \( m_0 \). |
miter | Mass transfer iteration (Positive for growing particles, negative for shrinking particles). |
m | Current mass, \( m \). |
r | Position \( \mathbf{r} \). |
u | Velocity \( \mathbf{u} \). |
dudt | Velocity rate of change \( \frac{d \mathbf{u}}{d t} \). |
rho | Density \( \rho \). |
drhodt | Density rate of change \( \frac{d \rho}{d t} \). |
N | Number of particles. |
nbuffer | Number of available buffer particles. |
__kernel void integrate | ( | const __global int * | imove, |
const __global vec * | r_in, | ||
const __global vec * | u_0, | ||
const __global vec * | dudt, | ||
const __global float * | rho_0, | ||
const __global float * | drhodt, | ||
__global vec * | r, | ||
__global vec * | u, | ||
__global float * | rho, | ||
unsigned int | N, | ||
float | dt | ||
) |
Integrate the system to the next time step, when the implicit subiterator already finished his job.
imove | Moving flags.
|
r_in | Position \( \mathbf{r}_{n} \). |
u_0 | Velocity \( \mathbf{u}_{n} \). |
dudt | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
rho_0 | Density \( \rho_{n} \). |
drhodt | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
r | Position \( \mathbf{r}_{n+1} \). |
u | Velocity \( \mathbf{u}_{n+1} \). |
rho | Density \( \rho_{n+1} \). |
N | Number of particles. |
dt | Time step \( \Delta t \). |
__kernel void lapp | ( | const __global int * | imove, |
const __global vec * | r, | ||
const __global float * | rho, | ||
const __global float * | m, | ||
const __global float * | p, | ||
__global float * | lap_p, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | N, | ||
uivec4 | n_cells | ||
) |
Laplacian of the pressure computation.
imove | Moving flags.
|
r | Position \( \mathbf{r} \). |
rho | Density \( \rho \). |
m | Mass \( m \). |
p | Pressure \( p \). |
lap_p | Pressure laplacian \( \Delta p \). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void lapp | ( | const __global int * | imove, |
const __global vec * | r, | ||
const __global float * | rho, | ||
const __global float * | m, | ||
const __global float * | p, | ||
const __global float * | h_var, | ||
__global float * | lap_p, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | N, | ||
uivec4 | n_cells | ||
) |
Laplacian of the pressure computation.
imove | Moving flags.
|
r | Position \( \mathbf{r} \). |
rho | Density \( \rho \). |
m | Mass \( m \). |
p | Pressure \( p \). |
h_var | variable kernel lenght \( h \). |
lap_p | Pressure laplacian \( \Delta p \). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void lapp_corr | ( | const __global int * | imove, |
const __global vec * | r, | ||
const __global float * | rho, | ||
const __global float * | m, | ||
const __global vec * | lap_p_corr, | ||
__global float * | lap_p, | ||
const __global uint * | icell, | ||
const __global uint * | ihoc, | ||
uint | N, | ||
uivec4 | n_cells | ||
) |
Laplacian of the pressure correction.
imove | Moving flags.
|
r | Position \( \mathbf{r} \). |
rho | Density \( \rho \). |
m | Mass \( m \). |
p | Pressure \( p \). |
lap_p_corr | Correction term for the Morris Laplacian formula. |
lap_p | Pressure laplacian \( \Delta p \). |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void mls_inv | ( | const __global int * | imove, |
__global matrix * | mls, | ||
uint | N, | ||
uint | mls_imove | ||
) |
Invert the matrix computed in entry() to get the final MLS transformation matrix, \( L_i \).
Such transformation matrix can be multiplied by the kernel gradient to produce a new kernel gradient, \( \nabla W^{L}_{ij} = L_i \cdot \nabla W_{ij} \), such that the lienar fields differential operators are consistently computed.
imove | Moving flags.
|
mls | Kernel MLS transformation matrix \( L \). |
N | Number of particles. |
mls_imove | Type of particles affected |
__kernel void postcorrector | ( | const __global vec * | dudt_as1, |
const __global float * | drhodt_as1, | ||
const __global vec * | dudt_as2, | ||
const __global float * | drhodt_as2, | ||
const __global vec * | dudt_as3, | ||
const __global float * | drhodt_as3, | ||
const __global vec * | dudt, | ||
const __global float * | drhodt, | ||
__global vec * | dudt_as1_in, | ||
__global float * | drhodt_as1_in, | ||
__global vec * | dudt_as2_in, | ||
__global float * | drhodt_as2_in, | ||
__global vec * | dudt_as3_in, | ||
__global float * | drhodt_as3_in, | ||
__global vec * | dudt_as4_in, | ||
__global float * | drhodt_as4_in, | ||
unsigned int | N | ||
) |
Backup de data for the sorting algorithm.
dudt_as1 | Velocity rate of change of previous step \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n-1/2} \). |
drhodt_as1 | Density rate of change of previous step \( \left. \frac{d \rho}{d t} \right\vert_{n-1/2} \). |
dudt_as2 | Velocity rate of change of 2 steps ago \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n-1/2} \). |
drhodt_as2 | Density rate of change of 2 steps ago \( \left. \frac{d \rho}{d t} \right\vert_{n-1/2} \). |
dudt_as3 | Velocity rate of change of 3 steps ago \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n-1/2} \). |
drhodt_as3 | Density rate of change of 3 steps ago \( \left. \frac{d \rho}{d t} \right\vert_{n-1/2} \). |
dudt | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
drhodt | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
dudt_as1_in | Velocity rate of change of previous step \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n-1/2} \). |
drhodt_as1_in | Density rate of change of previous step \( \left. \frac{d \rho}{d t} \right\vert_{n-1/2} \). |
dudt_as2_in | Velocity rate of change of 2 steps ago \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n-1/2} \). |
drhodt_as2_in | Density rate of change of 2 steps ago \( \left. \frac{d \rho}{d t} \right\vert_{n-1/2} \). |
dudt_as3_in | Velocity rate of change of 3 steps ago \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n-1/2} \). |
drhodt_as3_in | Density rate of change of 3 steps ago \( \left. \frac{d \rho}{d t} \right\vert_{n-1/2} \). |
dudt_as4_in | Velocity rate of change of 4 steps ago \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n-1/2} \). |
drhodt_as4_in | Density rate of change of 4 steps ago \( \left. \frac{d \rho}{d t} \right\vert_{n-1/2} \). |
N | Number of particles. |
__kernel void predictor | ( | __global int * | imove, |
__global vec * | r, | ||
__global vec * | u, | ||
__global vec * | dudt, | ||
__global float * | rho, | ||
__global float * | drhodt, | ||
__global vec * | r_in, | ||
__global vec * | u_in, | ||
__global vec * | dudt_in, | ||
__global float * | rho_in, | ||
__global float * | drhodt_in, | ||
unsigned int | N, | ||
float | dt | ||
) |
Improved Euler time integration scheme predictor stage.
imove | Moving flags.
|
r | Position \( \mathbf{r}_{n+1} \). |
u | Velocity \( \mathbf{u}_{n+1} \). |
dudt | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1} \). |
rho | Density \( \rho_{n+1} \). |
drhodt | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n+1} \). |
r_in | Position \( \mathbf{r}_{n+1/2} \). |
u_in | Velocity \( \mathbf{u}_{n+1/2} \). |
dudt_in | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
rho_in | Density \( \rho_{n+1/2} \). |
drhodt_in | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
N | Number of particles. |
dt | Time step \( \Delta t \). |
__kernel void predictor | ( | __global vec * | r, |
__global vec * | u, | ||
__global vec * | dudt, | ||
__global float * | rho, | ||
__global float * | drhodt, | ||
__global vec * | r_in, | ||
__global vec * | u_in, | ||
__global vec * | dudt_in, | ||
__global float * | rho_in, | ||
__global float * | drhodt_in, | ||
unsigned int | N | ||
) |
Adams-Bashforth time integration scheme predictor stage.
1st order Euler time integration scheme predictor stage
imove | Moving flags.
|
r | Position \( \mathbf{r}_{n+1} \). |
u | Velocity \( \mathbf{u}_{n+1} \). |
dudt | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1} \). |
rho | Density \( \rho_{n+1} \). |
drhodt | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n+1} \). |
r_in | Position \( \mathbf{r}_{n+1/2} \). |
u_in | Velocity \( \mathbf{u}_{n+1/2} \). |
dudt_in | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
rho_in | Density \( \rho_{n+1/2} \). |
drhodt_in | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
N | Number of particles. |
__kernel void predictor | ( | const __global int * | imove, |
const __global vec * | r, | ||
const __global vec * | u_0, | ||
const __global vec * | dudt, | ||
const __global float * | rho_0, | ||
const __global float * | drhodt, | ||
__global vec * | r_in, | ||
__global vec * | u_in, | ||
__global vec * | dudt_in, | ||
__global float * | rho_in, | ||
__global float * | drhodt_in, | ||
unsigned int | N, | ||
float | dt | ||
) |
Implicit Midpoint Euler time integration scheme predictor stage.
imove | Moving flags.
|
r | Position \( \mathbf{r}_{n} \). |
u_0 | Velocity \( \mathbf{u}_{n} \). |
dudt | Velocity rate of change \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
rho_0 | Density \( \rho_{n} \). |
drhodt | Density rate of change \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
r_in | Position backup \( \mathbf{r}_{n} \). |
u_in | Midpoint velocity \( \mathbf{u}_{n+1/2} \). |
dudt_in | Velocity rate of change backup \( \left. \frac{d \mathbf{u}}{d t} \right\vert_{n+1/2} \). |
rho_in | Midpoint density \( \rho_{n+1/2} \). |
drhodt_in | Density rate of change backup \( \left. \frac{d \rho}{d t} \right\vert_{n+1/2} \). |
N | Number of particles. |
dt | Time step \( \Delta t \). |
__kernel void seed_candidates | ( | __global const unsigned int * | iset, |
__global const int * | imove, | ||
__global const unsigned int * | ilevel, | ||
__global const unsigned int * | level, | ||
__global const float * | m0, | ||
__global int * | miter, | ||
__global const vec * | r, | ||
__global unsigned int * | isplit, | ||
__global ivec * | split_cell, | ||
__global float * | split_dist, | ||
__constant float * | dr_level0, | ||
unsigned int | N | ||
) |
Look for all the seed candidates, i.e. all the particles which have a refinement level target lower than their current value.
This tool is also placing the particles into cells with the volume of the partner particle to become generated
iset | Set of particles index. |
imove | Moving flags.
|
ilevel | Current refinement level of the particle. |
level | Target refinement level of the particle. |
m0 | Mass \( m_0 \). |
miter | Mass transfer iteration (Positive for growing particles, negative for shrinking particles). |
r | Position \( \mathbf{r} \). |
isplit | 0 if the particle should not become coalesced, 1 for the coalescing particles, 2 for the seeds. |
split_cell | Seed cell where the particle is located. |
split_dist | Distance to the center of the cell. Just the closest particle to the cell center will be kept as seed |
dr_level0 | Theoretical distance between particles at the lowest refinement level. |
N | Number of particles. |
__kernel void seeds | ( | __global const unsigned int * | iset, |
__global const unsigned int * | isplit_in, | ||
__global unsigned int * | isplit, | ||
__global int * | miter, | ||
__global const ivec * | split_cell, | ||
__global const float * | split_dist, | ||
__global const uint * | icell, | ||
__global const uint * | ihoc, | ||
unsigned int | N, | ||
uivec4 | n_cells | ||
) |
Get only one seed per cell.
To do that, all the seed candidates will inspect their neighbours, and in case they find another seed candidate closer to the cell center, they are desisting to become a seed.
iset | Set of particles index. |
isplit_in | 0 if the particle should not become coalesced, 1 for the coalescing particles, 2 for the seeds. This array is used to read. |
isplit | 0 if the particle should not become coalesced, 1 for the coalescing particles, 2 for the seeds. This array is used to write. |
miter | Mass transfer iteration (Positive for growing particles, negative for shrinking particles). |
split_cell | Seed cell where the particle is located. |
split_dist | Distance to the center of the cell. Just the closest particle to the cell center will be kept as seed |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
N | Number of particles. |
n_cells | Number of cells in each direction |
__kernel void set_imove | ( | __global int * | imove, |
uint | N | ||
) |
Replace the particles with the imove flag imove=-256 by imove=-255.
The particles with imove=-256 are "invalid particles", i.e. particles which has been removed (e.g. particles out of the computational domain), while imove=-255 are buffer particles.
In that way, the removed particles in a time step are not taken into account as buffer particles until they are sorted at the next time step.
imove | Moving flags (imove = -255 for buffer particles). |
ibuffer | 0 if the particle is not a buffer particle, 1 otherwise. |
N | Number of particles. |
__kernel void set_isplit_in | ( | __global const unsigned int * | isplit, |
__global unsigned int * | isplit_in, | ||
unsigned int | N | ||
) |
Create a copy of isplit, where everything is 0 except the seeds, which take the value 1. Such array can be used to count the number of new particles to become generated.
Create a copy of isplit, where the data "out of bounds" is set to 0, instead of 2. Such array can be used to count the number of new particles to become generated.
Since isplit is used to sort the particles, it should have "n_radix" items, which is bigger than "N". But in order to conveniently sort isplit, you must ensure that the values "out of bounds" are bigger than the other ones (and therefore kept at the end of the list). in this case a value of 3 is selected.
isplit | 0 if the particle should not become split, 1 otherwise |
isplit_in | 0 if the particle should not become split, 1 otherwise |
N | Number of particles. |
Since isplit is used to sort the particles, it should have "n_radix" items, which is bigger than "N". But in order to conveniently sort isplit, you must ensure that the values "out of bounds" are bigger than the other ones (and therefore kept at the end of the list). in this case a value of 2 is selected.
isplit | 0 if the particle should not become split, 1 otherwise |
isplit_in | 0 if the particle should not become split, 1 otherwise |
N | Number of particles. |
__kernel void set_mass | ( | __global const int * | imove, |
__global const float * | m0, | ||
__global int * | miter, | ||
__global float * | m, | ||
unsigned int | N | ||
) |
Set the mass of the particles according to their gamma value.
When a particle is split in a set of daughter particles, in order to avoid shocks, its effect is smoothly transfered to the daughters, using for that a \( \gamma_m \) mass multiplier.
imove | Moving flags.
|
m0 | Target mass, \( m_0 \). When a particle is split/coalesced, its mass is progressively transfered to its children. |
miter | Mass transfer iteration (Positive for growing particles, negative for shrinking particles). |
m | Current mass \( m \). |
N | Number of particles. |
__kernel void simple | ( | const __global unsigned int * | iset, |
const __global int * | imove, | ||
__global vec * | lap_p_corr, | ||
__constant float * | refd, | ||
unsigned int | N, | ||
vec | g | ||
) |
Simple hidrostatic based correction term.
iset | Set of particles index. |
imove | Moving flags.
|
lap_p_corr | Correction term for the Morris Laplacian formula. |
refd | Density of reference of the fluid \( \rho_0 \). |
N | Number of particles. |
g | Gravity acceleration \( \mathbf{g} \). |
__kernel void sort | ( | const __global float * | rho_0_in, |
__global float * | rho_0, | ||
const __global vec * | u_0_in, | ||
__global vec * | u_0, | ||
const __global unit * | id_sorted, | ||
unsigned int | N | ||
) |
Implicit Midpoint Euler time integration scheme variables sorting.
u_0 | Sorted velocity \( \mathbf{u}_{n} \). |
rho_0 | Sorted density \( \rho_{n} \). |
u_0_in | Unsorted velocity \( \mathbf{u}_{n} \). |
rho_0_in | Unsorted density \( \rho_{n+1/2} \). |
id_sorted | Permutations list from the unsorted space to the sorted one. |
N | Number of particles. |
__kernel void sort | ( | const __global vec * | dudt_as1_in, |
__global vec * | dudt_as1, | ||
const __global vec * | dudt_as2_in, | ||
__global vec * | dudt_as2, | ||
const __global vec * | dudt_as3_in, | ||
__global vec * | dudt_as3, | ||
const __global vec * | dudt_as4_in, | ||
__global vec * | dudt_as4, | ||
const __global float * | drhodt_as1_in, | ||
__global float * | drhodt_as1, | ||
const __global float * | drhodt_as2_in, | ||
__global float * | drhodt_as2, | ||
const __global float * | drhodt_as3_in, | ||
__global float * | drhodt_as3, | ||
const __global float * | drhodt_as4_in, | ||
__global float * | drhodt_as4, | ||
const __global unit * | id_sorted, | ||
unsigned int | N | ||
) |
Sort the stored Adams-Bashforth stored variation rates.
id_in | Unsorted particle indexes |
id | Sorted particle indexes |
iset_in | Unsorted set of particles indexes. |
iset | Sorted set of particles indexes. |
imove_in | Unsorted moving flags.
|
imove | Sorted moving flags.
|
r_in | Unsorted position \( \mathbf{r} \). |
r | Sorted position \( \mathbf{r} \). |
normal_in | Unsorted normal \( \mathbf{n} \). |
normal | Sorted normal \( \mathbf{n} \). |
u_in | Unsorted velocity \( \mathbf{u} \). |
u | Sorted velocity \( \mathbf{u} \). |
id_sorted | Permutations list from the unsorted space to the sorted one. |
N | Number of particles. |
__kernel void stage1 | ( | const __global uint * | id_in, |
__global uint * | id, | ||
const __global uint * | iset_in, | ||
__global uint * | iset, | ||
const __global int * | imove_in, | ||
__global int * | imove, | ||
const __global vec * | r_in, | ||
__global vec * | r, | ||
const __global vec * | normal_in, | ||
__global vec * | normal, | ||
const __global vec * | tangent_in, | ||
__global vec * | tangent, | ||
const __global unit * | id_sorted, | ||
unsigned int | N | ||
) |
Sort all the particle variables by the cell indexes.
Due to the large number of registers consumed (21 global memory arrays are loaded), it is safer carrying out the sorting process in to stages. This is the first stage.
id_in | Unsorted particle indexes |
id | Sorted particle indexes |
iset_in | Unsorted set of particles indexes. |
iset | Sorted set of particles indexes. |
imove_in | Unsorted moving flags.
|
imove | Sorted moving flags.
|
r_in | Unsorted position \( \mathbf{r} \). |
r | Sorted position \( \mathbf{r} \). |
normal_in | Unsorted normal \( \mathbf{n} \). |
normal | Sorted normal \( \mathbf{n} \). |
tangent_in | Unsorted tangent \( \mathbf{t} \). |
tangent | Sorted tangent \( \mathbf{t} \). |
id_sorted | Permutations list from the unsorted space to the sorted one. |
N | Number of particles. |
__kernel void stage2 | ( | const __global float * | rho_in, |
__global float * | rho, | ||
const __global float * | m_in, | ||
__global float * | m, | ||
const __global vec * | u_in, | ||
__global vec * | u, | ||
const __global vec * | dudt, | ||
__global vec * | dudt_in, | ||
const __global float * | drhodt, | ||
__global float * | drhodt_in, | ||
const __global unit * | id_sorted, | ||
unsigned int | N | ||
) |
Sort all the particle variables by the cell indexes.
Due to the large number of registers consumed (21 global memory arrays are loaded), it is safer carrying out the sorting process in to stages. This is the first stage.
rho_in | Unsorted density \( \rho \). |
rho | Sorted density \( \rho \). |
m_in | Unsorted mass \( m \). |
m | Sorted mass \( m \). |
u_in | Unsorted velocity \( \mathbf{u} \). |
u | Sorted velocity \( \mathbf{u} \). |
dudt | Unsorted velocity rate of change \( \frac{d \mathbf{u}}{d t} \). |
dudt_in | Sorted velocity rate of change \( \frac{d \mathbf{u}}{d t} \). |
drhodt | Unsorted density rate of change \( \frac{d \rho}{d t} \). |
drhodt_in | Sorted density rate of change \( \frac{d \rho}{d t} \). |
id_sorted | Permutations list from the unsorted space to the sorted one. |
N | Number of particles. |
__kernel void weights | ( | __global const unsigned int * | iset, |
__global const unsigned int * | ilevel, | ||
__global const vec * | r, | ||
__global const unsigned int * | isplit, | ||
__global float * | split_weight, | ||
__global const uint * | icell, | ||
__global const uint * | ihoc, | ||
__constant float * | dr_level0, | ||
unsigned int | N, | ||
uivec4 | n_cells | ||
) |
Compute the contribution weight of each children particle.
The children particles (including the seed itself) may be close enough to several partner particles, such that, at the time of computing the partner particles properties, it is eventually contributing to several partners. Hence, the contributions should be conveniently weighted
iset | Set of particles index. |
ilevel | Current refinement level of the particle. |
r | Position \( \mathbf{r} \). |
isplit | 0 if the particle should not become coalesced, 1 for the coalescing particles, 2 for the seeds. |
split_weight | Coalescing contribution weight. |
icell | Cell where each particle is located. |
ihoc | Head of chain for each cell (first particle found). |
dr_level0 | Theoretical distance between particles at the lowest refinement level. |
N | Number of particles. |
n_cells | Number of cells in each direction |