milupHPC documentation
Public Member Functions | Public Attributes | List of all members
Particles Class Reference

Particle(s) class based on SoA (Structur of Arrays). More...

+ Collaboration diagram for Particles:
Collaboration graph

Public Member Functions

CUDA_CALLABLE_MEMBER Particles ()
 
CUDA_CALLABLE_MEMBER Particles (integer *numParticles, integer *numNodes, real *mass, real *x, real *y, real *z, real *vx, real *vy, real *vz, real *ax, real *ay, real *az, idInteger *uid, integer *materialId, real *sml, integer *nnl, integer *noi, real *e, real *dedt, real *cs, real *rho, real *p)
 Constructor (DIM = 3) assigning variables to pointer members. More...
 
CUDA_CALLABLE_MEMBER void set (integer *numParticles, integer *numNodes, real *mass, real *x, real *y, real *z, real *vx, real *vy, real *vz, real *ax, real *ay, real *az, integer *level, idInteger *uid, integer *materialId, real *sml, integer *nnl, integer *noi, real *e, real *dedt, real *cs, real *rho, real *p)
 Setter (DIM = 3) assigning variables to pointer members. More...
 
CUDA_CALLABLE_MEMBER void setGravity (real *g_ax, real *g_ay, real *g_az)
 Constructor (DIM = 3) assigning gravitational acceleration to member variables. More...
 
CUDA_CALLABLE_MEMBER void setLeapfrog (real *ax_old, real *ay_old, real *az_old, real *g_ax_old, real *g_ay_old, real *g_az_old)
 
CUDA_CALLABLE_MEMBER void setU (real *u)
 Setter for energy. More...
 
CUDA_CALLABLE_MEMBER void setNodeType (integer *nodeType)
 Setter for node type. More...
 
CUDA_CALLABLE_MEMBER void setArtificialViscosity (real *muijmax)
 Setter for artificial viscosity (entry). More...
 
CUDA_CALLABLE_MEMBER void setIntegrateDensity (real *drhodt)
 Setter in dependence of INTEGRATE_DENSITY. More...
 
CUDA_CALLABLE_MEMBER void reset (integer index)
 Reset (specific) entries. More...
 
CUDA_CALLABLE_MEMBER real distance (integer index_1, integer index_2)
 Distance of two particles. More...
 
CUDA_CALLABLE_MEMBER real weightedEntry (integer index, Entry::Name entry)
 
CUDA_CALLABLE_MEMBER ~Particles ()
 

Public Attributes

integer * numParticles
 number of particles More...
 
integer * numNodes
 number of nodes More...
 
real * mass
 (pointer to) mass (array) More...
 
real * x
 (pointer to) x position (array) More...
 
real * vx
 (pointer to) x velocity (array) More...
 
real * ax
 (pointer to) x acceleration (array) More...
 
real * ax_old
 
real * y
 (pointer to) y position (array) More...
 
real * vy
 (pointer to) y velocity (array) More...
 
real * ay
 (pointer to) y acceleration (array) More...
 
real * ay_old
 
real * z
 (pointer to) z position (array) More...
 
real * vz
 (pointer to) z velocity (array) More...
 
real * az
 (pointer to) z acceleration (array) More...
 
real * az_old
 
real * g_ax
 (pointer to) x gravitational acceleration (array) More...
 
real * g_ax_old
 
real * g_ay
 (pointer to) y gravitational acceleration (array) More...
 
real * g_ay_old
 
real * g_az
 (pointer to) z gravitational acceleration (array) More...
 
real * g_az_old
 
integer * nodeType
 (pointer to) node type More...
 
integer * level
 (pointer to) level of the (pseudo-)particles More...
 
idInteger * uid
 (pointer to) unique identifier (array) More...
 
integer * materialId
 (pointer to) material identifier (array) More...
 
real * sml
 (pointer to) smoothing length (array) More...
 
integer * nnl
 (pointer to) near(est) neighbor list (array) More...
 
integer * noi
 (pointer to) number of interactions (array) More...
 
real * e
 (pointer to) internal energy (array) More...
 
real * dedt
 (pointer to) time derivative of internal energy (array) More...
 
real * u
 energy (kinetic + gravitational for now) More...
 
real * cs
 (pointer to) sound of speed (array) More...
 
real * rho
 (pointer to) density (array) More...
 
real * p
 (pointer to) pressure (array) More...
 
real * muijmax
 (pointer) to max(mu_ij) (array) needed for artificial viscosity and determining timestp More...
 
real * drhodt
 (pointer to) time derivative of density (array) More...
 

Detailed Description

Particle(s) class based on SoA (Structur of Arrays).

Since dynamic memory allocation and access to heap objects in GPUs are usually suboptimal, an array-based data structure is used to store the (pseudo-)particle information as well as the tree and allows for efficient cache alignment. Consequently, array indices are used instead of pointers to constitute the tree out of the tree nodes, whereas "-1" represents a null pointer and "-2" is used for locking nodes. For this purpose an array with the minimum length \( 2^{d} \cdot (M - N) \) with dimensionality \( d \) and number of cells \( (M -N) \) is needed to store the children. The \( i \)-th child of node \( c \) can therefore be accessed via index \( 2^d \cdot c + i \).

Single-GPU memory layout:

It is further necessary to exchange particle properties between processes and (temporarily) include them into the local tree. To combine this requirement with the data structure described it is necessary to reserve parts of the array or memory for this purpose.

Multi-GPU memory layout:

Definition at line 50 of file particles.cuh.

Constructor & Destructor Documentation

◆ Particles() [1/2]

CUDA_CALLABLE_MEMBER Particles::Particles ( )

Default constructor

Definition at line 4 of file particles.cu.

◆ Particles() [2/2]

CUDA_CALLABLE_MEMBER Particles::Particles ( integer *  numParticles,
integer *  numNodes,
real *  mass,
real *  x,
real *  y,
real *  z,
real *  vx,
real *  vy,
real *  vz,
real *  ax,
real *  ay,
real *  az,
idInteger *  uid,
integer *  materialId,
real *  sml,
integer *  nnl,
integer *  noi,
real *  e,
real *  dedt,
real *  cs,
real *  rho,
real *  p 
)

Constructor (DIM = 3) assigning variables to pointer members.

Parameters
numParticlesnumber of particles
numNodesnumber of nodes
massmass entry
xposition \( x \) entry
yposition \( y \) entry
zposition \( x \) entry
vxvelocity \( v_x \) entry
vyvelocity \( v_y \) entry
vzvelocity \( v_z \) entry
axacceleration \( a_x \) entry
ayacceleration \( a_y \) entry
azacceleration \( a_z \) entry
uidunique identifier
materialIdmaterial identifier
smlsmoothing length
nnlnear neighbor list
noinumber of interaction partners
eenergy
dedttime derivative of the energy \( \frac{de}{dt} \) entry
csspeed of sound
rhodensity \( \rho \) entry
ppressure \( p \) entry

Definition at line 87 of file particles.cu.

◆ ~Particles()

CUDA_CALLABLE_MEMBER Particles::~Particles ( )

Destructor

Definition at line 361 of file particles.cu.

Member Function Documentation

◆ distance()

CUDA_CALLABLE_MEMBER real Particles::distance ( integer  index_1,
integer  index_2 
)

Distance of two particles.

Calculates the euclidian distance \( r = || \vec{x} - \vec{y} ||_2 = \sqrt{\sum_{i=1}^{DIM}(\vec{x}_i - \vec{y}_i)^2}\) of two particles at positions \( \vec{x} \) and \( \vec{y} \).

Parameters
index_1index of particle 1
index_2index of particle 2
Returns
distance of the two particles

Definition at line 292 of file particles.cu.

+ Here is the call graph for this function:

◆ reset()

CUDA_CALLABLE_MEMBER void Particles::reset ( integer  index)

Reset (specific) entries.

Reset entries to default values.

Parameters
indexindex of entry to be reset

Definition at line 279 of file particles.cu.

◆ set()

CUDA_CALLABLE_MEMBER void Particles::set ( integer *  numParticles,
integer *  numNodes,
real *  mass,
real *  x,
real *  y,
real *  z,
real *  vx,
real *  vy,
real *  vz,
real *  ax,
real *  ay,
real *  az,
integer *  level,
idInteger *  uid,
integer *  materialId,
real *  sml,
integer *  nnl,
integer *  noi,
real *  e,
real *  dedt,
real *  cs,
real *  rho,
real *  p 
)

Setter (DIM = 3) assigning variables to pointer members.

Setter as addition to constructor in order to allow Particles class instance creation and subsequent assignment of member variables.

Parameters
numParticlesnumber of particles
numNodesnumber of nodes
massmass entry
xposition \( x \) entry
yposition \( y \) entry
zposition \( x \) entry
vxvelocity \( v_x \) entry
vyvelocity \( v_y \) entry
vzvelocity \( v_z \) entry
axacceleration \( a_x \) entry
ayacceleration \( a_y \) entry
azacceleration \( a_z \) entry
uidunique identifier
materialIdmaterial identifier
smlsmoothing length
nnlnear neighbor list
noinumber of interaction partners
eenergy
dedttime derivative of the energy \( \frac{de}{dt} \) entry
csspeed of sound
rhodensity \( \rho \) entry
ppressure \( p \) entry

Definition at line 98 of file particles.cu.

◆ setArtificialViscosity()

CUDA_CALLABLE_MEMBER void Particles::setArtificialViscosity ( real *  muijmax)

Setter for artificial viscosity (entry).

Parameters
muijmax

Definition at line 179 of file particles.cu.

◆ setGravity()

CUDA_CALLABLE_MEMBER void Particles::setGravity ( real *  g_ax,
real *  g_ay,
real *  g_az 
)

Constructor (DIM = 3) assigning gravitational acceleration to member variables.

Note
acceleration and gravitational acceleration separated due to decoupled gravity.
Parameters
g_axgravitational acceleration \( a_{x, grav} \) entry
g_aygravitational acceleration \( a_{y, grav} \) entry
g_azgravitational acceleration \( a_{z, grav} \) entry

Definition at line 139 of file particles.cu.

◆ setIntegrateDensity()

CUDA_CALLABLE_MEMBER void Particles::setIntegrateDensity ( real *  drhodt)

Setter in dependence of INTEGRATE_DENSITY.

Parameters
drhodttime derivative of density

Definition at line 191 of file particles.cu.

◆ setLeapfrog()

CUDA_CALLABLE_MEMBER void Particles::setLeapfrog ( real *  ax_old,
real *  ay_old,
real *  az_old,
real *  g_ax_old,
real *  g_ay_old,
real *  g_az_old 
)

Definition at line 160 of file particles.cu.

◆ setNodeType()

CUDA_CALLABLE_MEMBER void Particles::setNodeType ( integer *  nodeType)

Setter for node type.

node types are

  • particle
  • pseudo-particle
  • (lowest) domain list node
Parameters
nodeTypenode type

Definition at line 175 of file particles.cu.

◆ setU()

CUDA_CALLABLE_MEMBER void Particles::setU ( real *  u)

Setter for energy.

Parameters
uenergy

Definition at line 171 of file particles.cu.

◆ weightedEntry()

CUDA_CALLABLE_MEMBER real Particles::weightedEntry ( integer  index,
Entry::Name  entry 
)

Definition at line 339 of file particles.cu.

Member Data Documentation

◆ ax

real* Particles::ax

(pointer to) x acceleration (array)

Definition at line 66 of file particles.cuh.

◆ ax_old

real* Particles::ax_old

Definition at line 67 of file particles.cuh.

◆ ay

real* Particles::ay

(pointer to) y acceleration (array)

Definition at line 74 of file particles.cuh.

◆ ay_old

real* Particles::ay_old

Definition at line 75 of file particles.cuh.

◆ az

real* Particles::az

(pointer to) z acceleration (array)

Definition at line 82 of file particles.cuh.

◆ az_old

real* Particles::az_old

Definition at line 83 of file particles.cuh.

◆ cs

real* Particles::cs

(pointer to) sound of speed (array)

Definition at line 129 of file particles.cuh.

◆ dedt

real* Particles::dedt

(pointer to) time derivative of internal energy (array)

Definition at line 123 of file particles.cuh.

◆ drhodt

real* Particles::drhodt

(pointer to) time derivative of density (array)

Definition at line 148 of file particles.cuh.

◆ e

real* Particles::e

(pointer to) internal energy (array)

Definition at line 121 of file particles.cuh.

◆ g_ax

real* Particles::g_ax

(pointer to) x gravitational acceleration (array)

Definition at line 88 of file particles.cuh.

◆ g_ax_old

real* Particles::g_ax_old

Definition at line 89 of file particles.cuh.

◆ g_ay

real* Particles::g_ay

(pointer to) y gravitational acceleration (array)

Definition at line 92 of file particles.cuh.

◆ g_ay_old

real* Particles::g_ay_old

Definition at line 93 of file particles.cuh.

◆ g_az

real* Particles::g_az

(pointer to) z gravitational acceleration (array)

Definition at line 96 of file particles.cuh.

◆ g_az_old

real* Particles::g_az_old

Definition at line 97 of file particles.cuh.

◆ level

integer* Particles::level

(pointer to) level of the (pseudo-)particles

Definition at line 106 of file particles.cuh.

◆ mass

real* Particles::mass

(pointer to) mass (array)

Definition at line 60 of file particles.cuh.

◆ materialId

integer* Particles::materialId

(pointer to) material identifier (array)

Definition at line 111 of file particles.cuh.

◆ muijmax

real* Particles::muijmax

(pointer) to max(mu_ij) (array) needed for artificial viscosity and determining timestp

Definition at line 138 of file particles.cuh.

◆ nnl

integer* Particles::nnl

(pointer to) near(est) neighbor list (array)

Definition at line 116 of file particles.cuh.

◆ nodeType

integer* Particles::nodeType

(pointer to) node type

Definition at line 103 of file particles.cuh.

◆ noi

integer* Particles::noi

(pointer to) number of interactions (array)

Definition at line 118 of file particles.cuh.

◆ numNodes

integer* Particles::numNodes

number of nodes

Definition at line 57 of file particles.cuh.

◆ numParticles

integer* Particles::numParticles

number of particles

Definition at line 55 of file particles.cuh.

◆ p

real* Particles::p

(pointer to) pressure (array)

Definition at line 135 of file particles.cuh.

◆ rho

real* Particles::rho

(pointer to) density (array)

Definition at line 133 of file particles.cuh.

◆ sml

real* Particles::sml

(pointer to) smoothing length (array)

Definition at line 113 of file particles.cuh.

◆ u

real* Particles::u

energy (kinetic + gravitational for now)

Definition at line 126 of file particles.cuh.

◆ uid

idInteger* Particles::uid

(pointer to) unique identifier (array)

Definition at line 109 of file particles.cuh.

◆ vx

real* Particles::vx

(pointer to) x velocity (array)

Definition at line 64 of file particles.cuh.

◆ vy

real* Particles::vy

(pointer to) y velocity (array)

Definition at line 72 of file particles.cuh.

◆ vz

real* Particles::vz

(pointer to) z velocity (array)

Definition at line 80 of file particles.cuh.

◆ x

real* Particles::x

(pointer to) x position (array)

Definition at line 62 of file particles.cuh.

◆ y

real* Particles::y

(pointer to) y position (array)

Definition at line 70 of file particles.cuh.

◆ z

real* Particles::z

(pointer to) z position (array)

Definition at line 78 of file particles.cuh.


The documentation for this class was generated from the following files:
  • include/particles.cuh
  • src/particles.cu

milupHPC - Particles Class Reference
Generated on Wed Aug 31 2022 12:16:53 by Doxygen 1.9.3