53 return makeAuto<TaitEos>(body);
55 return makeAuto<MieGruneisenEos>(body);
57 return makeAuto<TillotsonEos>(body);
59 return makeAuto<SimplifiedTillotsonEos>(body);
61 return makeAuto<MurnaghanEos>(body);
75 return makeAuto<ElasticRheology>();
89 return makeAuto<NullFracture>();
91 return makeAuto<ScalarGradyKippModel>();
93 return makeAuto<TensorGradyKippModel>();
102 return makeAuto<BalsaraSwitch<T>>(settings);
104 return makeAuto<T>();
115 return makeAV<StandardAV>(settings, balsara);
117 return makeAV<RiemannAV>(settings, balsara);
119 return makeAV<MorrisMonaghanAV>(settings, balsara);
130 return makeAuto<EulerExplicit>(storage, settings);
132 return makeAuto<PredictorCorrector>(storage, settings);
134 return makeAuto<LeapFrog>(storage, settings);
136 return makeAuto<BulirschStoer>(storage, settings);
138 return makeAuto<ModifiedMidpointMethod>(storage, settings);
140 return makeAuto<RungeKutta>(storage, settings);
153 return makeAuto<MultiCriterion>(settings);
160 return makeAuto<BruteForceFinder>();
164 return makeAuto<KdTree<KdNode>>(leafSize, maxDepth);
170 return makeAuto<UniformGridFinder>();
172 return makeAuto<HashMapFinder>(settings);
181 if (threadCnt == 1) {
196 if (global->getThreadCnt() == threadCnt) {
199 global->setGranularity(granularity);
205 weakGlobal = newPool;
220 return makeAuto<PlanarUvMapping>();
222 return makeAuto<SphericalUvMapping>();
240 return makeAuto<HexagonalPacking>(flags, progressCallback);
243 return makeAuto<CubicPacking>();
246 return makeAuto<RandomDistribution>(1234);
248 return makeAuto<StratifiedDistribution>(1234);
254 return makeAuto<DiehlDistribution>(diehl);
257 return makeAuto<ParametrizedSpiralingDistribution>(1234);
259 return makeAuto<LinearDistribution>();
265 template <
typename TSolver>
272 return makeAuto<GravitySolver<TSolver>>(scheduler, settings, std::move(eqs), std::move(bc));
274 return makeAuto<TSolver>(scheduler, settings, std::move(eqs), std::move(bc));
279 return getSolver(scheduler, settings, makeAuto<NullBoundaryCondition>());
285 return getSolver(scheduler, settings, std::move(bc), {});
294 auto throwIfGravity = [&settings] {
297 throw InvalidSetup(
"Using solver incompatible with gravity.");
302 return getActualSolver<SymmetricSolver<DIMENSIONS>>(
303 scheduler, settings, std::move(eqs), std::move(bc));
305 return getActualSolver<AsymmetricSolver>(scheduler, settings, std::move(eqs), std::move(bc));
307 return getActualSolver<EnergyConservingSolver>(scheduler, settings, std::move(eqs), std::move(bc));
310 return makeAuto<ElasticDeformationSolver>(scheduler, settings, std::move(bc));
313 return makeAuto<SummationSolver<DIMENSIONS>>(scheduler, settings);
316 return makeAuto<DensityIndependentSolver>(scheduler, settings);
319 return makeAuto<SimpleSolver>(scheduler, settings);
346 gravity = makeAuto<SphericalGravity>();
349 gravity = makeAuto<BruteForceGravity>(std::move(kernel));
358 gravity = makeAuto<BarnesHut>(theta, order, std::move(kernel), leafSize, maxDepth, constant);
385 return makeAuto<ElasticBounceHandler>(settings);
387 return makeAuto<MergingCollisionHandler>(0._f, 0._f);
389 return makeAuto<FallbackHandler<MergingCollisionHandler, ElasticBounceHandler>>(settings);
399 return makeAuto<NullOverlapHandler>();
401 return makeAuto<MergeOverlapHandler>();
403 return makeAuto<RepelHandler<ElasticBounceHandler>>(settings);
406 return makeAuto<RepelHandler<FollowupHandler>>(settings);
408 return makeAuto<InternalBounceHandler>(settings);
410 return makeAuto<MergeBoundHandler>(settings);
425 return makeAuto<CylindricalDomain>(center,
434 return makeAuto<HalfSpaceDomain>();
449 return makeAuto<CylindricalDomain>(center,
467 return makeAuto<NullBoundaryCondition>();
470 return makeAuto<GhostParticles>(std::move(domain), settings);
472 throw InvalidSetup(
"FixedParticles cannot be create from Factory, use manual setup.");
476 return makeAuto<FrozenParticles>(std::move(domain),
radius);
478 return makeAuto<FrozenParticles>();
483 return makeAuto<WindTunnel>(std::move(domain),
radius);
487 return makeAuto<PeriodicBoundary>(box);
490 return makeAuto<SymmetricBoundary>();
493 return makeAuto<KillEscapersBoundary>(domain);
515 return makeAuto<SolidMaterial>(body);
519 return makeAuto<NullMaterial>(body);
521 return makeAuto<EosMaterial>(body);
533 return makeAuto<NullLogger>();
535 return makeAuto<StdOutLogger>();
540 return makeAuto<FileLogger>(path, flags);
551 return makeAuto<NullLogWriter>();
553 return makeAuto<BriefLogWriter>(logger, settings);
555 return makeAuto<StandardLogWriter>(logger, settings);
557 return makeAuto<VerboseLogWriter>(logger, settings);
568 const OutputFile file(outputPath / fileMask, firstIndex);
571 return makeAuto<NullOutput>();
576 return makeAuto<TextOutput>(file, name, flags);
580 return makeAuto<BinaryOutput>(file, runType);
589 return makeAuto<VtkOutput>(file, flags);
594 return makeAuto<PkdgravOutput>(file, std::move(pkd));
604 return makeAuto<BinaryInput>();
605 }
else if (ext ==
"scf") {
606 return makeAuto<CompressedInput>();
607 }
else if (ext ==
"h5") {
608 return makeAuto<Hdf5Input>();
609 }
else if (ext ==
"tab") {
610 return makeAuto<TabInput>();
611 }
else if (ext ==
"dat") {
612 return makeAuto<MpcorpInput>();
614 if (ext.size() > 3 && ext.substr(ext.size() - 3) ==
".bt") {
615 return makeAuto<PkdgravInput>();
626 return makeAuto<RngWrapper<UniformRng>>(seed);
628 return makeAuto<RngWrapper<HaltonQrng>>();
630 return makeAuto<RngWrapper<BenzAsphaugRng>>(seed);
#define SPH_ASSERT(x,...)
#define NOT_IMPLEMENTED
Helper macro marking missing implementation.
SPH solver with asymmetric particle evaluation.
Implementation of the Balsara switch.
Barnes-Hut algorithm for computation of gravitational acceleration.
Object finding nearest neighbours by evaluating all partice pairs.
Simple gravity solver evaluating all particle pairs.
Wrapper of other IGravity object that uses cached accelerations to speed-up the evaluation.
Density-independent formulation of SPH.
Filling spatial domain with SPH particles.
Object defining computational domain.
const EmptyFlags EMPTY_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.
Smoothing kernels for including gravity into SPH.
auto getAssociatedGravityKernel(const TKernel &W, const Size resolution=40000)
Computes the gravitational softening kernel from the associated SPH kernel by integrating the Poisson...
SPH solver including gravity.
Finding neighbors using hash map.
K-d tree for efficient search of neighbouring particles.
Logging routines of the run.
SPH-specific implementation of particle materials.
constexpr INLINE T clamp(const T &f, const T &f1, const T &f2)
Time-dependent artificial viscosity by Morris & Monaghan (1997).
#define NAMESPACE_SPH_END
Implementation of Octree algorithm for kNN queries.
Saving and loading particle data.
OutputQuantityFlag
List of quantities we can write to text output.
RunTypeEnum
Type of simulation, stored as metadata in the binary file.
Simple thread pool with fixed number of threads.
Artificial viscosity based on Riemann solver.
Random number generators.
Simple model of gravity, valid only for homogeneous spheres.
NAMESPACE_SPH_BEGIN EquationHolder getStandardEquations(const RunSettings &settings, const EquationHolder &other)
Standard SPH equation set, using density and specific energy as independent variables.
Standard SPH formulation that uses continuity equation for solution of density.
Standard SPH artificial viscosity.
Solver using direction summation to compute density and smoothing length.
Wrapper of gravity implementation to be used with symmetric boundary conditions.
Implements IScheduler interface using TBB.
Criteria for computing the time step.
Algorithms for temporal evolution of the physical model.
Helper object defining three-dimensional interval (box).
INLINE const Vector & lower() const
Returns lower bounds of the box.
INLINE const Vector & upper() const
Returns upper bounds of the box.
Kernel proposed by Read et al. (2010) with improved stability.
Cubic spline (M4) kernel.
Container holding equation terms.
Composite handler, choosing another collision handler if the primary handler rejects the collision by...
@ ADD_TIMESTAMP
Adds a time of writing before each message.
Wrapper of an integral value providing functions for reading and modifying individual bits.
constexpr INLINE bool has(const TEnum flag) const
Checks if the object has a given flag.
INLINE void setIf(const TEnum flag, const bool use)
Sets or removes given flag based given boolean value.
Fourth-order spline (M5) kernel.
Gravity smoothing kernels associated with standard SPH kernels.
Gravitational kernel approximated by LUT for close particles.
@ SORTED
Particles are sorted using its Morton code.
@ SPH5_COMPATIBILITY
Generates the grid to match code SPH5 for 1-1 comparison.
@ CENTER
Move particle lattice so that their center of mass matches center of domain.
virtual Box getBoundingBox() const =0
Returns the bounding box of the domain.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Object representing a 1D interval of real numbers.
Thrown when components of the run are mutually incompatible.
A look-up table approximation of the kernel.
static SharedPtr< OmpScheduler > getGlobalInstance()
Helper file generating file names for output files.
Object representing a path on a filesystem.
std::string native() const
Returns the native version of the path.
Path extension() const
Returns the extension of the filename.
Helper kernel wrapper that modifies the support of another kernel.
static SharedPtr< SequentialScheduler > getGlobalInstance()
TValue get(const TEnum idx, std::enable_if_t<!std::is_enum< std::decay_t< TValue >>::value, int >=0) const
Returns a value of given type from the settings.
Flags< TValue > getFlags(const TEnum idx) const
Returns Flags from underlying value stored in settings.
Gravity kernel of a solid sphere.
void setGranularity(const Size newGranularity)
static SharedPtr< Tbb > getGlobalInstance()
Kernel introduced by Thomas & Couchman (1992).
static SharedPtr< ThreadPool > getGlobalInstance()
Returns the global instance of the thread pool.
Triangular (piecewise linear) kernel.
SharedPtr< T > lock() const
AutoPtr< IEquationTerm > makeAV(const RunSettings &settings, const bool balsara)
Creating code components based on values from settings.
@ NONE
No collision handling.
@ SELF_GRAVITY
Use gravitational force in the model.
@ STD_OUT
Print log to standard output.
@ NONE
Do not log anything.
@ ELASTIC
No yielding, just elastic deformations following Hooke's law.
@ NONE
Gass or material with no stress tensor.
@ VON_MISES
Von Mises criterion.
@ DRUCKER_PRAGER
Drucker-Prager pressure dependent yielding stress.
@ UNIFORM_GRID
Partitioning particles into a grid uniform in space.
@ BRUTE_FORCE
Brute-force search by going through each pair of particles (O(N^2) complexity)
@ HASH_MAP
Using hash map.
@ UNIFORM
Mersenne Twister PRNG from Standard library.
@ BENZ_ASPHAUG
Same RNG as used in SPH5, used for 1-1 comparison.
@ BRUTE_FORCE
Brute-force summation over all particle pairs (O(N^2) complexity)
@ SPHERICAL
Approximated gravity, assuming the matter is a simple homogeneous sphere.
@ BARNES_HUT
Use Barnes-Hut algorithm, approximating gravity by multipole expansion (up to octupole order)
@ TEXT_FILE
Formatted human-readable text file.
@ PKDGRAV_INPUT
Pkdgrav input file.
@ LEAP_FROG
Leap-frog 2nd-order integration.
@ MODIFIED_MIDPOINT
Modified midpoint method with constant number of substeps.
@ BULIRSCH_STOER
Bulirsch-Stoer integrator.
@ RUNGE_KUTTA
Runge-Kutta 4-th order integration.
@ PREDICTOR_CORRECTOR
Predictor-corrector scheme.
@ EULER_EXPLICIT
Explicit (forward) 1st-order integration.
@ SPHERICAL
Spherical mapping.
@ SPH_KERNEL
Use gravity smoothing kernel corresponding to selected SPH kernel.
@ POINT_PARTICLES
Point-like particles with zero radius.
@ INTERNAL_BOUNCE
Particles are allowed to overlap and they bounce if moving towards each other.
@ REPEL
Particles are shifted until no overlap happens.
@ NONE
All overlaps are ignored.
@ FORCE_MERGE
Overlapping particles are merged.
@ SUMMATION_SOLVER
Density is obtained by direct summation over nearest SPH particles.
@ ENERGY_CONSERVING_SOLVER
Solver advancing internal energy using pair-wise work done by particles, by Owen (2009).
@ ELASTIC_DEFORMATION_SOLVER
Special solver used to simulate deformations of perfectly elastic bodies.
@ SYMMETRIC_SOLVER
SPH formulation using symmetrized evaluation of derivatives.
@ DENSITY_INDEPENDENT
Density independent solver by Saitoh & Makino (2013).
@ ASYMMETRIC_SOLVER
Generic solver evaluating all derivatives asymmetrically.
@ RIEMANN
Artificial viscosity term analogous to Riemann solvers by Monaghan (1997)
@ MORRIS_MONAGHAN
Time-dependent artificial viscosity by Morris & Monaghan (1997).
@ STANDARD
Standard artificial viscosity term by Monaghan (1989).
@ NONE
No artificial viscosity.
@ STRATIFIED
Stratified distribution to reduce clustering.
@ RANDOM
Random distribution of particles.
@ PARAMETRIZED_SPIRALING
Parametrized spiraling scheme by Saff & Kuijlaars (1997)
@ HEXAGONAL
Hexagonally close packing.
@ DIEHL_ET_AL
Isotropic uniform distribution by Diehl et al. (2012)
@ LINEAR
Distributes particles uniformly on line.
@ CUBIC
Cubic close packing.
@ THOMAS_COUCHMAN
Modification of the standard M4 B-spline kernel, used to avoid particle clustering.
@ GAUSSIAN
Gaussian function.
@ FOURTH_ORDER_SPLINE
M5 B-spline (piecewise 4th-order polynomial)
@ CORE_TRIANGLE
Core Triangle (CT) kernel by Read et al. (2010)
@ WENDLAND_C2
Wendland kernel C2.
@ TRIANGLE
Simple triangle (piecewise linear) kernel.
@ WENDLAND_C6
Wendland kernel C6.
@ WENDLAND_C4
Wendland kernel C4.
@ CUBIC_SPLINE
M4 B-spline (piecewise cubic polynomial)
@ SCALAR_GRADY_KIPP
Grady-Kipp model of fragmentation using scalar damage.
@ TENSOR_GRADY_KIPP
Grady-Kipp model of fragmentation using tensor damage.
@ MIE_GRUNEISEN
Mie-Gruneisen equation of state.
@ TAIT
Tait equation of state for simulations of liquids.
@ IDEAL_GAS
Equation of state for ideal gas.
@ NONE
No equation of state.
@ TILLOTSON
Tillotson (1962) equation of state.
@ MURNAGHAN
Murnaghan equation of state.
@ SIMPLIFIED_TILLOTSON
Simplified version of the Tillotson equation of state.
@ BODY_CENTER
Center point of the body. Currently used only by StabilizationSolver.
@ DIEHL_STRENGTH
Strength parameter of the Diehl's distribution.
@ PARTICLE_SORTING
If true, particles are sorted using Morton code, preserving locality in memory.
@ RHEOLOGY_DAMAGE
Model of fragmentation used within the rheological model.
@ INITIAL_DISTRIBUTION
Initial distribution of SPH particles within the domain, see DistributionEnum for options.
@ ADIABATIC_INDEX
Adiabatic index used by some equations of state (such as ideal gas)
@ EOS
Equation of state for this material, see EosEnum for options.
@ RHEOLOGY_YIELDING
Model of stress reducing used within the rheological model.
@ FIXED_PARTICLES
Creates dummy particles along the boundary.
@ SYMMETRIC
Particles are duplicated along the z=0 plane.
@ PROJECT_1D
Project all movement onto a line, effectivelly reducing the simulation to 1D.
@ KILL_ESCAPERS
Removes particles outside the domain.
@ GHOST_PARTICLES
Create ghosts to keep particles inside domain.
@ NONE
Do not use any boundary conditions (= vacuum conditions)
@ FROZEN_PARTICLES
Highest derivatives of all particles close to the boundary are set to zero.
@ PERIODIC
Periodic boundary conditions.
@ WIND_TUNNEL
Extension of Frozen Particles, pushing particles inside the domain and removing them on the other end...
@ RUN_OUTPUT_QUANTITIES
List of quantities to write to text output. Binary output always stores all quantitites.
@ DOMAIN_CENTER
Center point of the domain.
@ DOMAIN_HEIGHT
Height of a cylindrical domain.
@ RUN_LOGGER
Selected logger of a run, see LoggerEnum.
@ FINDER_LEAF_SIZE
Maximum number of particles in a leaf node.
@ SPH_KERNEL
Index of SPH Kernel, see KernelEnum.
@ GENERATE_UVWS
If true, the mapping coordinates will be computed and saved for all bodies in the simulation.
@ COLLISION_HANDLER
Specifies how the collisions of particles should be handler; see CollisionHandlerEnum.
@ SPH_SOLVER_FORCES
List of forces to compute by the solver.
@ RUN_THREAD_CNT
Number of threads used by the code. If 0, all available threads are used.
@ SPH_AV_TYPE
Type of used artificial viscosity.
@ RUN_LOGGER_FILE
Path of a file where the log is printed, used only when selected logger is LoggerEnum::FILE.
@ RUN_OUTPUT_PATH
Path where all output files (dumps, logs, ...) will be written.
@ DOMAIN_FROZEN_DIST
Distance to the boundary in units of smoothing length under which the particles are frozen.
@ SPH_SOLVER_TYPE
Selected solver for computing derivatives of physical variables.
@ GRAVITY_SOLVER
Algorithm to compute gravitational acceleration.
@ FRAME_ANGULAR_FREQUENCY
@ RUN_OUTPUT_TYPE
Selected format of the output file, see IoEnum.
@ UVW_MAPPING
Type of the UV mapping.
@ RUN_RNG
Selected random-number generator used within the run.
@ RUN_OUTPUT_FIRST_INDEX
Index of the first generated output file. Might not be zero if the simulation is resumed.
@ TIMESTEPPING_INTEGRATOR
Selected timestepping integrator.
@ GRAVITY_MULTIPOLE_ORDER
Order of multipole expansion.
@ SPH_FINDER
Structure for searching nearest neighbours of particles.
@ COLLISION_OVERLAP
Specifies how particle overlaps should be handled.
@ DOMAIN_TYPE
Computational domain, enforced by boundary conditions.
@ RUN_LOGGER_VERBOSITY
Number specifying log verbosity. Can be between 0 and 3, going from least to most verbose.
@ RUN_NAME
User-specified name of the run, used in some output files.
@ GRAVITY_RECOMPUTATION_PERIOD
@ GRAVITY_OPENING_ANGLE
Opening angle Theta for multipole approximation of gravity.
@ DOMAIN_SIZE
(Vector) size of a block domain
@ DOMAIN_BOUNDARY
Type of boundary conditions.
@ GRAVITY_CONSTANT
Gravitational constant. To be generalized.
@ GRAVITY_KERNEL
Gravity smoothing kernel.
@ DOMAIN_RADIUS
Radius of a spherical and cylindrical domain.
@ RUN_RNG_SEED
Seed for the random-number generator.
@ FINDER_MAX_PARALLEL_DEPTH
@ RUN_OUTPUT_NAME
File name of the output file (including extension), where d is a placeholder for output number.
@ BLOCK
Block with edge sizes given by vector.
@ HALF_SPACE
Half-space z>0.
@ SPHERICAL
Sphere with given radius.
@ NONE
No computational domain (can only be used with BoundaryEnum::NONE)
@ ELLIPSOIDAL
Axis-aligned ellipsoid.
@ CYLINDER
Cylindrical domain aligned with z axis.
constexpr Float gravity
Gravitational constant (CODATA 2014)
AutoPtr< ITimeStepCriterion > getTimeStepCriterion(const RunSettings &settings)
AutoPtr< IGravity > getGravity(const RunSettings &settings)
AutoPtr< IOutput > getOutput(const RunSettings &settings)
AutoPtr< ISolver > getSolver(IScheduler &scheduler, const RunSettings &settings)
AutoPtr< IFractureModel > getDamage(const BodySettings &settings)
AutoPtr< IMaterial > getMaterial(const BodySettings &settings)
AutoPtr< ISymmetricFinder > getFinder(const RunSettings &settings)
AutoPtr< ICollisionHandler > getCollisionHandler(const RunSettings &settings)
AutoPtr< IUvMapping > getUvMapping(const RunSettings &settings)
AutoPtr< IRheology > getRheology(const BodySettings &settings)
AutoPtr< IEquationTerm > getArtificialViscosity(const RunSettings &settings)
AutoPtr< IOverlapHandler > getOverlapHandler(const RunSettings &settings)
AutoPtr< ITimeStepping > getTimeStepping(const RunSettings &settings, const SharedPtr< Storage > &storage)
GravityLutKernel getGravityKernel(const RunSettings &settings)
AutoPtr< IDistribution > getDistribution(const BodySettings &settings, Function< bool(Float)> progressCallback=nullptr)
AutoPtr< ILogWriter > getLogWriter(SharedPtr< ILogger > logger, const RunSettings &settings)
AutoPtr< ILogger > getLogger(const RunSettings &settings)
AutoPtr< IEos > getEos(const BodySettings &settings)
AutoPtr< IDomain > getDomain(const RunSettings &settings)
AutoPtr< IRng > getRng(const RunSettings &settings)
LutKernel< D > getKernel(const RunSettings &settings)
AutoPtr< IBoundaryCondition > getBoundaryConditions(const RunSettings &settings, SharedPtr< IDomain > domain)
SharedPtr< IScheduler > getScheduler(const RunSettings &settings=RunSettings::getDefaults())
AutoPtr< IInput > getInput(const Path &path)
Parameters of DiehlDistribution.
DensityFunc particleDensity
Function specifies the particle density in space.
Float strength
Magnitude of a repulsive force between particles that moves them to their final locations.
Size maxDifference
Allowed difference between the expected and actual number of particles.