MercuryDPM
Beta
|
Classes | |
class | KAndDisp |
return type specifically for fuctions returning k and disp at once More... | |
class | KAndDispAndKtAndDispt |
return type specifically for fuctions returning k, disp, kt, dispt at once More... | |
Functions | |
MERCURY_DEPRECATED KAndDisp | computeKAndDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass (Mdouble tc, Mdouble r, Mdouble mass) |
Set disp and k such that is matches a given collision time tc and restitution coefficient r for a collision of effective/reduced mass m. More... | |
MERCURY_DEPRECATED Mdouble | computeCollisionTimeFromKAndDispAndEffectiveMass (Mdouble k, Mdouble disp, Mdouble mass) |
Calculates the collision time for a given stiffness, dissipation, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeRestitutionCoefficientFromKAndDispAndEffectiveMass (Mdouble k, Mdouble disp, Mdouble mass) |
Calculates the restitution coefficient time for a given stiffness, dissipation, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeDispFromKAndRestitutionCoefficientAndEffectiveMass (Mdouble k, Mdouble r, Mdouble mass) |
Calculates the dissipation for a given stiffness, restitution coefficient, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeCollisionTimeFromKAndRestitutionCoefficientAndEffectiveMass (Mdouble k, Mdouble r, Mdouble mass) |
Calculates the collision time for a given stiffness, restitution coefficient, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeDispFromKAndCollisionTimeAndEffectiveMass (Mdouble k, Mdouble tc, Mdouble mass) |
Calculates the dissipation for a given stiffness, collision time, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeRestitutionCoefficientFromKAndCollisionTimeAndEffectiveMass (Mdouble k, Mdouble tc, Mdouble mass) |
Calculates the restitution coefficient for a given stiffness, collision time, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass (Mdouble tc, Mdouble r, Mdouble mass) |
Calculates the dissipation for a given collision time, restitution coefficient, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeKFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass (Mdouble tc, Mdouble r, Mdouble mass) |
Calculates the stiffness for a given collision time, restitution coefficient, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeKFromCollisionTimeAndDispAndEffectiveMass (Mdouble tc, Mdouble disp, Mdouble mass) |
Calculates the stiffness for a given collision time, dissipation, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeRestitutionCoefficientFromCollisionTimeAndDispAndEffectiveMass (Mdouble tc, Mdouble disp, Mdouble mass) |
Calculates the resitution coefficient for a given collision time, dissipation, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeKFromDispAndRestitutionCoefficientAndEffectiveMass (Mdouble disp, Mdouble r, Mdouble mass) |
Calculates the stiffness for a given dissipation, restitution coefficient, and effective mass. More... | |
MERCURY_DEPRECATED Mdouble | computeCollisionTimeFromDispAndRestitutionCoefficientAndEffectiveMass (Mdouble disp, Mdouble r, Mdouble mass) |
Calculates the collision time for a given dissipation, restitution coefficient, and effective mass. More... | |
MERCURY_DEPRECATED KAndDispAndKtAndDispt | computeDisptFromCollisionTimeAndRestitutionCoefficientAndTangentialRestitutionCoefficientAndEffectiveMass (Mdouble tc, Mdouble r, Mdouble beta, Mdouble mass) |
Set disp, k, dispt and kt such that is matches a given collision time tc and a normal andtangential restitution coefficient r, beta for a collision of effective/reduced mass m. From Deen...Kuipers2006, eq. 43 and 30. More... | |
MERCURY_DEPRECATED Mdouble | getMaximumVelocity (Mdouble k, Mdouble disp, Mdouble radius, Mdouble mass) |
Calculates the maximum relative velocity allowed for a normal collision of two particles of radius r and particle mass m (for higher velocities particles could pass through each other) More... | |
unsigned int | getSaveCountFromNumberOfSavesAndTimeMaxAndTimestep (unsigned int numberOfSaves, Mdouble timeMax, Mdouble timestep) |
Returns the correct saveCount if the total number of saves, the final time and the time step is known. More... | |
void | getLineFromStringStream (std::istream &in, std::stringstream &out) |
Reads a line from one stringstream into another, and prepares the latter for reading in. More... | |
bool | writeToFile (std::string filename, std::string filecontent) |
Writes a string to a file. More... | |
bool | fileExists (std::string strFilename) |
Function to check if a file exists, is used to check if a run has already need done. More... | |
bool | openFile (std::fstream &file, std::string filename, std::fstream::openmode mode) |
Provides a simple interface for opening a file. More... | |
Mdouble | getEffectiveMass (Mdouble mass0, Mdouble mass1) |
Calculates the effective mass of a particle pair, i.e. half the harmonic mean of two particle masses. More... | |
Mdouble helpers::computeCollisionTimeFromDispAndRestitutionCoefficientAndEffectiveMass | ( | Mdouble | disp, |
Mdouble | r, | ||
Mdouble | mass | ||
) |
Calculates the collision time for a given dissipation, restitution coefficient, and effective mass.
Definition at line 281 of file Helpers.cc.
Mdouble helpers::computeCollisionTimeFromKAndDispAndEffectiveMass | ( | Mdouble | k, |
Mdouble | disp, | ||
Mdouble | mass | ||
) |
Calculates the collision time for a given stiffness, dissipation, and effective mass.
Definition at line 41 of file Helpers.cc.
References constants::pi, and mathsFunc::square().
Referenced by ChuteBottom::makeRoughBottom().
Mdouble helpers::computeCollisionTimeFromKAndRestitutionCoefficientAndEffectiveMass | ( | Mdouble | k, |
Mdouble | r, | ||
Mdouble | mass | ||
) |
Calculates the collision time for a given stiffness, restitution coefficient, and effective mass.
Definition at line 111 of file Helpers.cc.
References constants::sqr_pi, and mathsFunc::square().
Mdouble helpers::computeDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass | ( | Mdouble | tc, |
Mdouble | r, | ||
Mdouble | mass | ||
) |
Calculates the dissipation for a given collision time, restitution coefficient, and effective mass.
Definition at line 181 of file Helpers.cc.
Referenced by computeKAndDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass().
Mdouble helpers::computeDispFromKAndCollisionTimeAndEffectiveMass | ( | Mdouble | k, |
Mdouble | tc, | ||
Mdouble | mass | ||
) |
Calculates the dissipation for a given stiffness, collision time, and effective mass.
Definition at line 131 of file Helpers.cc.
References constants::sqr_pi, and mathsFunc::square().
Mdouble helpers::computeDispFromKAndRestitutionCoefficientAndEffectiveMass | ( | Mdouble | k, |
Mdouble | r, | ||
Mdouble | mass | ||
) |
Calculates the dissipation for a given stiffness, restitution coefficient, and effective mass.
Definition at line 91 of file Helpers.cc.
References constants::sqr_pi, and mathsFunc::square().
helpers::KAndDispAndKtAndDispt helpers::computeDisptFromCollisionTimeAndRestitutionCoefficientAndTangentialRestitutionCoefficientAndEffectiveMass | ( | Mdouble | tc, |
Mdouble | r, | ||
Mdouble | beta, | ||
Mdouble | mass | ||
) |
Set disp, k, dispt and kt such that is matches a given collision time tc and a normal andtangential restitution coefficient r, beta for a collision of effective/reduced mass m. From Deen...Kuipers2006, eq. 43 and 30.
from Deen...Kuipers2006, eq. 43 and 30
Definition at line 302 of file Helpers.cc.
References helpers::KAndDispAndKtAndDispt::disp, helpers::KAndDispAndKtAndDispt::dispt, helpers::KAndDispAndKtAndDispt::k, helpers::KAndDispAndKtAndDispt::kt, constants::pi, and mathsFunc::square().
helpers::KAndDisp helpers::computeKAndDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass | ( | Mdouble | tc, |
Mdouble | r, | ||
Mdouble | mass | ||
) |
Set disp and k such that is matches a given collision time tc and restitution coefficient r for a collision of effective/reduced mass m.
Definition at line 33 of file Helpers.cc.
References computeDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass(), computeKFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass(), helpers::KAndDisp::disp, and helpers::KAndDisp::k.
Mdouble helpers::computeKFromCollisionTimeAndDispAndEffectiveMass | ( | Mdouble | tc, |
Mdouble | disp, | ||
Mdouble | mass | ||
) |
Calculates the stiffness for a given collision time, dissipation, and effective mass.
Definition at line 221 of file Helpers.cc.
References constants::sqr_pi, and mathsFunc::square().
Mdouble helpers::computeKFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass | ( | Mdouble | tc, |
Mdouble | r, | ||
Mdouble | mass | ||
) |
Calculates the stiffness for a given collision time, restitution coefficient, and effective mass.
Definition at line 201 of file Helpers.cc.
References constants::pi, and mathsFunc::square().
Referenced by computeKAndDispFromCollisionTimeAndRestitutionCoefficientAndEffectiveMass().
Mdouble helpers::computeKFromDispAndRestitutionCoefficientAndEffectiveMass | ( | Mdouble | disp, |
Mdouble | r, | ||
Mdouble | mass | ||
) |
Calculates the stiffness for a given dissipation, restitution coefficient, and effective mass.
Definition at line 261 of file Helpers.cc.
References constants::sqr_pi, and mathsFunc::square().
Mdouble helpers::computeRestitutionCoefficientFromCollisionTimeAndDispAndEffectiveMass | ( | Mdouble | tc, |
Mdouble | disp, | ||
Mdouble | mass | ||
) |
Calculates the resitution coefficient for a given collision time, dissipation, and effective mass.
Definition at line 241 of file Helpers.cc.
Mdouble helpers::computeRestitutionCoefficientFromKAndCollisionTimeAndEffectiveMass | ( | Mdouble | k, |
Mdouble | tc, | ||
Mdouble | mass | ||
) |
Calculates the restitution coefficient for a given stiffness, collision time, and effective mass.
Definition at line 156 of file Helpers.cc.
References constants::sqr_pi, and mathsFunc::square().
Mdouble helpers::computeRestitutionCoefficientFromKAndDispAndEffectiveMass | ( | Mdouble | k, |
Mdouble | disp, | ||
Mdouble | mass | ||
) |
Calculates the restitution coefficient time for a given stiffness, dissipation, and effective mass.
Definition at line 66 of file Helpers.cc.
References constants::pi, and mathsFunc::square().
bool helpers::fileExists | ( | std::string | strFilename | ) |
Function to check if a file exists, is used to check if a run has already need done.
This is a FileExist routine, which is used to test if a run have already need preformed, allows me to plug holes in parm studies.
Definition at line 429 of file Helpers.cc.
Calculates the effective mass of a particle pair, i.e. half the harmonic mean of two particle masses.
The effective mass is an important parameter in a collision. E.g. the collision time and the restitution coefficient are functions of the effective mass.
[in] | mass0 | The mass of the first particle. |
[in] | mass1 | The mass of the second particle. |
Definition at line 482 of file Helpers.cc.
void helpers::getLineFromStringStream | ( | std::istream & | in, |
std::stringstream & | out | ||
) |
Reads a line from one stringstream into another, and prepares the latter for reading in.
This function is used to avoid errors from reading in old or manually modified restart files. Instead of reading variable by variable directly from the restart stringstream, a full line is read first, from which the variables are read. Thus, if a line has the wrong number of arguments, it might affect the reading of the current line, but correctly reads the next line.
Example of usage:
std::stringstream line(std::stringstream::in | std::stringstream::out); std::stringstream is = restartFile.getFStream(); helpers::getLineFromStringStream(is, line); std::string dummy; line >> dummy;
[in] | in | the stringstream from which a line is read out should be initialized as std::stringstream(std::stringstream::out) |
[out] | out | the stringstream into which the line is read; should be initialized as std::stringstream(std::stringstream::in | std::stringstream::out) |
Definition at line 389 of file Helpers.cc.
Referenced by MercuryBase::read(), BaseHandler< T >::read(), DPMBase::read(), SpeciesHandler::readObject(), InteractionHandler::readObject(), SpeciesHandler::readOldObject(), BoundaryHandler::readOldObject(), WallHandler::readOldObject(), and ParticleHandler::readOldObject().
Calculates the maximum relative velocity allowed for a normal collision of two particles of radius r and particle mass m (for higher velocities particles could pass through each other)
Definition at line 315 of file Helpers.cc.
References mathsFunc::square().
unsigned int helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimestep | ( | unsigned int | numberOfSaves, |
Mdouble | timeMax, | ||
Mdouble | timestep | ||
) |
Returns the correct saveCount if the total number of saves, the final time and the time step is known.
MercuryDPM uses the DPMBase::setSaveCount to determine how often output is written. However, if the user wants to set the total number of saves instead of the saveCount, he can use this function to calculate the correct saveCount, assuming that the final time and the mean time step is known.
Example of use:
setSaveCount(helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimestep(numberOfSaves, getTimeMax(), getTimeStep()));
[in] | numberOfSaves | the total number of output files the user wants at the end of the simulation. |
[in] | timeMax | the final time of the simulation |
[in] | timestep | the mean time step used during the simulation |
Definition at line 343 of file Helpers.cc.
bool helpers::openFile | ( | std::fstream & | file, |
std::string | filename, | ||
std::fstream::openmode | mode | ||
) |
Provides a simple interface for opening a file.
Provides a simple interface for opening a file, in order to avoid that the user has to learn the syntax for opening a file.
[out] | file | The std::fstream object that the user can write to. |
[in] | filename | The name of the file. |
[in] | mode | The openmode of the file, typically std::fstream::out or std::fstream::in. |
Definition at line 466 of file Helpers.cc.
bool helpers::writeToFile | ( | std::string | filename, |
std::string | filecontent | ||
) |
Writes a string to a file.
Provides a simple interface for writing a string to a file. This function is mainly used to create ini or restart file that the code later reads back in.
Example of usage:
helpers::writeToFile("RestartUnitTest.ini", "1 0 0 0 0 1 1 1\n" "0.5 0.5 0 0 0 0.5 0 0 0 0 0 0 0 0\n");
[in] | filename | the name of the file |
[in] | filecontent | the content |
Definition at line 411 of file Helpers.cc.