139 const Float Q_effOverQ_D,
153 , v_c(cutoffVelocity) {}
164 constexpr
Float theta =
PI / 4._f;
165 const Float m_frag = m_tot /
N;
166 for (
Size i = 0; i <
N; ++i) {
167 const Float phi = 2._f *
PI * rng();
182 const Float largest =
max(M_LR(QoverQ_D, M_tot), M_LF(QoverQ_D, M_tot));
183 const Float exponent = q(QoverQ_D) + 1._f;
187 fragments.
push(largest);
188 Float m_partial = largest;
189 while (M_tot - m_partial > m_min) {
190 const Float m =
pow(rng(), 1._f / exponent) - m_min;
191 if (m + m_partial > M_tot) {
202 if (QoverQ_D < 1._f) {
203 return (-0.5_f * (QoverQ_D - 1._f) + 0.5_f) * M_tot;
205 return (-0.35_f * (QoverQ_D - 1._f) + 0.5_f) * M_tot;
210 return 8.e-3_f * (QoverQ_D *
exp(-
sqr(0.25_f * QoverQ_D))) * M_tot;
214 return -10._f + 7._f *
pow(QoverQ_D, 0.4_f) *
exp(-QoverQ_D / 7._f);
Definitions of physical constaints (in SI units).
Wrapper over enum allowing setting (and querying) individual bits of the stored value.
Float getImpactEnergy(const Float R, const Float r, const Float v)
Computes the impact energy Q from impact parameters.
Float getEffectiveImpactArea(const Float R, const Float r, const Float phi)
Returns the the ratio of the cross-sectional area of the impact and the total area of the impactor.
Float evalBenzAsphaugScalingLaw(const Float D, const Float rho)
Returns the critical energy Q_D^* as a function of body diameter.
INLINE Float getCriticalFrequency(const Float rho)
Computes the critical (break-up) angular velocity of a body.
Float getImpactorRadius(const Float R_pb, const Float v_imp, const Float QOverQ_D, const Float rho)
Calculates the impactor radius to satisfy required impact parameters.
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.
constexpr INLINE T max(const T &f1, const T &f2)
NAMESPACE_SPH_BEGIN constexpr INLINE T min(const T &f1, const T &f2)
Minimum & Maximum value.
constexpr INLINE Float pow< 5 >(const Float v)
constexpr INLINE T sqr(const T &f) noexcept
Return a squared value.
INLINE T sqrt(const T f)
Return a squared root of a value.
constexpr INLINE Float pow< 3 >(const Float v)
constexpr INLINE Float pow(const Float v)
Power for floats.
constexpr INLINE Float sphereVolume(const Float radius)
Computes a volume of a sphere given its radius.
constexpr Float PI
Mathematical constants.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
Random number generators.
Basic algebra for symmetric 2nd order tensors.
INLINE SymmetricTensor symmetricOuter(const Vector &v1, const Vector &v2)
SYMMETRIZED outer product of two vectors.
INLINE Float getLength(const Vector &v)
Returns the length of the vector. Enabled only for vectors of floating-point precision.
INLINE Float getSqrLength(const Vector &v)
INLINE Vector sphericalToCartesian(const Float r, const Float theta, const Float phi)
Constructs a vector from spherical coordinates.
INLINE Vector translation() const
Properties of a homogeneous sphere in rest (no temporal derivatives)
INLINE Float getPressure(const Float r) const
Return the pressure at given radius r of a sphere self-compressed by gravity.
INLINE Vector getAcceleration(const Vector &r) const
Returns the gravitational acceleration at given radius r.
INLINE Float getEnergy() const
Returns the gravitational potential energy of the sphere.
StaticSphere(const Float r0, const Float rho)
Generic dynamically allocated resizable storage.
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
Array< Float > operator()(const Float QoverQ_D, const Float M_tot, const Float m_min)
ImpactCone(const AffineMatrix &frame, const Float cutoffVelocity)
void getFragments(const Float m_tot, const Size N, Array< Vector > &r, Array< Vector > &v, Array< Float > &m)
Generates fragments at the impact point.
Symmetric tensor of 2nd order.
static INLINE SymmetricTensor identity()
Returns an identity tensor.
Contains analytic solutions of equations.
constexpr Float gravity
Gravitational constant (CODATA 2014)
INLINE SymmetricTensor sphereInertia(const Float m, const Float r)
Computes the inertia tensor of a homogeneous sphere.
INLINE SymmetricTensor parallelAxisTheorem(const SymmetricTensor &I, const Float m, const Vector &a)
Computes the inertia tensor with respect to given point.