SPH
Batch.cpp
Go to the documentation of this file.
1 #include "Sph.h"
2 //#include "run/Presets.h"
3 
4 using namespace Sph;
5 
7 std::string getRunName(const Float targetRadius,
8  const Float impactorRadius,
9  const Float targetPeriod,
10  const Float impactSpeed,
11  const Float impactAngle) {
12  std::stringstream ss;
13  ss << "sph_" << round(targetRadius) << "m_" << round(impactorRadius) << "m_" << round(targetPeriod * 60)
14  << "min_" << round(impactSpeed) << "kms_" << round(impactAngle);
15  return ss.str();
16 }
17 
18 int main(int, char** argv) {
19  (void)argv;
20  /*CollisionParams cp;
21 
22  // fixed parameters
23  cp.geometry.set(CollisionGeometrySettingsId::TARGET_PARTICLE_COUNT, 250000);
24 
25  const Float impactSpeed = 5.e3_f;
26  cp.geometry.set(CollisionGeometrySettingsId::IMPACT_SPEED, impactSpeed);
27 
28  ThreadPool pool;
29 
30  const int impactAngle1 = atoi(argv[1]);
31  for (Float targetRadius : { 5.e4f }) {
32  cp.geometry.set(CollisionGeometrySettingsId::TARGET_RADIUS, targetRadius);
33 
34  for (Float impactAngle : { impactAngle1 }) {
35  cp.geometry.set(CollisionGeometrySettingsId::IMPACT_ANGLE, impactAngle);
36 
37  for (Float period : { 2._f, 3._f, 1000._f }) {
38  cp.geometry.set(CollisionGeometrySettingsId::TARGET_SPIN_RATE, 24._f / period);
39 
40  for (Float impactEnergy : { 0.1_f, 0.3_f, 1._f, 3._f }) {
41  const Float density = BodySettings::getDefaults().get<Float>(BodySettingsId::DENSITY);
42  const Float impactorRadius =
43  getImpactorRadius(targetRadius, impactSpeed, impactEnergy, density);
44  cp.geometry.set(CollisionGeometrySettingsId::IMPACTOR_RADIUS, impactorRadius);
45 
46  const std::string runName =
47  getRunName(targetRadius, impactorRadius, period, impactSpeed / 1000._f, impactAngle);
48 
49  cp.outputPath = Path(runName);
50  SPH_ASSERT(!FileSystem::pathExists(cp.outputPath));
51 
52  PhaseParams pp;
53  pp.outputPath = Path(runName);
54 
55  const Float runTime = 3600._f * targetRadius / 5.e3_f; // 1 hour for 10km body
56  pp.stab.range = Interval(0._f, 10._f * targetRadius / 5.e3);
57  pp.stab.overrides.set(RunSettingsId::RUN_LOGGER, LoggerEnum::FILE)
58  .set(RunSettingsId::RUN_LOGGER_FILE, std::string(runName + "/stab.log"))
59  .set(RunSettingsId::RUN_THREAD_CNT, 1);
60 
61  pp.frag.range = Interval(0._f, runTime);
62  pp.frag.overrides.set(RunSettingsId::RUN_LOGGER, LoggerEnum::FILE)
63  .set(RunSettingsId::RUN_LOGGER_FILE, std::string(runName + "/frag.log"))
64  .set(RunSettingsId::RUN_THREAD_CNT, 1);
65 
66  pp.reacc.range = Interval(0._f, 3600._f * 24._f * 10._f); // 10 days
67  pp.reacc.overrides.set(RunSettingsId::COLLISION_BOUNCE_MERGE_LIMIT, 1._f)
68  .set(RunSettingsId::COLLISION_OVERLAP, OverlapEnum::FORCE_MERGE)
69  .set(RunSettingsId::COLLISION_HANDLER, CollisionHandlerEnum::PERFECT_MERGING)
70  .set(RunSettingsId::RUN_LOGGER, LoggerEnum::FILE)
71  .set(RunSettingsId::RUN_LOGGER_FILE, std::string(runName + "/reac.log"))
72  .set(RunSettingsId::RUN_THREAD_CNT, 1);
73 
74  pool.submit([cp, pp] {
75  CollisionRun run(cp, pp, makeShared<NullCallbacks>());
76  run.setUp();
77  run.run();
78  // runCollision(Path{});
79  });
80  }
81  }
82  }
83  }
84 
85  pool.waitForAll();*/
86 
87  return 0;
88 }
int main(int, char **argv)
Definition: Batch.cpp:18
std::string getRunName(const Float targetRadius, const Float impactorRadius, const Float targetPeriod, const Float impactSpeed, const Float impactAngle)
Returns the name of the created output directory.
Definition: Batch.cpp:7
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Definition: Globals.h:13
INLINE auto round(const T &f)
Definition: MathUtils.h:356
Includes common headers.
Definition: MemoryPool.h:5