17 {
Id::COLLISION,
"collision",
"Simple simulation of a two-body collision." },
19 "fragmentation_and_reaccumulation",
20 "SPH simulation of an impact and fragmentation followed by an N-body simulation of gravitational "
21 "reaccumulation of fragments." },
24 "Meteoroid impact to a horizontal surface enclosed by boundary conditions." },
26 "planetesimal_merging",
27 "Two equal-sized planetesimals with iron core colliding and merging." },
31 "Gas giant orbiting a neutron star and creating an accretion disk." },
34 "N-body simulation of the Sun and eight planets of our Solar System." },
43 case Id::FRAGMENTATION_REACCUMULATION:
47 case Id::PLANETESIMAL_MERGING:
49 case Id::GALAXY_COLLISION:
51 case Id::ACCRETION_DISK:
53 case Id::SOLAR_SYSTEM:
63 makeNode<DisableDerivativeCriterionJob>(nameMgr.
getName(
"optimize impactor"));
64 targetMaterial->
connect(impactorMaterial,
"material");
68 targetSettings.
set(
"useMaterialSlot",
true);
69 targetSettings.
set(
"body.radius", 50._f);
70 targetSettings.
set(
"particles.count",
int(particleCnt));
74 impactorSettings.
set(
"useMaterialSlot",
true);
75 impactorSettings.
set(
"body.radius", 10._f);
76 targetMaterial->
connect(targetIc,
"material");
77 impactorMaterial->
connect(impactorIc,
"material");
78 targetIc->
connect(impactorIc,
"target");
82 targetIc->
connect(setup,
"target");
83 impactorIc->
connect(setup,
"impactor");
86 setup->
connect(frag,
"particles");
92 const Size particleCnt) {
93 makeNode<SphereJob>(
"dummy");
97 makeNode<DisableDerivativeCriterionJob>(nameMgr.
getName(
"optimize impactor"));
98 targetMaterial->
connect(impactorMaterial,
"material");
102 targetSettings.
set(
"useMaterialSlot",
true);
103 targetSettings.
set(
"body.radius", 50._f);
104 targetSettings.
set(
"particles.count",
int(particleCnt));
108 impactorSettings.
set(
"useMaterialSlot",
true);
109 impactorSettings.
set(
"body.radius", 10._f);
110 targetMaterial->
connect(targetIc,
"material");
111 impactorMaterial->
connect(impactorIc,
"material");
112 targetIc->
connect(impactorIc,
"target");
116 targetIc->
connect(stabTarget,
"particles");
120 stabTarget->
connect(setup,
"target");
121 impactorIc->
connect(setup,
"impactor");
124 setup->
connect(frag,
"particles");
126 frag->
connect(handoff,
"particles");
129 handoff->
connect(reacc,
"particles");
139 const Vector targetSize(100._f, 30._f, 100._f);
140 const Vector domainSize(100._f, 100._f, 100._f);
148 domainSettings.
set(
"dimensions", domainSize);
149 domainSettings.
set(
"center", 0.5_f * (domainSize - targetSize));
153 targetSettings.
set(
"useMaterialSlot",
true);
154 targetSettings.
set(
"particles.count",
int(particleCnt));
157 targetMaterial->
connect(targetIc,
"material");
165 stabilizeSettings.
set(
167 targetIc->
connect(stabilizeTarget,
"particles");
168 domain->
connect(stabilizeTarget,
"boundary");
172 impactorSettings.
set(
"useMaterialSlot",
true);
174 const Float impactorRadius = 2._f;
175 impactorSettings.
set(
"body.radius", impactorRadius);
178 makeNode<DisableDerivativeCriterionJob>(nameMgr.
getName(
"optimize impactor"));
179 targetMaterial->
connect(impactorMaterial,
"material");
181 impactorMaterial->
connect(impactorIc,
"material");
182 targetIc->
connect(impactorIc,
"target");
186 mergerSettings.
set(
"offset",
Vector(0._f, 50._f, 0._f));
187 mergerSettings.
set(
"velocity",
Vector(0._f, -5._f, 0._f));
188 mergerSettings.
set(
"unique_flags",
true);
189 stabilizeTarget->
connect(merger,
"particles A");
190 impactorIc->
connect(merger,
"particles B");
198 stabilizeSettings.
set(
201 merger->
connect(cratering,
"particles");
202 domain->
connect(cratering,
"boundary");
225 surface->
connect(planetesimal,
"base shape");
226 olivine->
connect(planetesimal,
"base material");
228 core->
connect(planetesimal,
"shape 1");
229 iron->
connect(planetesimal,
"material 1");
232 planetesimal->
connect(equilibrium,
"particles");
239 equilibrium->
connect(stab,
"particles");
243 mergerSettings.
set(
"offset",
Vector(5000._f, 1500._f, 0._f));
244 mergerSettings.
set(
"velocity",
Vector(-2.5_f, 0._f, 0._f));
245 mergerSettings.
set(
"com",
true);
246 mergerSettings.
set(
"unique_flags",
true);
248 stab->
connect(merger,
"particles A");
249 stab->
connect(merger,
"particles B");
255 merger->
connect(sim,
"particles");
270 mergerSettings.
set(
"offset",
Vector(0.01_f, 0._f, 0._f));
271 mergerSettings.
set(
"velocity",
Vector(0._f, 0.0005_f, 0._f));
272 mergerSettings.
set(
"com",
true);
273 mergerSettings.
set(
"unique_flags",
true);
277 rotatorSettings.
set(
"yaw", 30._f);
279 galaxyIc->
connect(merger,
"particles A");
280 galaxyIc->
connect(rotator,
"particles");
281 rotator->
connect(merger,
"particles B");
293 merger->
connect(run,
"particles");
307 starIc->
connect(equilibriumIc,
"particles");
311 nsSettings.
set(
"radius", 0.04_f);
315 joinSettings.
set(
"offset",
Vector(1.e6_f, 0._f, 0._f));
316 joinSettings.
set(
"velocity",
Vector(0._f, 250._f, 0._f));
317 joinSettings.
set(
"com",
true);
318 equilibriumIc->
connect(join,
"particles A");
319 nsIc->
connect(join,
"particles B");
328 join->
connect(sim,
"particles");
342 Vector(-8.928734732644719e-2, -4.521325453222446e-1, -2.975182102295437e-2),
343 Vector(-6.441236962991079e-1, -3.314276376252449e-1, 3.226254091757653e-2),
344 Vector(7.549485485202402e-2, 9.867433026966754e-1, 5.784067376482213e-5),
345 Vector(7.910150731229694e-1, 1.264441562325783e0, 6.907352037330410e-3),
346 Vector(2.944626847316137e0, -4.154019886078014e0, -4.864670549497938e-2),
347 Vector(5.418279655781740e0, -8.381621945307499e0, -6.997483972704878e-2),
348 Vector(1.538095560420909e1, 1.242451334531269e1, -1.531172265021136e-1),
349 Vector(2.944592389131131e1, -5.272456275707134e0, -5.700349742119496e-1),
352 Vector(2.203479749687471e-2, -3.580432587616751e-3, -2.313817126869404e-3),
353 Vector(9.315663381232362e-3, -1.797621186456914e-2, -7.843669810993209e-4),
354 Vector(-1.743861165458079e-2, 1.361273813138455e-3, 7.711170058594351e-7),
355 Vector(-1.129568889262675e-2, 8.676624992146748e-3, 4.590908874884053e-4),
356 Vector(6.063442036100106e-3, 4.721743950691111e-3, -1.552093577175655e-4),
357 Vector(4.374201049769948e-3, 3.015429419149447e-3, -2.269352878444703e-4),
358 Vector(-2.500397529553041e-3, 2.876319493906491e-3, 4.298287724104297e-5),
359 Vector(5.329085656143531e-4, 3.108706732834171e-3, -7.657253104891884e-5),
366 settings.
set(
"r0", r);
367 settings.
set(
"v0", v);
376 sunSettings.
set(
"mass", 1._f);
377 sunSettings.
set(
"radius", 1._f);
378 sunSettings.
set(
"flag", 0);
379 sunIc->
connect(join,
"particles 1");
385 mercurySettings.
set(
"flag", 1);
386 setPositionAndVelocity(mercurySettings, 0);
388 mercuryIc->
connect(join,
"particles 2");
394 venusSettings.
set(
"flag", 2);
395 setPositionAndVelocity(venusSettings, 1);
397 venusIc->
connect(join,
"particles 3");
403 earthSettings.
set(
"flag", 3);
404 setPositionAndVelocity(earthSettings, 2);
406 earthIc->
connect(join,
"particles 4");
412 marsSettings.
set(
"flag", 4);
413 setPositionAndVelocity(marsSettings, 3);
415 marsIc->
connect(join,
"particles 5");
421 jupiterSettings.
set(
"flag", 5);
422 setPositionAndVelocity(jupiterSettings, 4);
424 jupiterIc->
connect(join,
"particles 6");
430 saturnSettings.
set(
"flag", 6);
431 setPositionAndVelocity(saturnSettings, 5);
433 saturnIc->
connect(join,
"particles 7");
439 uranusSettings.
set(
"flag", 7);
440 setPositionAndVelocity(uranusSettings, 6);
442 uranusIc->
connect(join,
"particles 8");
448 neptuneSettings.
set(
"flag", 8);
449 setPositionAndVelocity(neptuneSettings, 7);
451 neptuneIc->
connect(join,
"particles 9");
454 join->
connect(sim,
"particles");
#define NOT_IMPLEMENTED
Helper macro marking missing implementation.
Helper functions to check the internal consistency of the code.
@ NO_THROW
Function cannot throw exceptions.
#define CHECK_FUNCTION(flags)
uint32_t Size
Integral type used to index arrays (by default).
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
AutoPtr< IMaterial > getMaterial(const MaterialEnum type)
SPH-specific implementation of particle materials.
#define NAMESPACE_SPH_END
StaticArray< Vector, 8 > VELOCITIES
StaticArray< Vector, 8 > POSITIONS
BasicVector< Float > Vector
Wrapper of an integral value providing functions for reading and modifying individual bits.
INLINE TValue value() const
Returns the underlying value.
void connect(SharedPtr< JobNode > dependent, const std::string &slotName)
Connects this node to given dependent node.
VirtualSettings getSettings() const
Returns settings object allowing to access and modify the state of the job.
Settings & set(const TEnum idx, TValue &&value, std::enable_if_t<!std::is_enum< std::decay_t< TValue >>::value, int >=0)
Saves a value into the settings.
Array with fixed number of allocated elements.
std::string getName(const std::string &name)
Holds a map of virtual entries, associated with a unique name.
void set(const std::string &key, const IVirtualEntry::Value &value)
Modifies an existing entry in the settings.
@ PRESSURE
Use force from pressure gradient in the solver.
@ SELF_GRAVITY
Use gravitational force in the model.
@ NONE
Gass or material with no stress tensor.
@ DIVERGENCE
Time step computed from velocity divergence.
@ DERIVATIVES
Time step computed by limiting value-to-derivative ratio of quantiites.
@ COURANT
Time step determined using CFL condition.
const EmptySettingsTag EMPTY_SETTINGS
@ REPEL
Particles are shifted until no overlap happens.
@ IDEAL_GAS
Equation of state for ideal gas.
@ PARTICLE_COUNT
Number of SPH particles in the body.
@ DENSITY
Density at zero pressure.
@ EOS
Equation of state for this material, see EosEnum for options.
@ RHEOLOGY_YIELDING
Model of stress reducing used within the rheological model.
@ GHOST_PARTICLES
Create ghosts to keep particles inside domain.
@ TIMESTEPPING_MAX_TIMESTEP
@ COLLISION_HANDLER
Specifies how the collisions of particles should be handler; see CollisionHandlerEnum.
@ SPH_SOLVER_FORCES
List of forces to compute by the solver.
@ TIMESTEPPING_DERIVATIVE_FACTOR
Multiplicative factor k for the derivative criterion; dt = k * v / dv.
@ COLLISION_OVERLAP
Specifies how particle overlaps should be handled.
@ RUN_LOGGER_VERBOSITY
Number specifying log verbosity. Can be between 0 and 3, going from least to most verbose.
@ DOMAIN_BOUNDARY
Type of boundary conditions.
@ GRAVITY_CONSTANT
Gravitational constant. To be generalized.
@ FRAME_CONSTANT_ACCELERATION
@ COLLISION_RESTITUTION_NORMAL
@ BLOCK
Block with edge sizes given by vector.
constexpr Float au
Astronomical unit (exactly)
constexpr Float R_earth
Earth radius.
constexpr Float day
Number of seconds in a day.
constexpr Float R_sun
Solar radius.
constexpr Float M_earth
Earth mass.
constexpr Float year
Number of seconds in a year.
SharedPtr< JobNode > makeFragmentationAndReaccumulation(UniqueNameManager &nameMgr, const Size particleCnt=10000)
Creates a node tree for collision simulation, consisting of stabilization of the target,...
@ FRAGMENTATION_REACCUMULATION
SharedPtr< JobNode > make(const Id id, UniqueNameManager &nameMgr, const Size particleCnt=10000)
Creates a node tree for the preset with given ID.
SharedPtr< JobNode > makeAsteroidCollision(UniqueNameManager &nameMgr, const Size particleCnt=10000)
Creates a node tree for basic collision simulation.
SharedPtr< JobNode > makeCratering(UniqueNameManager &nameMgr, const Size particleCnt=10000)
Creates a node tree for simulation of cratering.
SharedPtr< JobNode > makeAccretionDisk(UniqueNameManager &nameMgr, const Size particleCnt=10000)
Creates a node tree for accretion simulation.
SharedPtr< JobNode > makePlanetesimalMerging(UniqueNameManager &nameMgr, const Size particleCnt=10000)
Creates a node tree for simulation of planetesimal collision.
SharedPtr< JobNode > makeGalaxyCollision(UniqueNameManager &nameMgr, const Size particleCnt=10000)
Creates a node tree for galaxy collision.
SharedPtr< JobNode > makeSolarSystem(UniqueNameManager &nameMgr)
Creates a node tree for the Solar System.
Helper class for adding individual enums to the enum map.