MolSim
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
FlowSimulationAnalyzer Class Reference

Class modeling and analyzer that computes statistics about the state of a nano-scale flow simulation. More...

#include <FlowSimulationAnalyzer.h>

Public Member Functions

 FlowSimulationAnalyzer (ParticleContainer &particles)
 Constructs an uninitialized FlowSimulationAnalyzer.
 
 FlowSimulationAnalyzer (ParticleContainer &particles, int binNumber, double leftWallPosX, double rightWallPosX, int n_analyzer, const std::string &dirname="statistics", const std::string &basename="MD_csv")
 Creates and initializes a FlowSimulationAnalyzer.
 
void initialize (int binNumber, double leftWallPosX, double rightWallPosX, int n_analyzer, const std::string &dirname="statistics", const std::string &basename="MD_csv")
 Initializes the current object with the given parameters.
 
void calculateDensitiesAndVelocities ()
 Computes the densities and average velocities of the particles resided in each bin.
 
void analyzeFlow (int currentStep)
 The main function that analyzes the simulation.
 
int writeToCSV (int fileNumber)
 Writes the gathered information from the density and velocity vectors into the corresponding .csv file as statistics based on the simulation's state.
 
int getBinNumber () const
 Gets the bin number of the analyzer.
 
double getLeftWallPosX () const
 Gets the X coordinate of the left wall of the simulation.
 
double getRightWallPosX () const
 Gets the X coordinate of the right wall of the simulation.
 
double getBinSize () const
 Gets the size of the bins used in the computation of statistics.
 
int getFrequency () const
 Gets the output frequency.
 
const std::string & getDirname () const
 Gets the name of the output directory.
 
ParticleContainergetParticles () const
 Gets a reference to the analyzed ParticleContainer.
 
const std::vector< double > & getDensities () const
 Gets the vector containing the number of particles in each bin (const).
 
const std::vector< double > & getVelocities () const
 Gets the vector containing the the average velocities of the particles from each bin (const).
 

Private Attributes

ParticleContainerparticles
 A reference to the Particle system.
 
int binNumber
 The number of bins analyzed.
 
double leftWallPosX
 The X coordinate of the left wall of the simulation.
 
double rightWallPosX
 The X coordinate of the right wall of the simulation.
 
double binSize
 The size of each bin analyzed.
 
std::vector< double > densities
 The vector corresponding to the number of particles in each bin.
 
std::vector< double > velocities
 The vector corresponding to the average velocity on the y axis of the particles resided in this bin.
 
int n_analyzer {1000}
 The number of simulation iterations after which to apply the Analyzer functionality (default: 1000).
 
std::string dirname {"statistics"}
 The name of the directory containing the generated .csv files (default: "statistics").
 
std::string basename {"MD_csv"}
 The base name of the generated .csv files (default: "MD_csv").
 

Detailed Description

Class modeling and analyzer that computes statistics about the state of a nano-scale flow simulation.

Constructor & Destructor Documentation

◆ FlowSimulationAnalyzer() [1/2]

FlowSimulationAnalyzer::FlowSimulationAnalyzer ( ParticleContainer particles)
explicit

Constructs an uninitialized FlowSimulationAnalyzer.

Parameters
particlesA reference to the Particle system.

◆ FlowSimulationAnalyzer() [2/2]

FlowSimulationAnalyzer::FlowSimulationAnalyzer ( ParticleContainer particles,
int  binNumber,
double  leftWallPosX,
double  rightWallPosX,
int  n_analyzer,
const std::string &  dirname = "statistics",
const std::string &  basename = "MD_csv" 
)

Creates and initializes a FlowSimulationAnalyzer.

Parameters
particlesA reference to the Particle system.
binNumberThe number of bins analyzed.
leftWallPosXThe X coordinate of the left wall of the simulation.
rightWallPosXThe X coordinate of the right wall of the simulation.
n_analyzerThe number of simulation iterations after which to apply the analyzer functionality.
dirnameThe name of the directory containing the generated .csv files.
basenameThe base name of the generated .csv files.

Member Function Documentation

◆ analyzeFlow()

void FlowSimulationAnalyzer::analyzeFlow ( int  currentStep)

The main function that analyzes the simulation.

Parameters
currentStepThe current iteration of the simulation, determines whether the Analyzer is applied or not.

◆ calculateDensitiesAndVelocities()

void FlowSimulationAnalyzer::calculateDensitiesAndVelocities ( )

Computes the densities and average velocities of the particles resided in each bin.

The function iterates over each bin and looks at each particle in order to modify the density and velocity vectors accordingly.

◆ getBinNumber()

int FlowSimulationAnalyzer::getBinNumber ( ) const

Gets the bin number of the analyzer.

Returns
The bin number of the analyzer.

◆ getBinSize()

double FlowSimulationAnalyzer::getBinSize ( ) const

Gets the size of the bins used in the computation of statistics.

Returns
The size of the bins used in the computation of statistics.

◆ getDensities()

const std::vector< double > & FlowSimulationAnalyzer::getDensities ( ) const

Gets the vector containing the number of particles in each bin (const).

Returns
The const vector containing the number of particles in each bin.

◆ getDirname()

const std::string & FlowSimulationAnalyzer::getDirname ( ) const

Gets the name of the output directory.

Returns
The name of the output directory.

◆ getFrequency()

int FlowSimulationAnalyzer::getFrequency ( ) const

Gets the output frequency.

Returns
The output frequency.

◆ getLeftWallPosX()

double FlowSimulationAnalyzer::getLeftWallPosX ( ) const

Gets the X coordinate of the left wall of the simulation.

Returns
The X coordinate of the left wall of the simulation.

◆ getParticles()

ParticleContainer & FlowSimulationAnalyzer::getParticles ( ) const

Gets a reference to the analyzed ParticleContainer.

Returns
A reference to the analyzed ParticleContainer.

◆ getRightWallPosX()

double FlowSimulationAnalyzer::getRightWallPosX ( ) const

Gets the X coordinate of the right wall of the simulation.

Returns
The X coordinate of the right wall of the simulation.

◆ getVelocities()

const std::vector< double > & FlowSimulationAnalyzer::getVelocities ( ) const

Gets the vector containing the the average velocities of the particles from each bin (const).

Returns
The const vector containing the the average velocities of the particles from each bin.

◆ initialize()

void FlowSimulationAnalyzer::initialize ( int  binNumber,
double  leftWallPosX,
double  rightWallPosX,
int  n_analyzer,
const std::string &  dirname = "statistics",
const std::string &  basename = "MD_csv" 
)

Initializes the current object with the given parameters.

Parameters
binNumberThe number of bins analyzed.
leftWallPosXThe X coordinate of the left wall of the simulation.
rightWallPosXThe X coordinate of the right wall of the simulation.
n_analyzerThe number of simulation iterations after which to apply the analyzer functionality.
dirnameThe name of the directory containing the generated .csv files.
basenameThe base name of the generated .csv files.

◆ writeToCSV()

int FlowSimulationAnalyzer::writeToCSV ( int  fileNumber)

Writes the gathered information from the density and velocity vectors into the corresponding .csv file as statistics based on the simulation's state.

Parameters
fileNumberThe iteration number to be appended to the filename.
Returns
EXIT_SUCCESS if the file was successfully written, EXIT_FAILURE otherwise.

Member Data Documentation

◆ basename

std::string FlowSimulationAnalyzer::basename {"MD_csv"}
private

The base name of the generated .csv files (default: "MD_csv").

During initialization using an XML input, if the substring "vtk" or "xyz" is found in the base name of the output files, it will automatically be replaced with "csv" and used as the base name for the .csv files.

◆ binNumber

int FlowSimulationAnalyzer::binNumber
private

The number of bins analyzed.

◆ binSize

double FlowSimulationAnalyzer::binSize
private

The size of each bin analyzed.

◆ densities

std::vector<double> FlowSimulationAnalyzer::densities
private

The vector corresponding to the number of particles in each bin.

◆ dirname

std::string FlowSimulationAnalyzer::dirname {"statistics"}
private

The name of the directory containing the generated .csv files (default: "statistics").

◆ leftWallPosX

double FlowSimulationAnalyzer::leftWallPosX
private

The X coordinate of the left wall of the simulation.

◆ n_analyzer

int FlowSimulationAnalyzer::n_analyzer {1000}
private

The number of simulation iterations after which to apply the Analyzer functionality (default: 1000).

◆ particles

ParticleContainer& FlowSimulationAnalyzer::particles
private

A reference to the Particle system.

◆ rightWallPosX

double FlowSimulationAnalyzer::rightWallPosX
private

The X coordinate of the right wall of the simulation.

◆ velocities

std::vector<double> FlowSimulationAnalyzer::velocities
private

The vector corresponding to the average velocity on the y axis of the particles resided in this bin.


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