27#ifndef EXCLUDED_PARTICLE
35 #define EXCLUDED_PARTICLE(index) imove[index] <= 0
38#if defined(LOCAL_MEM_SIZE) && defined(NO_LOCAL_MEM)
39 #error NO_LOCAL_MEM has been set.
57__kernel
void simple(
const __global
unsigned int* iset,
58 const __global
int* imove,
59 __global
vec* lap_p_corr,
60 __constant
float* refd,
64 const usize i = get_global_id(0);
70 lap_p_corr[i] = refd[iset[i]] * g;
94__kernel
void full(
const __global
int* imove,
95 const __global
vec* r,
96 const __global
float* rho,
97 const __global
float* m,
98 const __global
float* p,
99 __global
vec* lap_p_corr,
103 const usize i = get_global_id(0);
104 const usize it = get_local_id(0);
112 const float p_i = p[i];
115 #ifndef LOCAL_MEM_SIZE
116 #define _GRADP_ lap_p_corr[i].XYZ
118 #define _GRADP_ lap_p_corr_l[it]
119 __local
vec_xyz lap_p_corr_l[LOCAL_MEM_SIZE];
123 const usize c_i = icell[i];
129 const vec_xyz r_ij = r[j].XYZ - r_i;
130 const float q = length(r_ij) / H;
137 const float f_ij =
kernelF(q) * CONF * m[j] / rho[j];
138 _GRADP_ += (p[j] - p_i) * f_ij * r_ij;
142 #ifdef LOCAL_MEM_SIZE
161 const __global
matrix* mls,
162 __global
vec* lap_p_corr,
165 const usize i = get_global_id(0);
172 lap_p_corr[i] =
MATRIX_DOT(mls[i], lap_p_corr[i]);
191__kernel
void lapp(
const __global
int* imove,
192 const __global
vec* r,
193 const __global
float* rho,
194 const __global
float* m,
195 const __global
float* p,
196 __global
float* lap_p,
200 const usize i = get_global_id(0);
201 const usize it = get_local_id(0);
209 const float p_i = p[i];
212 #ifndef LOCAL_MEM_SIZE
213 #define _LAPP_ lap_p[i]
215 #define _LAPP_ lap_p_l[it]
216 __local
float lap_p_l[LOCAL_MEM_SIZE];
220 const usize c_i = icell[i];
226 const vec_xyz r_ij = r[j].XYZ - r_i;
227 const float q = length(r_ij) / H;
234 const float f_ij =
kernelF(q) * CONF * m[j] / rho[j];
235 _LAPP_ += (p[j] - p_i) * f_ij;
239 #ifdef LOCAL_MEM_SIZE
262 const __global
vec* r,
263 const __global
float* rho,
264 const __global
float* m,
265 const __global
vec* lap_p_corr,
266 __global
float* lap_p,
270 const usize i = get_global_id(0);
271 const usize it = get_local_id(0);
279 const vec_xyz gradp_i = lap_p_corr[i].XYZ;
282 #ifndef LOCAL_MEM_SIZE
283 #define _LAPP_ lap_p[i]
285 #define _LAPP_ lap_p_l[it]
286 __local
float lap_p_l[LOCAL_MEM_SIZE];
290 const usize c_i = icell[i];
296 const vec_xyz r_ij = r[j].XYZ - r_i;
297 const float q = length(r_ij) / H;
304 const vec_xyz gradp_ij = lap_p_corr[j].XYZ + gradp_i;
305 const float f_ij =
kernelF(q) * CONF * m[j] / rho[j];
306 _LAPP_ -= 0.5f * dot(gradp_ij, r_ij) * f_ij;
310 #ifdef LOCAL_MEM_SIZE
330__kernel
void deltaSPH(
const __global
unsigned int* iset,
331 const __global
int* imove,
332 const __global
float* rho,
333 const __global
float* lap_p,
334 __global
float* drhodt,
335 __constant
float* refd,
336 __constant
float* delta,
340 const usize i = get_global_id(0);
346 const uint set_i = iset[i];
347 const float delta_f = delta[set_i] * dt * rho[i] / refd[set_i];
349 drhodt[i] += delta_f * lap_p[i];
#define MATRIX_DOT(_M, _V)
Multiply a matrix by a vector (inner product)
Definition 2D.h:197
#define BEGIN_NEIGHS(CELL, NPARTS, NCELLS, ICELL, IHOC)
Loop over the neighbours to compute the interactions.
Definition 2D.h:174
#define vec_xyz
Vectors with the minimum number of components.
Definition 2D.h:86
#define END_NEIGHS()
End of the loop over the neighs to compute the interactions.
Definition 2D.h:189
float kernelF(float q)
The kernel gradient factor .
Definition CubicSpline2D.hcl:67
Generic/automatic kernel header file.
#define vec
Definition LinkList.hcl.in:57
#define matrix
Definition LinkList.hcl.in:65
#define VEC_ZERO
Definition Reduction.hcl.in:70
__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, usize N, LINKLIST_LOCAL_PARAMS)
Laplacian of the pressure computation.
Definition deltaSPH.cl:191
#define EXCLUDED_PARTICLE(index)
Condition to exclude a particle from the delta-SPH model.
Definition deltaSPH.cl:35
__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, usize N, float dt)
Density variation rates delta-SPH term.
Definition deltaSPH.cl:330
__kernel void simple(const __global unsigned int *iset, const __global int *imove, __global vec *lap_p_corr, __constant float *refd, usize N, vec g)
Simple hidrostatic based correction term.
Definition deltaSPH.cl:57
__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, usize N, LINKLIST_LOCAL_PARAMS)
Laplacian of the pressure correction.
Definition deltaSPH.cl:261
__kernel void full_mls(const __global int *imove, const __global matrix *mls, __global vec *lap_p_corr, usize N)
MLS based correction term.
Definition deltaSPH.cl:160
__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, usize N, LINKLIST_LOCAL_PARAMS)
MLS based correction term.
Definition deltaSPH.cl:94
Generic types definition file.
#define LINKLIST_LOCAL_PARAMS
Macro to easily add the parameters to run BEGIN_NEIGHS macro, interacting with the local set of parti...
Definition types.h:106