1#include "../../include/sph/soundspeed.cuh"
2#include "../../include/cuda_utils/cuda_launcher.cuh"
6 register int i, inc, matId;
7 inc = blockDim.x * gridDim.x;
9 for (i = threadIdx.x + blockIdx.x * blockDim.x; i <
numParticles; i += inc) {
12 switch (materials[matId].eos.type) {
14 particles->
cs[i] = 0.0;
17 particles->
cs[i] = 203.0;
22 particles->
cs[i] /= 2.998e8;
37 register int i, inc, matId;
41 register double cs, rho,
pressure, eta, omega0, z, cs_sq, cs_c_sq, cs_e_sq, Gamma_e, mu, y;
44 inc = blockDim.x * gridDim.x;
46 for (i = threadIdx.x + blockIdx.x * blockDim.x; i <
numParticles; i += inc) {
50 switch (materials[matId].eos.type) {
59 particles->
cs[i] =
cuda::math::sqrt(materials[matId].eos.polytropic_gamma * particles->
p[i] /
61 if (std::isnan(particles->
cs[i])) {
62 printf(
"particles->cs[%i] = %e, gamma = %e, p = %e, rho = %e\n", i, particles->
cs[i],
69 distance = particles->
x[i] * particles->
x[i];
71 distance += particles->
y[i] * particles->
y[i];
73 distance += particles->
z[i] * particles->
z[i];
Execution policy/instruction for CUDA kernel execution.
Particle(s) class based on SoA (Structur of Arrays).
integer * materialId
(pointer to) material identifier (array)
real * x
(pointer to) x position (array)
real * rho
(pointer to) density (array)
real * p
(pointer to) pressure (array)
real * cs
(pointer to) sound of speed (array)
real * y
(pointer to) y position (array)
real * z
(pointer to) z position (array)
const char *const pressure
const char *const numParticles
real calculateSoundSpeed(Particles *particles, Material *materials, int numParticles)
Wrapper for SPH::Kernel::calculateSoundSpeed().
real initializeSoundSpeed(Particles *particles, Material *materials, int numParticles)
Wrapper for SPH::Kernel::initializeSoundSpeed().
__global__ void initializeSoundSpeed(Particles *particles, Material *materials, int numParticles)
Initialize the speed of sound .
__global__ void calculateSoundSpeed(Particles *particles, Material *materials, int numParticles)
Calculate the speed of sound .
__device__ real sqrt(real a)
Square root of a floating point value.
real launch(bool timeKernel, const ExecutionPolicy &policy, void(*f)(Arguments...), Arguments... args)
CUDA execution wrapper function.
@ EOS_TYPE_LOCALLY_ISOTHERMAL_GAS
ideal gas equation, set polytropic_gamma in material.cfg
@ EOS_TYPE_IDEAL_GAS
this is pure molecular hydrogen at 10 K
@ EOS_TYPE_ISOTHERMAL_GAS
polytropic EOS for gas, needs polytropic_K and polytropic_gamma in material.cfg file
@ EOS_TYPE_POLYTROPIC_GAS