OpenMPCD
VelocityVerlet.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * Defines CUDA device code for velocity-Verlet integration.
4  */
5 
6 #ifndef OPENMPCD_CUDA_DEVICECODE_VELOCITYVERLET_HPP
7 #define OPENMPCD_CUDA_DEVICECODE_VELOCITYVERLET_HPP
8 
10 #include <OpenMPCD/Types.hpp>
11 #include <OpenMPCD/Vector3D.hpp>
12 
13 namespace OpenMPCD
14 {
15 namespace CUDA
16 {
17 namespace DeviceCode
18 {
19  /**
20  * Performs the first step in the velocity-Verlet algorithm.
21  * This function returns the new position \f$x(t+h)\f$ according to
22  * \f$x(t+h) = x(t) + v(t) h + \frac{1}{2} a h^2\f$
23  * where \f$v\f$ is the velocity, \f$a\f$ the acceleration
24  * and \f$h\f$ the timestep.
25  * @param[in] position The position.
26  * @param[in] velocity The velocity.
27  * @param[in] acceleration The acceleration.
28  * @param[in] timestep The timestep.
29  */
31  const MPCParticlePositionType position,
32  const MPCParticleVelocityType velocity,
33  const FP acceleration, const FP timestep);
34 
35  /**
36  * Performs the second step in the velocity-Verlet algorithm.
37  * This function returns the new velocity \f$y(t+h)\f$ according to
38  * \f$v(t+h) = v(t) + \frac{h}{2}\left(a(t) + a(t+h)\right)\f$
39  * where \f$x\f$ is the position, \f$a\f$ the acceleration
40  * and \f$h\f$ the timestep.
41  * @param[in] velocity The velocity.
42  * @param[in] oldAcceleration The acceleration at the time \f$t\f$.
43  * @param[in] newAcceleration The acceleration at the time \f$t+h\f$.
44  * @param[in] timestep The timestep.
45  */
47  const MPCParticleVelocityType velocity,
48  const FP oldAcceleration,
49  const FP newAcceleration,
50  const FP timestep);
51 
52  /**
53  * Performs the first step in the velocity-Verlet algorithm.
54  * This function updates the position \f$x\f$ according to
55  * \f$x(t+h) = x(t) + v(t) h + \frac{1}{2} a h^2\f$
56  * where \f$v\f$ is the velocity, \f$a\f$ the acceleration
57  * and \f$h\f$ the timestep.
58  * @param[in,out] position The position.
59  * @param[in] velocity The velocity.
60  * @param[in] acceleration The acceleration.
61  * @param[in] timestep The timestep.
62  */
63  __device__ void velocityVerletStep1(
64  RemotelyStoredVector<MPCParticlePositionType>* const position,
65  const RemotelyStoredVector<MPCParticleVelocityType> velocity,
66  const Vector3D<FP> acceleration, const FP timestep);
67 
68  /**
69  * Performs the second step in the velocity-Verlet algorithm.
70  * This function updates the velocity \f$v\f$ according to
71  * \f$v(t+h) = v(t) + \frac{h}{2}\left(a(t) + a(t+h)\right)\f$
72  * where \f$x\f$ is the position, \f$a\f$ the acceleration
73  * and \f$h\f$ the timestep.
74  * @param[in,out] velocity The velocity.
75  * @param[in] oldAcceleration The acceleration at the time \f$t\f$.
76  * @param[in] newAcceleration The acceleration at the time \f$t+h\f$.
77  * @param[in] timestep The timestep.
78  */
79  __device__ void velocityVerletStep2(
80  RemotelyStoredVector<MPCParticleVelocityType>* const velocity,
81  const Vector3D<FP> oldAcceleration,
82  const Vector3D<FP> newAcceleration,
83  const FP timestep);
84 } //namespace DeviceCode
85 } //namespace CUDA
86 } //namespace OpenMPCD
87 
88 #endif
OpenMPCD::CUDA::DeviceCode::velocityVerletStep1
__device__ MPCParticlePositionType velocityVerletStep1(const MPCParticlePositionType position, const MPCParticleVelocityType velocity, const FP acceleration, const FP timestep)
Performs the first step in the velocity-Verlet algorithm.
RemotelyStoredVector.hpp
OpenMPCD::MPCParticlePositionType
FP MPCParticlePositionType
The data type for the positions of MPC particles.
Definition: Types.hpp:15
OpenMPCD::CUDA::DeviceCode::velocityVerletStep2
__device__ MPCParticleVelocityType velocityVerletStep2(const MPCParticleVelocityType velocity, const FP oldAcceleration, const FP newAcceleration, const FP timestep)
Performs the second step in the velocity-Verlet algorithm.
Vector3D.hpp
Types.hpp
OpenMPCD::MPCParticleVelocityType
FP MPCParticleVelocityType
The data type for the velocities of MPC particles.
Definition: Types.hpp:16