OpenMPCD
LeesEdwardsBoundaryConditions.cpp
2 
5 
8  const Vector3D<MPCParticlePositionType>& position,
9  const FP mpcTime,
10  const FP shearRate,
11  const unsigned int simBoxX, const unsigned int simBoxY, const unsigned int simBoxZ,
12  MPCParticleVelocityType* const velocityCorrection)
13 {
14  const FP relativeLayerVelocity = shearRate * simBoxY;
15  const FP layerDisplacement = relativeLayerVelocity * mpcTime; //delrx in Kowalik and Winkler's paper
16 
17  FP x = position.getX();
18  FP y = position.getY();
19  FP z = position.getZ();
20 
21  const double layerY = floor(y / simBoxY);
22  //< cory in Kowalik and Winkler's paper
23 
24  const double layerZ = floor(z / simBoxZ);
25 
26  x -= layerY * layerDisplacement;
27 
28  const double layerX = floor(x / simBoxX);
29 
30  x -= layerX * simBoxX;
31  y -= layerY * simBoxY;
32  z -= layerZ * simBoxZ;
33 
34  #ifdef OPENMPCD_DEBUG
35  if(velocityCorrection == NULL)
36  OPENMPCD_THROW(NULLPointerException, "velocityCorrection");
37  #endif
38 
39  *velocityCorrection = - layerY * relativeLayerVelocity;
40 
41  OPENMPCD_DEBUG_ASSERT(x >= 0 && x < simBoxX);
42  OPENMPCD_DEBUG_ASSERT(y >= 0 && y < simBoxY);
43  OPENMPCD_DEBUG_ASSERT(z >= 0 && z < simBoxZ);
44 
45  return Vector3D<MPCParticlePositionType>(x, y, z);
46 }
Exceptions.hpp
OpenMPCD::Vector3D::getZ
OPENMPCD_CUDA_HOST_AND_DEVICE T getZ() const
Returns the z coordinate.
Definition: Vector3D.hpp:119
OPENMPCD_THROW
#define OPENMPCD_THROW(ExceptionType, message)
Throws the given ExceptionType, passing the given message along with file and line number information...
Definition: Exceptions.hpp:22
OpenMPCD::Vector3D
3-dimensional vector.
Definition: Vector3D.hpp:38
OpenMPCD::Vector3D::getX
OPENMPCD_CUDA_HOST_AND_DEVICE T getX() const
Returns the x coordinate.
Definition: Vector3D.hpp:61
OPENMPCD_DEBUG_ASSERT
#define OPENMPCD_DEBUG_ASSERT(assertion)
Asserts that the given expression evaluates to true, but only if OPENMPCD_DEBUG is defined.
Definition: OPENMPCD_DEBUG_ASSERT.hpp:88
OpenMPCD::Vector3D::getY
OPENMPCD_CUDA_HOST_AND_DEVICE T getY() const
Returns the y coordinate.
Definition: Vector3D.hpp:90
OPENMPCD_DEBUG_ASSERT.hpp
OpenMPCD::FP
double FP
Default floating point type.
Definition: Types.hpp:13
OpenMPCD::MPCParticleVelocityType
FP MPCParticleVelocityType
The data type for the velocities of MPC particles.
Definition: Types.hpp:16
OpenMPCD::CUDA::DeviceCode::getImageUnderLeesEdwardsBoundaryConditions
const __device__ Vector3D< MPCParticlePositionType > getImageUnderLeesEdwardsBoundaryConditions(const FP mpcTime, const Vector3D< MPCParticlePositionType > &position, MPCParticleVelocityType &velocityCorrection)
Returns the image of the given particle position under Lees-Edwards boundary conditions.
OpenMPCD::NULLPointerException
NULL-pointer exception.
Definition: Exceptions.hpp:96
LeesEdwardsBoundaryConditions.hpp