12 #include "yaml-cpp/yaml.h" 31 if (s ==
"EULER_EXPLICIT")
33 else if (s ==
"EULER_IMPLICIT")
35 else if (s ==
"ADAMS_BASHFORTH_2")
37 else if (s ==
"RUNGE_KUTTA_3")
39 else if (s ==
"CRANK_NICOLSON")
43 printf(
"Error: Unknown timeScheme '%s'!\n", s.c_str());
60 else if (s ==
"DIAGONAL")
62 else if (s ==
"SMOOTHED_AGGREGATION")
68 printf(
"Error: Unknown preconditioner '%s'!\n", s.c_str());
83 if (s ==
"NAVIER_STOKES")
85 else if (s ==
"SAIKI_BIRINGEN")
87 else if (s ==
"DIRECT_FORCING")
89 else if (s ==
"TAIRA_COLONIUS")
91 else if (s ==
"FADLUN_ET_AL")
93 else if (s ==
"DIFFUSION")
95 else if (s ==
"DF_MODIFIED")
97 else if (s ==
"FEA_MODIFIED")
99 else if (s ==
"DF_IMPROVED")
103 printf(
"Error: Unknown ibmScheme '%s'!\n", s.c_str());
120 else if (s ==
"LINEAR")
122 else if (s ==
"QUADRATIC")
126 printf(
"Error: Unknown interpolationType '%s'!\n", s.c_str());
141 std::string dbKey =
"simulation";
142 DB[dbKey][
"dt"].set<
real>(node[
"dt"].as<
real>(0.02));
143 DB[dbKey][
"scaleCV"].set<
real>(node[
"scaleCV"].as<
real>(2.0));
144 DB[dbKey][
"startStep"].set<
int>(node[
"startStep"].as<
int>(0));
145 DB[dbKey][
"nt"].set<
int>(node[
"nt"].as<
int>(100));
146 DB[dbKey][
"nsave"].set<
int>(node[
"nsave"].as<
int>(100));
156 const YAML::Node &solvers = node[
"linearSolvers"];
157 for (
unsigned int i=0; i<solvers.size(); i++)
159 std::string system = solvers[i][
"system"].as<std::string>();
160 std::string dbKey = system +
"Solve";
161 DB[dbKey][
"solver"].set<std::string>(solvers[i][
"solver"].as<std::string>(
"CG"));
162 if (DB[dbKey][
"solver"].get<std::string>() ==
"GMRES")
163 DB[dbKey][
"restart"].set<
int>(solvers[i][
"restart"].as<
int>(50));
166 DB[dbKey][
"rTol"].set<
real>(solvers[i][
"relTolerance"].as<
real>(1.0E-05));
167 DB[dbKey][
"aTol"].set<
real>(solvers[i][
"absTolerance"].as<
real>(1.0E-50));
168 DB[dbKey][
"maxIterations"].set<
int>(solvers[i][
"maxIterations"].as<
int>(10000));
169 DB[dbKey][
"monitor"].set<
int>(solvers[i][
"monitor"].as<
bool>(
false));
182 printf(
"Parsing YAML file with simulation parameters ...\n");
183 YAML::Node nodes = YAML::LoadFile(simFile);
184 for(
unsigned int i=0; i<nodes.size(); i++)
double real
Is a float or a double depending on the machine precision.
ibmScheme ibmSchemeFromString(std::string s)
Converts a string to an IBM scheme.
fully discrete direct forcing method
ibmScheme
Specifies the immersed boundary method used to solve the flow.
implicit Euler method (first order)
Declaration of the functions of the namespace io.
timeScheme
Specifies the numerical scheme used for time-integration.
preconditionerType preconditionerTypeFromString(std::string s)
Converts a string to a preconditioner type.
void parseSimulationFile(std::string &simFile, parameterDB &DB)
Parses simParams.yaml and stores the simulation parameters.
preconditionerType
Specifies the type of preconditioner.
std::map< std::string, componentParameter > parameterDB
Map from a string to a componentParameter.
smoothed aggregation preconditioner
Contains functions related to I/O tasks.
no immersed bodies - Perot (1993)
Declaration of the class property.
interpolationType
Specifies the type of interpolation.
approximate inverse preconditioner
second-order Adams-Bashforth scheme
third-order low storage Runge-Kutta method
Crank-Nicolson scheme (second order)
timeScheme timeSchemeFromString(std::string s)
Converts a string to a time-integration scheme type.
void parseSimulation(const YAML::Node &node, parameterDB &DB)
Fills the database with the simulation parameters.
explicit Euler method (first order)
interpolationType interpolationTypeFromString(std::string s)
Converts a string to a interpolation type.