OpenMPCD
|
Fluid consisting of Gaussian rods with a certain mean length. More...
#include <GaussianRods.hpp>
Public Member Functions | |
GaussianRods (const CUDA::Simulation *const sim, const unsigned int count, const FP streamingTimestep_, RNG &rng_, DeviceMemoryManager *const devMemMgr) | |
The constructor. More... | |
virtual | ~GaussianRods () |
The destructor. More... | |
virtual unsigned int | getNumberOfLogicalEntities () const |
Returns the number of logical entities in the fluid. More... | |
virtual bool | numberOfParticlesPerLogicalEntityIsConstant () const |
Returns whether all logical entities consist of the same number of MPC particles. More... | |
virtual unsigned int | getNumberOfParticlesPerLogicalEntity () const |
Returns the number of MPC particles per logical entity. More... | |
virtual void | stream () |
Performs a streaming step. More... | |
unsigned int | getParticleCount () const |
Returns the number of MPC fluid particles. More... | |
void | fetchFromDevice () const |
Copies the MPC fluid particles from the CUDA Device to the Host. More... | |
const RemotelyStoredVector< const MPCParticlePositionType > | getPosition (const unsigned int particleID) const |
Returns a MPC fluid particle's position vector. More... | |
const RemotelyStoredVector< const MPCParticleVelocityType > | getVelocity (const unsigned int particleID) const |
Returns a MPC fluid particle's velocity vector. More... | |
void | setPositionsAndVelocities (const MPCParticlePositionType *const positions, const MPCParticleVelocityType *const velocities) |
Sets the positions and velocities of the particles on the Device. More... | |
const MPCParticlePositionType * | getDevicePositions () const |
Returns a const pointer to the MPC fluid positions on the Device. More... | |
MPCParticlePositionType * | getDevicePositions () |
Returns a pointer to the MPC fluid positions on the Device. More... | |
MPCParticleVelocityType * | getDeviceVelocities () |
Returns a pointer to the MPC fluid velocities on the Device. More... | |
const MPCParticleVelocityType * | getDeviceVelocities () const |
Returns a const pointer to the MPC fluid velocities on the Device. More... | |
MPCParticlePositionType * | getHostPositions () |
Returns a pointer to the MPC fluid positions on the Host. More... | |
MPCParticleVelocityType * | getHostVelocities () |
Returns a pointer to the MPC fluid velocities on the Host. More... | |
Instrumentation::Base & | getInstrumentation () const |
Returns the fluid instrumentation. More... | |
void | writeToSnapshot (VTFSnapshotFile *const snapshot) const |
Writes the particle positions and velocities to the given snapshot file. More... | |
void | findMatchingParticlesOnHost (bool(*func)(const RemotelyStoredVector< const MPCParticlePositionType > &, const RemotelyStoredVector< const MPCParticleVelocityType > &), std::vector< unsigned int > *const matches, unsigned int *const matchCount) const |
Computes, on the Host, which MPC particles match the criterion represented by func . More... | |
void | saveLogicalEntityCentersOfMassToDeviceMemory (MPCParticlePositionType *const buffer) const |
Computes the center of mass for each logical entity, and saves their coordinates in the given Device buffer. More... | |
Static Public Member Functions | |
static unsigned int | getParticleMass () |
Returns the MPC fluid particle mass. More... | |
Protected Member Functions | |
void | pushToDevice () |
Copies the MPC fluid particles from the Host to the CUDA Device. More... | |
void | initializeVelocitiesOnHost () const |
Initializes the fluid particles velocities in Host memory. More... | |
Static Protected Member Functions | |
static void | globalUnbiasedThermostat (const FP kT, MPCParticleVelocityType *const velocities, const unsigned int particleCount) |
Scales all MPC fluid particle velocities so that the global temperature matches the given target. More... | |
static const Vector3D< MPCParticleVelocityType > | getTotalMomentum (const MPCParticleVelocityType *const velocities, const unsigned int particleCount) |
Returns the total momentum of the given MPC fluid particles. More... | |
static const Vector3D< MPCParticleVelocityType > | getMeanMomentum (const MPCParticleVelocityType *const velocities, const unsigned int particleCount) |
Returns the mean momentum of the given MPC fluid particles. More... | |
static FP | getKineticEnergy (const MPCParticleVelocityType *const velocities, const unsigned int particleCount) |
Returns the total kinetic energy of the MPC fluid. More... | |
static FP | getkTViaKineticEnergy (const MPCParticleVelocityType *const velocities, const unsigned int particleCount) |
Returns the product of Boltzmann's constant with the MPC fluid temperature, as measured by the total kinetic energy of the MPC fluid. More... | |
Protected Attributes | |
const CUDA::Simulation *const | simulation |
The simulation instance. More... | |
DeviceMemoryManager *const | deviceMemoryManager |
The Device memory manager. More... | |
Instrumentation::Base * | instrumentation |
The fluid instrumentation. More... | |
RNG | rng |
The random number generator. More... | |
MPCParticlePositionType * | mpcParticlePositions |
Host pointer for the MPC particle positions. More... | |
MPCParticleVelocityType * | mpcParticleVelocities |
Host pointer for the MPC particle positions. More... | |
MPCParticlePositionType * | d_mpcParticlePositions |
Device pointer for the MPC particle positions. More... | |
MPCParticleVelocityType * | d_mpcParticleVelocities |
Device pointer for the MPC particle positions. More... | |
const unsigned int | numberOfParticles |
The number of fluid particles. More... | |
const FP | streamingTimestep |
The timestep for a streaming step. More... | |
Static Protected Attributes | |
static const unsigned int | mpcParticleMass = 1 |
The mass of each MPC particle. More... | |
Fluid consisting of Gaussian rods with a certain mean length.
If \( \vec{R} \) is the bond vector pointing from the first particle to the second, the potential is \( U = \frac{k}{2} \left( \left| R \right| - L \right)^2 \), where \( L \) is the mean bond length and \( k \) is called the spring constant.
Definition at line 27 of file GaussianRods.hpp.
OpenMPCD::CUDA::MPCFluid::GaussianRods::GaussianRods | ( | const CUDA::Simulation *const | sim, |
const unsigned int | count, | ||
const FP | streamingTimestep_, | ||
RNG & | rng_, | ||
DeviceMemoryManager *const | devMemMgr | ||
) |
The constructor.
[in] | sim | The simulation instance. |
[in] | count | The number of fluid particles. |
[in] | streamingTimestep_ | The timestep for a streaming step. |
[in] | rng_ | A random number generator to seed this instance's RNG with. |
[in] | devMemMgr | The Device memory manager. |
|
inlinevirtual |
The destructor.
Definition at line 45 of file GaussianRods.hpp.
|
inherited |
|
inherited |
Computes, on the Host, which MPC particles match the criterion represented by func
.
fetchFromDevice
was called. [in] | func | Iff this function returns true, the MPC particles are considered to satisfy the criterion. The first argument is the particle's position, the second its velocity. |
[out] | matches | Will hold the IDs of the particles that satisfied the criterion; may be nullptr if not needed. |
[out] | matchCount | Will hold the number of particles that satisfied the criterion; may be nullptr if not needed. |
|
inlineinherited |
Returns a pointer to the MPC fluid positions on the Device.
Definition at line 169 of file CUDA/MPCFluid/Base.hpp.
|
inlineinherited |
Returns a const pointer to the MPC fluid positions on the Device.
Definition at line 161 of file CUDA/MPCFluid/Base.hpp.
|
inlineinherited |
Returns a pointer to the MPC fluid velocities on the Device.
Definition at line 177 of file CUDA/MPCFluid/Base.hpp.
|
inlineinherited |
Returns a const pointer to the MPC fluid velocities on the Device.
Definition at line 185 of file CUDA/MPCFluid/Base.hpp.
|
inlineinherited |
Returns a pointer to the MPC fluid positions on the Host.
Definition at line 193 of file CUDA/MPCFluid/Base.hpp.
|
inlineinherited |
Returns a pointer to the MPC fluid velocities on the Host.
Definition at line 201 of file CUDA/MPCFluid/Base.hpp.
|
inlineinherited |
Returns the fluid instrumentation.
NULLPointerException | If OPENMPCD_DEBUG is defined, throws if instrumentation is a NULL pointer. |
Definition at line 210 of file CUDA/MPCFluid/Base.hpp.
|
staticprotectedinherited |
Returns the total kinetic energy of the MPC fluid.
[in] | velocities | The velocities of the MPC fluid particles on the Host. |
[in] | particleCount | The number of MPC fluid particles. |
|
inlinestaticprotectedinherited |
Returns the product of Boltzmann's constant with the MPC fluid temperature, as measured by the total kinetic energy of the MPC fluid.
[in] | velocities | The velocities of the MPC fluid particles on the Host. |
[in] | particleCount | The number of MPC fluid particles. |
Definition at line 335 of file CUDA/MPCFluid/Base.hpp.
|
staticprotectedinherited |
Returns the mean momentum of the given MPC fluid particles.
[in] | velocities | The velocities of the MPC fluid particles on the Host. |
[in] | particleCount | The number of MPC fluid particles. |
|
inlinevirtual |
Returns the number of logical entities in the fluid.
Implements OpenMPCD::CUDA::MPCFluid::Base.
Definition at line 50 of file GaussianRods.hpp.
|
inlinevirtual |
Returns the number of MPC particles per logical entity.
OpenMPCD::InvalidCallException | Throws if !numberOfParticlesPerLogicalEntityIsConstant() . |
Reimplemented from OpenMPCD::CUDA::MPCFluid::Base.
Definition at line 60 of file GaussianRods.hpp.
|
inlineinherited |
Returns the number of MPC fluid particles.
Definition at line 72 of file CUDA/MPCFluid/Base.hpp.
|
inlinestaticinherited |
Returns the MPC fluid particle mass.
Definition at line 80 of file CUDA/MPCFluid/Base.hpp.
|
inherited |
Returns a MPC fluid particle's position vector.
OutOfBoundsException | If OPENMPCD_DEBUG is defined, throws if particleID >= getMPCParticleCount() |
[in] | particleID | The particle ID. |
|
staticprotectedinherited |
Returns the total momentum of the given MPC fluid particles.
[in] | velocities | The velocities of the MPC fluid particles on the Host. |
[in] | particleCount | The number of MPC fluid particles. |
|
inherited |
Returns a MPC fluid particle's velocity vector.
OutOfBoundsException | If OPENMPCD_DEBUG is defined, throws if particleID >= getMPCParticleCount() |
[in] | particleID | The particle ID. |
|
staticprotectedinherited |
Scales all MPC fluid particle velocities so that the global temperature matches the given target.
[in] | kT | The target temperature, multiplied by Boltzmann's constant. |
[in,out] | velocities | The MPC fluid particle velocities on the Host. |
[in] | particleCount | The number of MPC fluid particles. |
|
protectedinherited |
Initializes the fluid particles velocities in Host memory.
|
inlinevirtual |
Returns whether all logical entities consist of the same number of MPC particles.
The value of this function will remain unchanged for the lifetime of the instance.
Implements OpenMPCD::CUDA::MPCFluid::Base.
Definition at line 55 of file GaussianRods.hpp.
|
protectedinherited |
|
inherited |
Computes the center of mass for each logical entity, and saves their coordinates in the given Device buffer.
The computation is performed with the data as it currently exists on the Device.
OpenMPCD::NULLPointerException | Throws if buffer == nullptr . * |
[out] | buffer | The device buffer to save the coordinates to. It must be able to hold at least 3 * getNumberOfLogicalEntities() elements. The first element in the buffer will be the x coordinate of the center of mass of the first logical entity, followed by the y and z coordinates. After that, the second entity's coordinates follow, and so on. |
|
inherited |
Sets the positions and velocities of the particles on the Device.
OpenMPCD::NULLPointerException | If OPENMPCD_DEBUG is defined, throws if positions == nullptr or velocities == nullptr . |
[in] | positions | An array holding 3 * getParticleCount() values on the Host; first, the x , y , and z coordinates of the first atom, then those of the second, etc. |
[in] | velocities | An array holding 3 * getParticleCount() values on the Host; first, the x , y , and z velocities of the first atom, then those of the second, etc. |
|
virtual |
Performs a streaming step.
Implements OpenMPCD::CUDA::MPCFluid::Base.
|
inherited |
Writes the particle positions and velocities to the given snapshot file.
This function will call fetchFromDevice
, and write the current Device data to the given snapshot file.
OpenMPCD::NULLPointerException | Throws if snapshot == nullptr . |
OpenMPCD::InvalidArgumentException | Throws if the number of atoms declared in the snapshot does not match the number of particles in this instance. |
OpenMPCD::InvalidArgumentException | Throws if the given snapshot is not in write mode. |
[in,out] | snapshot | The snapshot file. |
|
protectedinherited |
Device pointer for the MPC particle positions.
Definition at line 363 of file CUDA/MPCFluid/Base.hpp.
|
protectedinherited |
Device pointer for the MPC particle positions.
Definition at line 364 of file CUDA/MPCFluid/Base.hpp.
|
protectedinherited |
The Device memory manager.
Definition at line 354 of file CUDA/MPCFluid/Base.hpp.
|
protectedinherited |
The fluid instrumentation.
Definition at line 356 of file CUDA/MPCFluid/Base.hpp.
|
staticprotectedinherited |
The mass of each MPC particle.
Definition at line 351 of file CUDA/MPCFluid/Base.hpp.
|
mutableprotectedinherited |
Host pointer for the MPC particle positions.
Definition at line 360 of file CUDA/MPCFluid/Base.hpp.
|
mutableprotectedinherited |
Host pointer for the MPC particle positions.
Definition at line 361 of file CUDA/MPCFluid/Base.hpp.
|
protectedinherited |
The number of fluid particles.
Definition at line 366 of file CUDA/MPCFluid/Base.hpp.
|
mutableprotectedinherited |
The random number generator.
Definition at line 358 of file CUDA/MPCFluid/Base.hpp.
|
protectedinherited |
The simulation instance.
Definition at line 353 of file CUDA/MPCFluid/Base.hpp.
|
protectedinherited |
The timestep for a streaming step.
Definition at line 368 of file CUDA/MPCFluid/Base.hpp.