ls1-MarDyn
ls1-MarDyn molecular dynamics code
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SpatialProfile Class Reference

SpatialProfile is a Plugin that is called like any other plugin derived from PluginBase. It handles all profiles in /plugins/profiles.
New profiles must be added via the plugins/ ProfileBase to comply with this Plugin.
More...

#include <SpatialProfile.h>

Inheritance diagram for SpatialProfile:
PluginBase

Public Member Functions

void init (ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override
 Initialize Arrays needed for calculating the profiles. Also get reference to domain for specific quantities. All profiles will be reset here to 0 before starting the recording frame. The uIDs are can be calculated from the globalLength and the number of divisions specified for the Sampling grid. More...
 
void readXML (XMLfileUnits &xmlconfig) override
 Read in Information about write/record frequencies, Sampling Grid and which profiles are enabled. Also create needed profiles and initialize them. New Profiles need to be handled via the XML here as well. More...
 
void endStep (ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep) override
 Iterates over all molecules and passes them together with their Bin ID to the profiles for further processing. If the current timestep hits the writefrequency the profile writes/resets are triggered here. All of this only occurs after the initStatistics are passed. More...
 
void finish (ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override
 Method finish will be called at the end of the simulation. More...
 
unsigned long getCartesianUID (ParticleIterator &thismol)
 getCartesianUID samples the domain cartesian coordinate bins. More...
 
long getCylUID (ParticleIterator &thismol)
 getCylUID samples the domain in cylinder coordinate bins. More...
 
std::string getPluginName () override
 return the name of the plugin More...
 
void accessAllCallbacks (const std::map< std::string, FunctionWrapper > &callbackMap) override
 
- Public Member Functions inherited from PluginBase
 PluginBase ()
 Subclasses should use their constructur to pass parameters (e.g. filenames)
 
virtual void beforeEventNewTimestep (ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, unsigned long simstep)
 Method will be called first thing in a new timestep. More...
 
virtual void beforeForces (ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, unsigned long simstep)
 Method beforeForces will be called before forcefields have been applied no alterations w.r.t. Forces shall be made here. More...
 
virtual void siteWiseForces (ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, unsigned long simstep)
 Method siteWiseForces will be called before forcefields have been applied alterations to sitewise forces and fullMolecule forces can be made here. More...
 
virtual void afterForces (ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, unsigned long simstep)
 Method afterForces will be called after forcefields have been applied no sitewise Forces can be applied here. More...
 
virtual void registerCallbacks (std::map< std::string, FunctionWrapper > &callbackMap)
 

Static Public Member Functions

static PluginBasecreateInstance ()
 

Public Attributes

SamplingInformation samplInfo
 

Detailed Description

SpatialProfile is a Plugin that is called like any other plugin derived from PluginBase. It handles all profiles in /plugins/profiles.
New profiles must be added via the plugins/ ProfileBase to comply with this Plugin.

x y z: Set Sampling Grid for all profiles. Output currently only readable for x = 1.
writefrequency: Write frequency for profile output. The accumulated profile data is written out every Nth step and the profiles reset.
timesteps/init: Number of timesteps to not record/output profiles at the beginning of the simulation.
timesteps/recording: During the recording period between writes, select every Nth step to be recorded for the profile.
outputprefix: Profile File output prefix.
profiles: Enable/disable the different profiles. If one is needed for another (Density for Velocity) it is enabled automatically. If none are specified here all profiles will be written.

<plugin name="SpatialProfile">
<mode>cylinder</mode> (cartesian)
<x>1</x>
<y>20</y>
<z>20</z>
<r>20</r>
<h>20</h>
<phi>1</phi>
<writefrequency>100</writefrequency>
<timesteps>
<init>1</init>
<recording>1</recording>
</timesteps>
<outputprefix>comparison</outputprefix>
<profiles>
<density>1</density>
<temperature>0</temperature>
<velocity>1</velocity>
<velocity3d>1</velocity>
<virial>1</virial>
</profiles>
</plugin>

Member Function Documentation

◆ accessAllCallbacks()

void SpatialProfile::accessAllCallbacks ( const std::map< std::string, FunctionWrapper > &  callbackMap)
inlineoverridevirtual

Save callbacks from the callbackMap locally. This allows a plugin to call functions from other plugins. Example syntax:

  • store a function that returns an unsigned long:
    std::function<unsigned long(void)> myFunction;
    myFunction = callbackMap.at("getSomeLocalValue").get<unsigned long>();
  • store a function that calls some function of another plugin with an input value (int):
    std::function<void(int)> myFunction;
    myFunction = callbackMap.at("doSth").get<void, int>();
    Parameters
    callbackMapGet callbacks from this map.

Reimplemented from PluginBase.

◆ endStep()

void SpatialProfile::endStep ( ParticleContainer particleContainer,
DomainDecompBase domainDecomp,
Domain domain,
unsigned long  simstep 
)
overridevirtual

Iterates over all molecules and passes them together with their Bin ID to the profiles for further processing. If the current timestep hits the writefrequency the profile writes/resets are triggered here. All of this only occurs after the initStatistics are passed.

Parameters
particleContainer
domainDecomp
domain
simstep

Implements PluginBase.

◆ finish()

void SpatialProfile::finish ( ParticleContainer particleContainer,
DomainDecompBase domainDecomp,
Domain domain 
)
inlineoverridevirtual

Method finish will be called at the end of the simulation.

This method will be called once at the end of the simulation. It can be used e.g. to closing output files or writing final statistics.

Parameters
particleContainerparticle container storing the (local) molecules
domainDecompdomain decomposition in use
domain

Implements PluginBase.

◆ getCartesianUID()

unsigned long SpatialProfile::getCartesianUID ( ParticleIterator thismol)

getCartesianUID samples the domain cartesian coordinate bins.

The calculation of uID has to be the same as used in the actual sampling profiles. E.g. ProfileBase / Child classes of Profile Base.

Parameters
thismol
Returns

◆ getCylUID()

long SpatialProfile::getCylUID ( ParticleIterator thismol)

getCylUID samples the domain in cylinder coordinate bins.

The sampling is done in linear increments both in the h- and phi-axis. In the r-axis, the sampling is done linearly in R^2 space, which means the distance between sampling bins R_i ^2 - R_i+1 ^2 is always the same. This results in smaller r distance between bins in outer regions. This has the benefit, that the volume of all sampling bins is equal, meaning the volume of each ring slice, no matter if sampled in the inner region of the cylinder or in the outer is the same. This results from V_segment = PI*h*(r_i+1 ^2 - r_i ^2) As said earlier, the R^2 difference terms are always the same if sampling is done linearly in R^2 - space. The h term is a linear sampling size in h-axis, so also a constant as is PI.

Parameters
thismol
Returns

◆ getPluginName()

std::string SpatialProfile::getPluginName ( )
inlineoverridevirtual

return the name of the plugin

Implements PluginBase.

◆ init()

void SpatialProfile::init ( ParticleContainer particleContainer,
DomainDecompBase domainDecomp,
Domain domain 
)
overridevirtual

Initialize Arrays needed for calculating the profiles. Also get reference to domain for specific quantities. All profiles will be reset here to 0 before starting the recording frame. The uIDs are can be calculated from the globalLength and the number of divisions specified for the Sampling grid.

Parameters
particleContainer
domainDecomp
domain

Implements PluginBase.

◆ readXML()

void SpatialProfile::readXML ( XMLfileUnits xmlconfig)
overridevirtual

Read in Information about write/record frequencies, Sampling Grid and which profiles are enabled. Also create needed profiles and initialize them. New Profiles need to be handled via the XML here as well.

Parameters
xmlconfig

Implements PluginBase.


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