Lagrangian Particle Code for The Simulation of 2D/3D Fluid Dynamics
 All Classes Files Functions Variables Typedefs Friends Pages
Public Member Functions | List of all members
Initializer Class Reference

This class initializes the simulation. More...

#include <initializer.h>

Public Member Functions

 Initializer (const std::string &inputfileName, const std::string &debugfileName="debug", bool ifDebug=false)
 Constructor. More...
 
 ~Initializer ()
 Destructor.
 
bool getIfDebug () const
 Getter function of the boolean value on whether to print debug information. More...
 
std::string getDebugfileName () const
 Getter function of the filename for printing debug information. More...
 
int getNumThreads () const
 Getter function of the specified number of threads. More...
 
double getStartTime () const
 Getter function of the specified simulation physical start time. More...
 
double getEndTime () const
 Getter function of the specified simulation physical end time. More...
 
double getWriteTimeInterval () const
 Getter function of the specified physical time interval between writes. More...
 
double getCFLCoeff () const
 Getter function of the specified CFL coefficient. More...
 
int getDimension () const
 Getter function of the specified dimension of simulation. More...
 
bool getRandomDirSplitOrder () const
 Getter function of the specified boolean value on whether to use random order of Strang splitting or not. More...
 
int getLPFOrder () const
 Getter function of the specified order of Local Polynomial Fitting. More...
 
int getEOSChoice () const
 Getter function of the specified choice of equation of state (eos) More...
 
double getInitParticleSpacing () const
 Getter function of the specified initial inter-particle spacing. More...
 
double getGravity () const
 Getter function of the specified gravity value. More...
 
bool getMovingBoxForGhostParticle () const
 Getter function of the specified boolean value on whether to update the bounding box of fluid objects. More...
 
bool getUseLimiter () const
 Getter function of the specified boolean value on whether to use limiter or not. More...
 
double getThresholdP () const
 Getter function of the specified threshold value on pressure if limiter is used. More...
 
std::size_t getMaxNeighbourNum () const
 Getter function of the specified maximum number of neighbours of a particle. More...
 
std::size_t getMaxNeighbourNumInOneDir () const
 Getter function of the specified maximum number of neighbours in one direction (eg. right-hand-side in the x-coordinate) of a particle. More...
 
std::size_t getNumRow2ndOrder () const
 Getter function of the specified minimum number of neighbours in one direction of a particle for using 2nd order local polynomial fitting to compute the one-sided spatial derivatives. More...
 
std::size_t getNumRow1stOrder () const
 Getter function of the specified minimum number of neighbours in one direction of a particle for using 1st order local polynomial fitting to compute the one-sided spatial derivatives. More...
 
std::size_t getNumCol2ndOrder () const
 Getter function of the theoretical minimum number of neighbours required in one direction of a particle for 2nd order local polynomial fitting for the computation of one-sided spatial derivatives. More...
 
std::size_t getNumCol1stOrder () const
 Getter function of the theoretical minimum number of neighbours required in one direction of a particle for using 1st order local polynomial fitting to compute the one-sided spatial derivatives. More...
 
double getNeiSearchRadius () const
 Getter function of the specified radius for neighbour search. More...
 
double getInvalidPressure () const
 Getter function of the specified maximum/minimum pressure value a particle can possibly attain. More...
 
double getInvalidVolume () const
 Getter function of the specified maximum/minimum volume value a particle can possibly attain. More...
 
int getTreeDepth () const
 Getter function of the specified tree depth for the octree neighbour search algorithm. More...
 
double getContactLength () const
 Getter function of the specified length such that if the distance between two particles coming from different fluid objects is less than this length, they are considered as "in contact". More...
 
std::size_t getCapacity () const
 Getter function of the specified array length for particle data arrays such as x, y, and z-coordinates, pressure, volume, and sound speeds. More...
 
std::size_t getFluidNum () const
 Getter function of the number of fluid particles initialized. More...
 
std::size_t getBoundaryNum () const
 Getter function of the number of boundary particles initialized. More...
 
std::size_t getFluidStartIndex () const
 Getter function of the start index of fluid particles in the particle data arrays. More...
 
std::size_t getBoundaryStartIndex () const
 Getter function of the start index of boundary particles in the particle data arrays. More...
 
std::size_t getGhostStartIndex () const
 Getter function of the start index of ghost particles in the particle arrays of the ParticleData class. More...
 
std::size_t getNumParticleWithinSearchRadius () const
 Getter function of the number of particles located inside the specified radius of neighbour search at the time of initialization. More...
 
double * getPositionX () const
 Getter function of the array of x-coordinates of the initialized particles. More...
 
double * getPositionY () const
 Getter function of the array of y-coordinates of the initialized particles. More...
 
double * getPositionZ () const
 Getter function of the array of z-coordinates of the initialized particles. More...
 
double * getVelocityU () const
 Getter function of the array of velocity in x-coordinate of the initialized particles. More...
 
double * getVelocityV () const
 Getter function of the array of velocity in y-coordinate of the initialized particles. More...
 
double * getVelocityW () const
 Getter function of the array of velocity in z-coordinate of the initialized particles. More...
 
double * getVolume () const
 Getter function of the array of volume of the initialized particles. More...
 
double * getPressure () const
 Getter function of the array of pressure of the initialized particles. More...
 
double * getSoundSpeed () const
 Getter function of the array of sound speed of the initialized particles. More...
 
int * getObjectTag () const
 Getter function of the array of "object tags" of the initialized particles. More...
 
EOSgetEOS () const
 Getter function of the pointer to an object in the EOS family. More...
 
const std::vector< BoundingBox * > & getFluidBoundingBox () const
 Getter function of the bounding boxes for the initialized fluid objects. More...
 
const std::vector< std::string > & getBoundaryObjTypes () const
 Getter function of the types of the initialized boundary objects. More...
 

Detailed Description

This class initializes the simulation.

The task of initialization of the simulation includes:

  1. Reading the input file
  2. Initializing the geometry of fluid objects
  3. Initializing the state of fluid objects
  4. Specifying some pre-determined parameters and calculate some parameters
Author
Chen, Hsin-Chiang (morri.nosp@m.sche.nosp@m.n2008.nosp@m.@gma.nosp@m.il.co.nosp@m.m)
Version
1.0
Date
2014/06/09

Created on: 2014/06/01

Constructor & Destructor Documentation

Initializer::Initializer ( const std::string &  inputfileName,
const std::string &  debugfileName = "debug",
bool  ifDebug = false 
)

Constructor.

  1. Reads the input file
  2. Initializes the geometry of fluid objects
  3. Initializes the state of fluid objects
  4. Specifies some pre-determined parameters and calculate some parameters

Member Function Documentation

std::size_t Initializer::getBoundaryNum ( ) const
inline

Getter function of the number of boundary particles initialized.

Parameters
None
Returns
The number of boundary particles initialized
const std::vector<std::string>& Initializer::getBoundaryObjTypes ( ) const
inline

Getter function of the types of the initialized boundary objects.

Parameters
None
Returns
Vector of strings of boundary object types
std::size_t Initializer::getBoundaryStartIndex ( ) const
inline

Getter function of the start index of boundary particles in the particle data arrays.

Parameters
None
Returns
The start index of boundary particles in the partical data arrays
std::size_t Initializer::getCapacity ( ) const
inline

Getter function of the specified array length for particle data arrays such as x, y, and z-coordinates, pressure, volume, and sound speeds.

Parameters
None
Returns
The specified array length for particle data arrays such as x, y, and z-coordinates, pressure, volume, and sound speeds
Note
Capacity is a number larger than the total number of all types of particles
double Initializer::getCFLCoeff ( ) const
inline

Getter function of the specified CFL coefficient.

Parameters
None
Returns
The specified CFL coefficient
double Initializer::getContactLength ( ) const
inline

Getter function of the specified length such that if the distance between two particles coming from different fluid objects is less than this length, they are considered as "in contact".

Parameters
None
Returns
The specified length such that if the distance between two particles coming from different fluid objects is less than this length, they are considered as "in contact"
Note
The length is only valid in simulations with more than one fluid object. If two particles are in contact, they can start to take neighbours from the other fluid object. The length is specified as a number less than the initial inter-particle spacing
std::string Initializer::getDebugfileName ( ) const
inline

Getter function of the filename for printing debug information.

Parameters
None
Returns
The filename for printing debug information
int Initializer::getDimension ( ) const
inline

Getter function of the specified dimension of simulation.

Parameters
None
Returns
The specified dimension of simulation
double Initializer::getEndTime ( ) const
inline

Getter function of the specified simulation physical end time.

Parameters
None
Returns
The specified simulation physical end time
EOS* Initializer::getEOS ( ) const
inline

Getter function of the pointer to an object in the EOS family.

Parameters
None
Returns
Pointer pointing to an object in the EOS family
Warning
The memory of the object pointed to by the pointer is on the heap. This memory will not be deleted but the ownership will be transfered to other classes. It is save to have multiple pointers to this object since this object does not modify its own data
int Initializer::getEOSChoice ( ) const
inline

Getter function of the specified choice of equation of state (eos)

Parameters
None
Returns
The specified specified choice of equation of state (eos)
const std::vector<BoundingBox*>& Initializer::getFluidBoundingBox ( ) const
inline

Getter function of the bounding boxes for the initialized fluid objects.

Parameters
None
Returns
Vector of pointers to BoundingBox type
std::size_t Initializer::getFluidNum ( ) const
inline

Getter function of the number of fluid particles initialized.

Parameters
None
Returns
The number of fluid particles initialized
std::size_t Initializer::getFluidStartIndex ( ) const
inline

Getter function of the start index of fluid particles in the particle data arrays.

Parameters
None
Returns
The start index of fluid particles in the particle data arrays
std::size_t Initializer::getGhostStartIndex ( ) const
inline

Getter function of the start index of ghost particles in the particle arrays of the ParticleData class.

Parameters
None
Returns
The start index of ghost particles in the particle arrays
double Initializer::getGravity ( ) const
inline

Getter function of the specified gravity value.

Parameters
None
Returns
The specified gravity value
bool Initializer::getIfDebug ( ) const
inline

Getter function of the boolean value on whether to print debug information.

Parameters
None
Returns
The boolean value on whether to print debug information
double Initializer::getInitParticleSpacing ( ) const
inline

Getter function of the specified initial inter-particle spacing.

Parameters
None
Returns
The specified initial inter-particle spacing
double Initializer::getInvalidPressure ( ) const
inline

Getter function of the specified maximum/minimum pressure value a particle can possibly attain.

Parameters
None
Returns
The specified maximum/minimum pressure value a particle can possibly attain
Note
If this value is exceeded certain actions, such as re-calculating spatial derivatives using a lower order of local polynomial fitting, needs to be carried to avoid the crash of the program
double Initializer::getInvalidVolume ( ) const
inline

Getter function of the specified maximum/minimum volume value a particle can possibly attain.

Parameters
None
Returns
The specified maximum/minimum volume value a particle can possibly attain
Note
If this value is exceeded certain actions, such as re-calculating spatial derivatives using a lower order of local polynomial fitting, needs to be carried to avoid the crash of the program
int Initializer::getLPFOrder ( ) const
inline

Getter function of the specified order of Local Polynomial Fitting.

Parameters
None
Returns
The specified order of Local Polynomial Fitting
std::size_t Initializer::getMaxNeighbourNum ( ) const
inline

Getter function of the specified maximum number of neighbours of a particle.

Parameters
None
Returns
The specified maximum number of neighbours of a particle
std::size_t Initializer::getMaxNeighbourNumInOneDir ( ) const
inline

Getter function of the specified maximum number of neighbours in one direction (eg. right-hand-side in the x-coordinate) of a particle.

Parameters
None
Returns
The specified maximum number of neighbours in one direction (eg. right-hand-side in the x-coordinate) of a particle
bool Initializer::getMovingBoxForGhostParticle ( ) const
inline

Getter function of the specified boolean value on whether to update the bounding box of fluid objects.

Parameters
None
Returns
The specified boolean value on whether to update the bounding box of fluid objects
double Initializer::getNeiSearchRadius ( ) const
inline

Getter function of the specified radius for neighbour search.

Parameters
None
Returns
The specified radius for neighbour search
std::size_t Initializer::getNumCol1stOrder ( ) const
inline

Getter function of the theoretical minimum number of neighbours required in one direction of a particle for using 1st order local polynomial fitting to compute the one-sided spatial derivatives.

Parameters
None
Returns
The theoretical minimum number of neighbours required in one direction of a particle for using 1st order local polynomial fitting to compute the one-sided spatial derivatives
std::size_t Initializer::getNumCol2ndOrder ( ) const
inline

Getter function of the theoretical minimum number of neighbours required in one direction of a particle for 2nd order local polynomial fitting for the computation of one-sided spatial derivatives.

Parameters
None
Returns
The theoretical minimum number of neighbours required in one direction of a particle for using 2nd order local polynomial fitting to compute the one-sided spatial derivatives
std::size_t Initializer::getNumParticleWithinSearchRadius ( ) const
inline

Getter function of the number of particles located inside the specified radius of neighbour search at the time of initialization.

Parameters
None
Returns
The number of particles located inside the specified radius of neighbour search at the time of initialization
Note
This number is used in the context of ghost particle selection
std::size_t Initializer::getNumRow1stOrder ( ) const
inline

Getter function of the specified minimum number of neighbours in one direction of a particle for using 1st order local polynomial fitting to compute the one-sided spatial derivatives.

Parameters
None
Returns
The specified minimum number of neighbours in one direction of a particle for using 1st order local polynomial fitting to compute the one-sided spatial derivatives
std::size_t Initializer::getNumRow2ndOrder ( ) const
inline

Getter function of the specified minimum number of neighbours in one direction of a particle for using 2nd order local polynomial fitting to compute the one-sided spatial derivatives.

Parameters
None
Returns
The specified minimum number of neighbours in one direction of a particle for using 2nd order local polynomial fitting to compute the one-sided spatial derivatives
int Initializer::getNumThreads ( ) const
inline

Getter function of the specified number of threads.

Parameters
None
Returns
The specified number of threads
int* Initializer::getObjectTag ( ) const
inline

Getter function of the array of "object tags" of the initialized particles.

Parameters
None
Returns
Pointer pointing to the array of "object tags" of the initialized particles
Note
The tag of a particle in a fluid object is the index of the fluid object (the index of fluid object is 1,2,...). The tag of a particle not in fluid object is 0
double* Initializer::getPositionX ( ) const
inline

Getter function of the array of x-coordinates of the initialized particles.

Parameters
None
Returns
Pointer pointing to the array of x-coordinates of the initialized particles
Warning
The array of x-coordinate is initialized on the heap in this class, and will be not deleted in the destructor of this class. The reason is that the ownership of this array will be transfered to the ParticleData class via this getter function. It is advised not to assign the ownership of this array to other classes
double* Initializer::getPositionY ( ) const
inline

Getter function of the array of y-coordinates of the initialized particles.

Parameters
None
Returns
Pointer pointing to the array of y-coordinates of the initialized particles
Warning
The array of x-coordinate is initialized on the heap in this class, and will be not deleted in the destructor of this class. The reason is that the ownership of this array will be transfered to the ParticleData class via this getter function. It is advised not to assign the ownership of this array to other classes
double* Initializer::getPositionZ ( ) const
inline

Getter function of the array of z-coordinates of the initialized particles.

Parameters
None
Returns
Pointer pointing to the array of z-coordinates of the initialized particles
Warning
The array of x-coordinate is initialized on the heap in this class, and will be not deleted in the destructor of this class. The reason is that the ownership of this array will be transfered to the ParticleData class via this getter function. It is advised not to assign the ownership of this array to other classes
double* Initializer::getPressure ( ) const
inline

Getter function of the array of pressure of the initialized particles.

Parameters
None
Returns
Pointer pointing to the array of pressure of the initialized particles
Warning
The array of pressure is initialized on the heap in this class, and will be not deleted in the destructor of this class. The reason is that the ownership of this array will be transfered to the ParticleData class via this getter function. It is advised not to assign the ownership of this array to other classes
bool Initializer::getRandomDirSplitOrder ( ) const
inline

Getter function of the specified boolean value on whether to use random order of Strang splitting or not.

Parameters
None
Returns
The specified boolean value on whether to use random order of Strang splitting or not
double* Initializer::getSoundSpeed ( ) const
inline

Getter function of the array of sound speed of the initialized particles.

Parameters
None
Returns
Pointer pointing to the array of sound speed of the initialized particles
Warning
The array of volume is initialized on the heap in this class, and will be not deleted in the destructor of this class. The reason is that the ownership of this array will be transfered to the ParticleData class via this getter function. It is advised not to assign the ownership of this array to other classes
double Initializer::getStartTime ( ) const
inline

Getter function of the specified simulation physical start time.

Parameters
None
Returns
The specified simulation physical start time specified
double Initializer::getThresholdP ( ) const
inline

Getter function of the specified threshold value on pressure if limiter is used.

Parameters
None
Returns
The specified threshold value on pressure if limiter is used
Note
We only have 1D limiter now
int Initializer::getTreeDepth ( ) const
inline

Getter function of the specified tree depth for the octree neighbour search algorithm.

Parameters
None
Returns
The specified tree depth for the octree neighbour search algorithm
bool Initializer::getUseLimiter ( ) const
inline

Getter function of the specified boolean value on whether to use limiter or not.

Parameters
None
Returns
The specified boolean value on whether to use limiter or not
Note
We only have 1D limiter now
double* Initializer::getVelocityU ( ) const
inline

Getter function of the array of velocity in x-coordinate of the initialized particles.

Parameters
None
Returns
Pointer pointing to the array of velocity in x-coordinate of the initialized particles
Warning
The array of velocity in x-coordinate is initialized on the heap in this class, and will be not deleted in the destructor of this class. The reason is that the ownership of this array will be transfered to the ParticleData class via this getter function. It is advised not to assign the ownership of this array to other classes
double* Initializer::getVelocityV ( ) const
inline

Getter function of the array of velocity in y-coordinate of the initialized particles.

Parameters
None
Returns
Pointer pointing to the array of velocity in y-coordinate of the initialized particles
Warning
The array of velocity in x-coordinate is initialized on the heap in this class, and will be not deleted in the destructor of this class. The reason is that the ownership of this array will be transfered to the ParticleData class via this getter function. It is advised not to assign the ownership of this array to other classes
double* Initializer::getVelocityW ( ) const
inline

Getter function of the array of velocity in z-coordinate of the initialized particles.

Parameters
None
Returns
Pointer pointing to the array of velocity in z-coordinate of the initialized particles
Warning
The array of velocity in x-coordinate is initialized on the heap in this class, and will be not deleted in the destructor of this class. The reason is that the ownership of this array will be transfered to the ParticleData class via this getter function. It is advised not to assign the ownership of this array to other classes
double* Initializer::getVolume ( ) const
inline

Getter function of the array of volume of the initialized particles.

Parameters
None
Returns
Pointer pointing to the array of volume of the initialized particles
Warning
The array of volume is initialized on the heap in this class, and will be not deleted in the destructor of this class. The reason is that the ownership of this array will be transfered to the ParticleData class via this getter function. It is advised not to assign the ownership of this array to other classes
double Initializer::getWriteTimeInterval ( ) const
inline

Getter function of the specified physical time interval between writes.

Parameters
None
Returns
The specified physical time interval between writes

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