67 {
68 YAML::Node yaml = YAML::LoadFile(settingPath.string());
69
71
72
73 s.
dim = yaml[
"dim"].as<
int>();
75 s.
dt = yaml[
"dt"].as<
double>();
76 s.
endTime = yaml[
"endTime"].as<
double>();
80
81
84
85
86 s.
gravity[0] = yaml[
"gravity"][0].as<
double>();
87 s.
gravity[1] = yaml[
"gravity"][1].as<
double>();
88 s.
gravity[2] = yaml[
"gravity"][2].as<
double>();
89
90
94 yaml["surfaceDetection-particleDistribution-threshold"].as<double>();
95
96
98
101
102 s.
soundSpeed = yaml[
"soundSpeed"].as<
double>();
103
104
106 s.coefficientOfRestitution = yaml["coefficientOfRestitution"].as<double>();
107
108
109 s.re_forNumberDensity = yaml["radiusRatioForNumberDensity"].as<double>() * s.particleDistance;
110 s.re_forGradient = yaml["radiusRatioForGradient"].as<double>() * s.particleDistance;
111 s.re_forLaplacian = yaml["radiusRatioForLaplacian"].as<double>() * s.particleDistance;
112 s.reMax = std::max({s.re_forNumberDensity, s.re_forGradient, s.re_forLaplacian});
113
114
115 s.domain.xMin = yaml["domainMin"][0].as<double>();
116 s.domain.xMax = yaml["domainMax"][0].as<double>();
117 s.domain.yMin = yaml["domainMin"][1].as<double>();
118 s.domain.yMax = yaml["domainMax"][1].as<double>();
119 s.domain.zMin = yaml["domainMin"][2].as<double>();
120 s.domain.zMax = yaml["domainMax"][2].as<double>();
121 s.domain.xLength = s.domain.xMax - s.domain.xMin;
122 s.domain.yLength = s.domain.yMax - s.domain.yMin;
123 s.domain.zLength = s.domain.zMax - s.domain.zMin;
124
125
126 auto yamlDir = settingPath.parent_path();
127 auto relativeProfPath = yaml["particlesPath"].as<std::string>();
128 s.particlesPath = fs::weakly_canonical(yamlDir / relativeProfPath);
129
130
131
132 if (yaml["outputVtkInBinary"]) {
133 s.outputVtkInBinary = yaml["outputVtkInBinary"].as<bool>();
134 } else {
135 s.outputVtkInBinary = false;
136 }
137 return s;
138}
Struct for settings of calculation.
Eigen::Vector3d gravity
Gravity.
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.
bool surfaceDetection_particleDistribution
flag for free surface detection based on particle distribution
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