OpenMPCD
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base Class Referenceabstract

Base class for measurements of velocity autocorrelation in MPC fluids. More...

#include <Base.hpp>

Inheritance diagram for OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base:
Inheritance graph
[legend]
Collaboration diagram for OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base:
Collaboration graph
[legend]

Classes

class  Snapshot
 Represents a snapshot of the MPC fluid constituent velocities. More...
 

Public Member Functions

virtual ~Base ()
 The destructor. More...
 
void measure ()
 Performs measurements. More...
 
void save (const std::string &rundir) const
 Saves the data to the given run directory. More...
 

Static Public Member Functions

static bool isConfigured (const Simulation *const sim)
 Returns whether the given simulation configured this instrumentation. More...
 

Protected Member Functions

 Base (const Simulation *const sim, DeviceMemoryManager *const devMemMgr, const MPCFluid::Base *const mpcFluid_, const unsigned int numberOfConstituents_)
 The constructor. More...
 
virtual void populateCurrentVelocities ()=0
 Populates the Device buffer with the current velocities of the fluid constituents. More...
 

Protected Attributes

const Simulation *const simulation
 The simulation instance. More...
 
DeviceMemoryManager *const deviceMemoryManager
 The Device memory manager. More...
 
const MPCFluid::Base *const mpcFluid
 The fluid to measure. More...
 
const unsigned int numberOfConstituents
 The number of logical constituents (e.g. pairs, triplets, ...) in the fluid. More...
 
FP measurementTime
 The maximum time between snapshots. More...
 
std::vector< Snapshot * > snapshots
 The snapshots of the fluid constituent velocities. More...
 
MPCParticleVelocityTypecurrentVelocities
 Current velocities of the fluid constituents. More...
 
std::deque< boost::tuple< FP, FP, MPCParticleVelocityType > > autocorrelations
 Collection of tuples consisting of, in that order, \( t_i \), \( t_j \), and \( V \left( t_i, t_j \right) \). More...
 

Detailed Description

Base class for measurements of velocity autocorrelation in MPC fluids.

This class and its subclasses aid in measuring the velocity autocorrelation function of the fluid constituents' centers of mass, i.e.

\[ \left< \vec{v} \left( t \right) \cdot \vec{v} \left( 0 \right) \right> = \frac{ 1 }{ N_{\textrm{logical entites}} } \sum_{k = 0}^{N_{\textrm{logical entites}} - 1} \left< \vec{v}_k \left( t \right) \cdot \vec{v}_k \left( 0 \right) \right> \]

where \( N_{\textrm{logical entites}} \) is the number of logical entities in the fluid (see OpenMPCD::CUDA::MPCFluid::Base), \( \vec{v}_k \left( t \right) \) is the velocity of the center of mass of the logical entity with index \( k \) at simulation time \( t \), and the angle brackets denote expectation values.

To approximate this quantity, the center of mass velocities of the logical entities are stored in snapshots periodically. Then, each time measure is called, the quantity

\[ V \left( t_i, t \right) = \frac{ 1 }{ N_{\textrm{logical entites}} } \sum_{k = 0}^{N_{\textrm{logical entites}} - 1} \vec{v}_k \left( t_i \right) \cdot \vec{v}_k \left( t \right) \]

is calculated, i.e. the sample average of the inner product of a logical entity's center of mass velocity at the current time \( t \) with that same logical entity's center of mass velocity at snapshot time \( t_i \), for all currently available snapshots \( i \).

At most, snapshotCount (see configuration options below) many snapshots are stored at any point in time. Every time measure is called, before the \( V \left( t_i, t \right) \) are calculated as described above, the following procedure takes place:

Given this, the velocity autocorrelation function \( \left< \vec{v} \left( t \right) \cdot \vec{v} \left( 0 \right) \right> \) can be approximated as the average of all \( V \left( t_i, t_j \right) \) where \( t_j - t_i = t \).

However, this last step is currently not performed by this class; instead, it computes \( V \left( t_i, t_j \right) \) and stores them, along with \( t_i \) and \( t_j \).

This class and its subclasses are configured via the instrumentation.velocityAutocorrelation configuration group, which consists of the following settings:

Definition at line 110 of file CUDA/MPCFluid/Instrumentation/VelocityAutocorrelation/Base.hpp.

Constructor & Destructor Documentation

◆ Base()

OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::Base ( const Simulation *const  sim,
DeviceMemoryManager *const  devMemMgr,
const MPCFluid::Base *const  mpcFluid_,
const unsigned int  numberOfConstituents_ 
)
protected

The constructor.

Exceptions
OpenMPCD::InvalidConfigurationExceptionThrows if the configuration is invalid.
OpenMPCD::NULLPointerExceptionIf OPENMPCD_DEBUG is defined, throws if any of the pointer arguments is a nullptr.
OpenMPCD::InvalidArgumentExceptionIf OPENMPCD_DEBUG is defined, throws if numberOfConstituents_ == 0.
Parameters
[in]simThe simulation instance.
[in]devMemMgrThe Device memory manager instance.
[in]mpcFluid_The MPC fluid to measure.
[in]numberOfConstituents_The number of logical constituents (e.g. pairs, triplets, ...) in the fluid.

◆ ~Base()

virtual OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::~Base ( )
virtual

The destructor.

Member Function Documentation

◆ isConfigured()

static bool OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::isConfigured ( const Simulation *const  sim)
static

Returns whether the given simulation configured this instrumentation.

Parameters
[in]simThe simulation instance.
Exceptions
NULLPointerExceptionThrows if sim is nullptr.

◆ measure()

void OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::measure ( )

Performs measurements.

◆ populateCurrentVelocities()

virtual void OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::populateCurrentVelocities ( )
protectedpure virtual

◆ save()

void OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::save ( const std::string &  rundir) const

Saves the data to the given run directory.

The given run directory is created if necessary, and so is the data file therein; if the data file already exists, it will be truncated.

Multiple lines will be written to the file, each consisting of three tab-separated columns: The first column corresponds to the simulation time \( t_i \) of a snapshot \( i \); the second column to the simulation time \( t_j \ge t_i \) ; and finally, the third column contains \( V \left( t_i, t_j \right) \). One such line will be written for every measured \( V \) (see class documentation for details).

The lines are ordered by ascending \( t_j \) first, and then by ascending snapshot position in memory (see class documentation for details).

Parameters
[in]rundirThe path to the run directory. Within that directory, the data will be saved to the file velocityAutocorrelations.data.

Member Data Documentation

◆ autocorrelations

std::deque<boost::tuple<FP, FP, MPCParticleVelocityType> > OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::autocorrelations
protected

Collection of tuples consisting of, in that order, \( t_i \), \( t_j \), and \( V \left( t_i, t_j \right) \).

Definition at line 320 of file CUDA/MPCFluid/Instrumentation/VelocityAutocorrelation/Base.hpp.

◆ currentVelocities

MPCParticleVelocityType* OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::currentVelocities
protected

Current velocities of the fluid constituents.

Definition at line 318 of file CUDA/MPCFluid/Instrumentation/VelocityAutocorrelation/Base.hpp.

◆ deviceMemoryManager

DeviceMemoryManager* const OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::deviceMemoryManager
protected

The Device memory manager.

Definition at line 309 of file CUDA/MPCFluid/Instrumentation/VelocityAutocorrelation/Base.hpp.

◆ measurementTime

FP OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::measurementTime
protected

The maximum time between snapshots.

Definition at line 315 of file CUDA/MPCFluid/Instrumentation/VelocityAutocorrelation/Base.hpp.

◆ mpcFluid

const MPCFluid::Base* const OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::mpcFluid
protected

The fluid to measure.

Definition at line 310 of file CUDA/MPCFluid/Instrumentation/VelocityAutocorrelation/Base.hpp.

◆ numberOfConstituents

const unsigned int OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::numberOfConstituents
protected

The number of logical constituents (e.g. pairs, triplets, ...) in the fluid.

Definition at line 312 of file CUDA/MPCFluid/Instrumentation/VelocityAutocorrelation/Base.hpp.

◆ simulation

const Simulation* const OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::simulation
protected

The simulation instance.

Definition at line 308 of file CUDA/MPCFluid/Instrumentation/VelocityAutocorrelation/Base.hpp.

◆ snapshots

std::vector<Snapshot*> OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::snapshots
protected

The snapshots of the fluid constituent velocities.

Definition at line 317 of file CUDA/MPCFluid/Instrumentation/VelocityAutocorrelation/Base.hpp.


The documentation for this class was generated from the following file: