cuIBM
A GPU-based Immersed Boundary Method code
|
Contains functions related to I/O tasks. More...
Functions | |
std::vector< std::string > & | split (const std::string &s, char delim, std::vector< std::string > &elems) |
Splits a string given a delimiter. More... | |
std::vector< std::string > | split (const std::string &s, char delim) |
Splits a string given a delimiter. More... | |
void | readInputs (int argc, char **argv, parameterDB &DB, domain &D) |
Reads data inputs from the command-line and the simulation files. More... | |
void | initialiseDefaultDB (parameterDB &DB) |
Initializes the database with default values. More... | |
void | commandLineParse1 (int argc, char **argv, parameterDB &DB) |
Parses the command-line to get the case folder name and the device number. More... | |
void | commandLineParse2 (int argc, char **argv, parameterDB &DB) |
Overwrites parameters with additional arguments of the command-line. More... | |
std::string | stringFromPreconditionerType (preconditionerType s) |
Converts a preconditionerType to a std::string . More... | |
std::string | stringFromTimeScheme (timeScheme s) |
Converts a timeScheme to a std::string . More... | |
void | printSimulationInfo (parameterDB &DB, domain &D) |
Prints the parameters of the simulation. More... | |
void | printTimingInfo (Logger &logger) |
Prints the time spent to execute tasks. More... | |
void | writeGrid (std::string &caseFolder, domain &D) |
Writes grid-points coordinates into the file grid. More... | |
template<> | |
void | writeData< vecH > (std::string &caseFolder, int n, vecH &q, vecH &lambda, domain &D) |
Writes numerical data at a given time-step (on the host). More... | |
template<> | |
void | writeData< vecD > (std::string &caseFolder, int n, vecD &q, vecD &lambda, domain &D) |
Writes numerical data at a given time-step (on the device). More... | |
void | readData (std::string &caseFolder, int timeStep, real *x, std::string name) |
Reads numerical data at a given time-step. More... | |
void | printDeviceMemoryUsage (std::string label) |
Prints device memory usage. More... | |
void | parseDomainFile (std::string &domFile, domain &D) |
Parses the domain file and generates the computational grid. More... | |
void | parseFlowFile (std::string &flowFile, parameterDB &DB) |
Parses the flow file and stores the parameters in the database. More... | |
void | parseSimulationFile (std::string &simFile, parameterDB &DB) |
Parses simParams.yaml and stores the simulation parameters. More... | |
void | parseBodiesFile (std::string &bodiesFile, parameterDB &DB) |
Parses the bodies.yaml file and stores information about the immersed bodies. More... | |
template<typename Vector > | |
void | writeData (std::string &caseFolder, int n, Vector &q, Vector &lambda, domain &D) |
void | parseBodiesNode (const YAML::Node &node, body &Body, parameterDB &DB) |
Overloads the operator >>. Stores information about an immersed body. More... | |
void | parseDomain (const YAML::Node &node, domain &D) |
Gets information from the parsed domain file. More... | |
boundary | boundaryFromString (std::string s) |
Converts a string to a boundary location type. More... | |
bcType | bcTypeFromString (std::string s) |
Converts string to a boundary condition type. More... | |
void | parseFlow (const YAML::Node &node, parameterDB &DB) |
Fills the database with the flow parameters. More... | |
timeScheme | timeSchemeFromString (std::string s) |
Converts a string to a time-integration scheme type. More... | |
preconditionerType | preconditionerTypeFromString (std::string s) |
Converts a string to a preconditioner type. More... | |
ibmScheme | ibmSchemeFromString (std::string s) |
Converts a string to an IBM scheme. More... | |
interpolationType | interpolationTypeFromString (std::string s) |
Converts a string to a interpolation type. More... | |
void | parseSimulation (const YAML::Node &node, parameterDB &DB) |
Fills the database with the simulation parameters. More... | |
Contains functions related to I/O tasks.
bcType io::bcTypeFromString | ( | std::string | s | ) |
Converts string to a boundary condition type.
s | the string that describes the condition to impose on the boundary |
Definition at line 53 of file parseFlowFile.cu.
References CONVECTIVE, DIRICHLET, NEUMANN, PERIODIC, and SPECIAL.
Referenced by parseFlow().
boundary io::boundaryFromString | ( | std::string | s | ) |
Converts a string to a boundary location type.
s | the string that describes the location of the boundary |
Definition at line 28 of file parseFlowFile.cu.
References XMINUS, XPLUS, YMINUS, and YPLUS.
Referenced by parseFlow().
void io::commandLineParse1 | ( | int | argc, |
char ** | argv, | ||
parameterDB & | DB | ||
) |
Parses the command-line to get the case folder name and the device number.
argc | number of arguments in the command-line |
argv | arguments of the command-line |
DB | database that contains all the simulation parameters |
Definition at line 186 of file io.cu.
Referenced by readInputs().
void io::commandLineParse2 | ( | int | argc, |
char ** | argv, | ||
parameterDB & | DB | ||
) |
Overwrites parameters with additional arguments of the command-line.
argc | number of arguments in the command-line |
argv | arguments of the command-line |
DB | database that contains all the simulation parameters |
Definition at line 214 of file io.cu.
References CONSTANT, DF_IMPROVED, DF_MODIFIED, DIFFUSION, DIRECT_FORCING, FADLUN_ET_AL, FEA_MODIFIED, LINEAR, NAVIER_STOKES, QUADRATIC, and TAIRA_COLONIUS.
Referenced by readInputs().
ibmScheme io::ibmSchemeFromString | ( | std::string | s | ) |
Converts a string to an IBM scheme.
s | the string that describes the IBM scheme |
Definition at line 81 of file parseSimulationFile.cu.
References DF_IMPROVED, DF_MODIFIED, DIFFUSION, DIRECT_FORCING, FADLUN_ET_AL, FEA_MODIFIED, NAVIER_STOKES, SAIKI_BIRINGEN, and TAIRA_COLONIUS.
Referenced by parseSimulation().
void io::initialiseDefaultDB | ( | parameterDB & | DB | ) |
Initializes the database with default values.
DB | database that contains all the simulation parameters |
Definition at line 121 of file io.cu.
References DIAGONAL, EULER_EXPLICIT, EULER_IMPLICIT, LINEAR, and TAIRA_COLONIUS.
Referenced by readInputs().
interpolationType io::interpolationTypeFromString | ( | std::string | s | ) |
Converts a string to a interpolation type.
s | the string that describes the type of interpolation |
Definition at line 116 of file parseSimulationFile.cu.
References CONSTANT, LINEAR, and QUADRATIC.
Referenced by parseSimulation().
void io::parseBodiesFile | ( | std::string & | bodiesFile, |
parameterDB & | DB | ||
) |
Parses the bodies.yaml file and stores information about the immersed bodies.
DB | the database that contains the simulation parameters |
Definition at line 117 of file parseBodiesFile.cu.
References NAVIER_STOKES, parseBodiesNode(), and body::reset().
Referenced by readInputs().
void io::parseBodiesNode | ( | const YAML::Node & | node, |
body & | Body, | ||
parameterDB & | DB | ||
) |
Overloads the operator >>. Stores information about an immersed body.
node | the parsed file |
Body | instance of the class body to be filled |
DB | database with parameters of the simulation |
Definition at line 29 of file parseBodiesFile.cu.
References body::moving, body::numPoints, body::omega, body::pitchOscillation, body::Theta, body::Theta0, body::velocity, body::X, body::X0, body::Xc, body::Xc0, body::xOscillation, body::Y, and body::yOscillation.
Referenced by parseBodiesFile().
void io::parseDomain | ( | const YAML::Node & | node, |
domain & | D | ||
) |
Gets information from the parsed domain file.
node | the parsed file |
D | instance of the class domain to be filled |
Definition at line 27 of file parseDomainFile.cu.
References domain::dx, domain::dxD, domain::dy, domain::dyD, domain::nx, domain::ny, domain::x, domain::xD, domain::y, and domain::yD.
Referenced by parseDomainFile().
void io::parseDomainFile | ( | std::string & | domFile, |
domain & | D | ||
) |
Parses the domain file and generates the computational grid.
domFile | the file that contains information about the computational grid |
D | instance of the class domain that will be filled with information about the computational grid |
Definition at line 135 of file parseDomainFile.cu.
References domain::nx, domain::ny, parseDomain(), domain::x, domain::xu, domain::xv, domain::y, domain::yu, and domain::yv.
Referenced by readInputs().
void io::parseFlow | ( | const YAML::Node & | node, |
parameterDB & | DB | ||
) |
Fills the database with the flow parameters.
node | the parsed file |
DB | the database to be filled |
Definition at line 79 of file parseFlowFile.cu.
References bcTypeFromString(), and boundaryFromString().
Referenced by parseFlowFile().
void io::parseFlowFile | ( | std::string & | flowFile, |
parameterDB & | DB | ||
) |
Parses the flow file and stores the parameters in the database.
flowFile | the file that contains information about the flow |
DB | the database that will be filled |
Definition at line 113 of file parseFlowFile.cu.
References parseFlow().
Referenced by readInputs().
void io::parseSimulation | ( | const YAML::Node & | node, |
parameterDB & | DB | ||
) |
Fills the database with the simulation parameters.
node | the parsed file |
DB | database that contains the simulation parameters |
Definition at line 138 of file parseSimulationFile.cu.
References ibmSchemeFromString(), interpolationTypeFromString(), preconditionerTypeFromString(), and timeSchemeFromString().
Referenced by parseSimulationFile().
void io::parseSimulationFile | ( | std::string & | simFile, |
parameterDB & | DB | ||
) |
Parses simParams.yaml and stores the simulation parameters.
simFile | the file that contains the simulation parameters |
DB | the database that will be filled |
Definition at line 180 of file parseSimulationFile.cu.
References parseSimulation().
Referenced by readInputs().
preconditionerType io::preconditionerTypeFromString | ( | std::string | s | ) |
Converts a string to a preconditioner type.
s | the string that describes the preconditioner |
Definition at line 56 of file parseSimulationFile.cu.
References AINV, DIAGONAL, NONE, and SMOOTHED_AGGREGATION.
Referenced by parseSimulation().
void io::printDeviceMemoryUsage | ( | std::string | label | ) |
void io::printSimulationInfo | ( | parameterDB & | DB, |
domain & | D | ||
) |
Prints the parameters of the simulation.
DB | database that contains all the simulation parameters |
D | information about the computational grid |
Definition at line 385 of file io.cu.
References CONSTANT, DF_IMPROVED, DF_MODIFIED, DIFFUSION, DIRECT_FORCING, FADLUN_ET_AL, FEA_MODIFIED, LINEAR, domain::nx, domain::ny, QUADRATIC, stringFromPreconditionerType(), and stringFromTimeScheme().
Referenced by main().
void io::printTimingInfo | ( | Logger & | logger | ) |
Prints the time spent to execute tasks.
logger | object that contains the name and time spent of tasks |
Definition at line 469 of file io.cu.
References Logger::printAllTime().
Referenced by NSWithBody< memoryType >::shutDown(), and NavierStokesSolver< memoryType >::shutDown().
void io::readData | ( | std::string & | caseFolder, |
int | timeStep, | ||
real * | x, | ||
std::string | name | ||
) |
Reads numerical data at a given time-step.
caseFolder | directory of the simulation |
timeStep | the time-step number |
x | array that to fill |
name | name of the file containing the variable |
Definition at line 571 of file io.cu.
Referenced by NavierStokesSolver< memoryType >::initialiseFluxes().
void io::readInputs | ( | int | argc, |
char ** | argv, | ||
parameterDB & | DB, | ||
domain & | D | ||
) |
Reads data inputs from the command-line and the simulation files.
argc | number of arguments in the command-line |
argv | command-line arguments |
DB | database that contains all the simulation parameters |
D | object of the class domain that contains the computational grid |
Definition at line 83 of file io.cu.
References commandLineParse1(), commandLineParse2(), initialiseDefaultDB(), parseBodiesFile(), parseDomainFile(), parseFlowFile(), and parseSimulationFile().
Referenced by main().
std::vector< std::string > & io::split | ( | const std::string & | s, |
char | delim, | ||
std::vector< std::string > & | elems | ||
) |
std::vector< std::string > io::split | ( | const std::string & | s, |
char | delim | ||
) |
std::string io::stringFromPreconditionerType | ( | preconditionerType | s | ) |
Converts a preconditionerType
to a std::string
.
s | a preconditioner |
Definition at line 336 of file io.cu.
References AINV, DIAGONAL, NONE, and SMOOTHED_AGGREGATION.
Referenced by printSimulationInfo().
std::string io::stringFromTimeScheme | ( | timeScheme | s | ) |
Converts a timeScheme
to a std::string
.
s | a time-integration scheme |
Definition at line 361 of file io.cu.
References ADAMS_BASHFORTH_2, CRANK_NICOLSON, EULER_EXPLICIT, and EULER_IMPLICIT.
Referenced by printSimulationInfo().
timeScheme io::timeSchemeFromString | ( | std::string | s | ) |
Converts a string to a time-integration scheme type.
s | the string that describes the time-integration scheme |
Definition at line 29 of file parseSimulationFile.cu.
References ADAMS_BASHFORTH_2, CRANK_NICOLSON, EULER_EXPLICIT, EULER_IMPLICIT, and RUNGE_KUTTA_3.
Referenced by parseSimulation().
void io::writeData | ( | std::string & | caseFolder, |
int | n, | ||
Vector & | q, | ||
Vector & | lambda, | ||
domain & | D | ||
) |
Referenced by NavierStokesSolver< memoryType >::writeCommon(), and writeData< vecD >().
void io::writeData< vecD > | ( | std::string & | caseFolder, |
int | n, | ||
vecD & | q, | ||
vecD & | lambda, | ||
domain & | D | ||
) |
Writes numerical data at a given time-step (on the device).
It creates a directory whose name is the time-step number and writes the flux, the pressure (and eventually the body forces) into the files q, lambda, respectively.
caseFolder | directory of the simulation |
n | the time-step number |
q | array that contains the fluxes |
lambda | array that contains the pressures (and eventually the body forces) |
D | information about the computational grid |
Definition at line 554 of file io.cu.
References writeData().
void io::writeData< vecH > | ( | std::string & | caseFolder, |
int | n, | ||
vecH & | q, | ||
vecH & | lambda, | ||
domain & | D | ||
) |
Writes numerical data at a given time-step (on the host).
It creates a directory whose name is the time-step number and writes the flux, the pressure (and eventually the body forces) into the files q, lambda, respectively.
caseFolder | directory of the simulation |
n | the time-step number |
q | array that contains the fluxes |
lambda | array that contains the pressures (and eventually the body forces) |
D | information about the computational grid |
void io::writeGrid | ( | std::string & | caseFolder, |
domain & | D | ||
) |
Writes grid-points coordinates into the file grid.
caseFolder | the directory of the simulation |
D | information about the computational grid |
Definition at line 482 of file io.cu.
References domain::nx, domain::ny, domain::x, and domain::y.
Referenced by NavierStokesSolver< memoryType >::initialiseCommon().