41 return alpha == other.alpha;
44 template <
bool Symmetrize>
48 const Vector Pi = av * grad;
49 const Float heating = 0.5_f * av *
dot(v[i] - v[j], grad);
51 return { -Pi, heating };
55 const Float dvdr =
dot(v[i] - v[j], r[i] - r[j]);
60 const Float vsig = cs[i] + cs[j] - 3._f * w;
61 const Float rhobar = 0.5_f * (rho[i] + rho[j]);
62 return -0.5_f * alpha * vsig * w / rhobar;
67 derivatives.
require(makeAuto<Derivative>(settings));
INLINE bool isReal(const AntisymmetricTensor &t)
#define SPH_ASSERT(x,...)
Right-hand side term of SPH equations.
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.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
@ POSITION
Positions (velocities, accelerations) of particles, always a vector quantity,.
@ DENSITY
Density, always a scalar quantity.
@ SOUND_SPEED
Sound speed, always a scalar quantity.
StaticArray< T0 &, sizeof...(TArgs)+1 > tie(T0 &t0, TArgs &... rest)
Creates a static array from a list of l-value references.
Container for storing particle quantities and materials.
INLINE Float getLength(const Vector &v)
Returns the length of the vector. Enabled only for vectors of floating-point precision.
INLINE float dot(const BasicVector< float > &v1, const BasicVector< float > &v2)
Make sure the vector is trivially constructible and destructible, needed for fast initialization of a...
Helper template specifically used to implement forces.
Storage for accumulating derivatives.
Object providing safe access to continuous memory of data.
Container holding derivatives and the storage they accumulate to.
virtual void require(AutoPtr< IDerivative > &&derivative)
Adds derivative if not already present.
Represents a term or terms appearing in evolutionary equations.
Material settings and functions specific for one material.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
INLINE Tuple< Vector, Float > eval(const Size i, const Size j, const Vector &grad)
INLINE void additionalCreate(Accumulated &UNUSED(results))
INLINE bool additionalEquals(const Derivative &other) const
Derivative(const RunSettings &settings)
INLINE void additionalInitialize(const Storage &storage, Accumulated &UNUSED(results))
INLINE Float evalAv(const int i, const int j)
Artificial viscosity based on Riemann solver.
virtual void finalize(IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const Float UNUSED(t)) override
virtual void initialize(IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const Float UNUSED(t)) override
virtual void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings) override
Sets derivatives required by this term.
virtual void create(Storage &UNUSED(storage), IMaterial &UNUSED(material)) const override
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.
Container storing all quantities used within the simulations.
StaticArray< Array< TValue > &, 3 > getAll(const QuantityId key)
Retrieves quantity buffers from the storage, given its key and value type.
Array< TValue > & getValue(const QuantityId key)
Retrieves a quantity values from the storage, given its key and value type.
Heterogeneous container capable of storing a fixed number of values.
@ SPH_AV_ALPHA
Artificial viscosity alpha coefficient.