70 {
71 YAML::Node yaml = YAML::LoadFile(settingPath.string());
72
74
75
76 YAML::Node comp = yaml["computationalConditions"];
77 s.
dim = comp[
"dim"].as<
int>();
79 s.
dt = comp[
"dt"].as<
double>();
80 s.
endTime = comp[
"endTime"].as<
double>();
83
84
85 YAML::Node phys = yaml["physicalProperties"];
88
89
90 YAML::Node grav = yaml["gravity"];
91 s.
gravityMethod = grav[
"method"] ? grav[
"method"].as<std::string>() :
"xyz";
93 s.
gravity[0] = grav[
"xyz"][0].as<
double>();
94 s.
gravity[1] = grav[
"xyz"][1].as<
double>();
95 s.
gravity[2] = grav[
"xyz"][2].as<
double>();
97 s.
gNorm = grav[
"normAndAngle"][
"norm"] ? grav[
"normAndAngle"][
"norm"].as<
double>() : 0.0;
98 s.
gAngle = grav[
"normAndAngle"][
"angle"] ? grav[
"normAndAngle"][
"angle"].as<
double>() : 0.0;
99 } else {
100 cerr <<
"unsupported gravity method: " << s.
gravityMethod << endl;
101 std::exit(-1);
102 }
103
104
105 YAML::Node surf = yaml["surfaceDetection"];
109
110
111 YAML::Node press = yaml["pressureCalculation"];
113 if (press["method"].as<std::string>() == "Implicit") {
114
117 } else if (press["method"].as<std::string>() == "Explicit") {
118
119 s.
soundSpeed = press[
"explicit"][
"soundSpeed"].as<
double>();
120 } else {
121 cerr << "unsupported pressure calculation method: " << press["method"].as<std::string>() << endl;
122 std::exit(-1);
123 }
124
125
126 YAML::Node coll = yaml["collision"];
129
130
131 YAML::Node re = yaml["effectiveRadius"];
136
137
138 YAML::Node dom = yaml["domain"];
148
149
150 YAML::Node io = yaml["io"];
151 auto yamlDir = settingPath.parent_path();
152 auto relativeProfPath = io["particlesPath"].as<std::string>();
153 s.
particlesPath = fs::weakly_canonical(yamlDir / relativeProfPath);
154
155
156 s.
outputVtkInBinary = io[
"outputVtkInBinary"] ? io[
"outputVtkInBinary"].as<
bool>() : false;
157 return s;
158}
double xMax
maximum x coordinate of the domain
double zMin
minimum z coordinate of the domain
double zMax
maximum z coordinate of the domain
double xMin
minimum x coordinate of the domain
double yMin
minimum y coordinate of the domain
double yMax
maximum y coordinate of the domain
Struct for settings of calculation.
Eigen::Vector3d gravity
Gravity vector when using xyz input.
std::string gravityMethod
Method for gravity input.
double reMax
Maximum of effective radius.
double outputPeriod
Output period of the simulation.
double soundSpeed
Speed of sound for Explicit method.
double compressibility
Compressibility of the fluid for Implicit method.
double collisionDistance
Distance for collision detection.
double particleDistance
Initial distance between particles.
bool outputVtkInBinary
Flag for saving VTK file in binary format.
double endTime
End time of the simulation.
int dim
Dimension of the simulation.
double relaxationCoefficientForPressure
Relaxation coefficient for pressure for Implicit method.
double re_forNumberDensity
Effective radius for number density.
double gNorm
Norm of gravity when using norm and angle.
bool surfaceDetection_particleDistribution
flag for free surface detection based on particle distribution
double gAngle
Angle of gravity when using norm and angle.
std::string pressureCalculationMethod
Method for pressure calculation.
double surfaceDetection_particleDistribution_threshold
double kinematicViscosity
Kinematic viscosity.
double cflCondition
CFL condition.
double coefficientOfRestitution
Coefficient of restitution.
double surfaceDetection_numberDensity_threshold
threshold ratio of number density for free surface detection
double re_forGradient
Effective radius for gradient.
Domain domain
domain of the simulation
double re_forLaplacian
Effective radius for Laplacian.