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>();
83
84
87
88
89 s.
xyzInput = yaml[
"xyz-input"] ? yaml[
"xyz-input"].as<
bool>() : true;
90 s.
gravity[0] = yaml[
"gravity"][0].as<
double>();
91 s.
gravity[1] = yaml[
"gravity"][1].as<
double>();
92 s.
gravity[2] = yaml[
"gravity"][2].as<
double>();
93 s.
gNorm = yaml[
"gravity-norm"] ? yaml[
"gravity-norm"].as<
double>() : 0.0;
94 s.
gAngle = yaml[
"gravity-angle"] ? yaml[
"gravity-angle"].as<
double>() : 0.0;
95
96
100 yaml["surfaceDetection-particleDistribution-threshold"].as<double>();
101
102
104
107
108 s.
soundSpeed = yaml[
"soundSpeed"].as<
double>();
109
110
112 s.coefficientOfRestitution = yaml["coefficientOfRestitution"].as<double>();
113
114
115 s.re_forNumberDensity = yaml["radiusRatioForNumberDensity"].as<double>() * s.particleDistance;
116 s.re_forGradient = yaml["radiusRatioForGradient"].as<double>() * s.particleDistance;
117 s.re_forLaplacian = yaml["radiusRatioForLaplacian"].as<double>() * s.particleDistance;
118 s.reMax = std::max({s.re_forNumberDensity, s.re_forGradient, s.re_forLaplacian});
119
120
121 s.domain.xMin = yaml["domainMin"][0].as<double>();
122 s.domain.xMax = yaml["domainMax"][0].as<double>();
123 s.domain.yMin = yaml["domainMin"][1].as<double>();
124 s.domain.yMax = yaml["domainMax"][1].as<double>();
125 s.domain.zMin = yaml["domainMin"][2].as<double>();
126 s.domain.zMax = yaml["domainMax"][2].as<double>();
127 s.domain.xLength = s.domain.xMax - s.domain.xMin;
128 s.domain.yLength = s.domain.yMax - s.domain.yMin;
129 s.domain.zLength = s.domain.zMax - s.domain.zMin;
130
131
132 auto yamlDir = settingPath.parent_path();
133 auto relativeProfPath = yaml["particlesPath"].as<std::string>();
134 s.particlesPath = fs::weakly_canonical(yamlDir / relativeProfPath);
135
136
137
138 if (yaml["outputVtkInBinary"]) {
139 s.outputVtkInBinary = yaml["outputVtkInBinary"].as<bool>();
140 } else {
141 s.outputVtkInBinary = false;
142 }
143 return s;
144}
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.
int numPhysicalCores
Number of cores to calculate.
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