70 {
71 YAML::Node yaml = YAML::LoadFile(settingPath.string());
72
74
75
76 s.
dim = yaml[
"dim"].as<
int>();
78 s.
dt = yaml[
"dt"].as<
double>();
79 s.
endTime = yaml[
"endTime"].as<
double>();
82
83
86
87
88 s.
xyzInput = yaml[
"xyz-input"] ? yaml[
"xyz-input"].as<
bool>() : true;
89 s.
gravity[0] = yaml[
"gravity"][0].as<
double>();
90 s.
gravity[1] = yaml[
"gravity"][1].as<
double>();
91 s.
gravity[2] = yaml[
"gravity"][2].as<
double>();
92 s.
gNorm = yaml[
"gravity-norm"] ? yaml[
"gravity-norm"].as<
double>() : 0.0;
93 s.
gAngle = yaml[
"gravity-angle"] ? yaml[
"gravity-angle"].as<
double>() : 0.0;
94
95
99 yaml["surfaceDetection-particleDistribution-threshold"].as<double>();
100
101
103
106
107 s.
soundSpeed = yaml[
"soundSpeed"].as<
double>();
108
109
111 s.coefficientOfRestitution = yaml["coefficientOfRestitution"].as<double>();
112
113
114 s.re_forNumberDensity = yaml["radiusRatioForNumberDensity"].as<double>() * s.particleDistance;
115 s.re_forGradient = yaml["radiusRatioForGradient"].as<double>() * s.particleDistance;
116 s.re_forLaplacian = yaml["radiusRatioForLaplacian"].as<double>() * s.particleDistance;
117 s.reMax = std::max({s.re_forNumberDensity, s.re_forGradient, s.re_forLaplacian});
118
119
120 s.domain.xMin = yaml["domainMin"][0].as<double>();
121 s.domain.xMax = yaml["domainMax"][0].as<double>();
122 s.domain.yMin = yaml["domainMin"][1].as<double>();
123 s.domain.yMax = yaml["domainMax"][1].as<double>();
124 s.domain.zMin = yaml["domainMin"][2].as<double>();
125 s.domain.zMax = yaml["domainMax"][2].as<double>();
126 s.domain.xLength = s.domain.xMax - s.domain.xMin;
127 s.domain.yLength = s.domain.yMax - s.domain.yMin;
128 s.domain.zLength = s.domain.zMax - s.domain.zMin;
129
130
131 auto yamlDir = settingPath.parent_path();
132 auto relativeProfPath = yaml["particlesPath"].as<std::string>();
133 s.particlesPath = fs::weakly_canonical(yamlDir / relativeProfPath);
134
135
136
137 if (yaml["outputVtkInBinary"]) {
138 s.outputVtkInBinary = yaml["outputVtkInBinary"].as<bool>();
139 } else {
140 s.outputVtkInBinary = false;
141 }
142 return s;
143}
Struct for settings of calculation.
Eigen::Vector3d gravity
Gravity vector when using xyz input.
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.
double endTime
End time of the simulation.
int dim
Dimension of the simulation.
double relaxationCoefficientForPressure
Relaxation coefficient for pressure for Implicit method.
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 surfaceDetection_numberDensity_threshold
threshold ratio of number density for free surface detection