52 return alpha == other.alpha && beta == other.beta && sig == other.sig;
55 template <
bool Symmetrize>
57 const Float eps = 1.e-6_f;
59 const Float rho_bar = 0.5_f * (rho[i] + rho[j]);
62 vu_sig =
sgn((p[i] - p[j]) * (u[i] - u[j])) *
sqrt(
abs(p[i] - p[j]) / rho_bar);
65 vu_sig =
abs(
dot(v[i] - v[j], e));
67 const Float a = alpha * vu_sig * (u[i] - u[j]);
68 const Float heat = a *
dot(e, grad) / rho_bar;
82 "Artificial conductivity with pressure-based signal speed cannot be used with forces other "
83 "than pressure gradient. Consider using the velocity-based signal speed instead.");
88 derivatives.
require(makeAuto<Derivative>(settings));
@ SHARED
Multiple derivatives may accumulate into the buffer.
#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.
INLINE T sqrt(const T f)
Return a squared root of a value.
INLINE int sgn(const T val)
INLINE auto abs(const T &f)
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
@ PRESSURE
Pressure, affected by yielding and fragmentation model, always a scalar quantity.
@ POSITION
Positions (velocities, accelerations) of particles, always a vector quantity,.
@ ENERGY
Specific internal energy, always a scalar quantity.
@ DENSITY
Density, always a scalar quantity.
@ MASS
Paricles masses, always a scalar quantity.
@ SOUND_SPEED
Sound speed, always a scalar quantity.
@ FIRST
Quantity with 1st derivative.
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...
Storage for accumulating derivatives.
Array< TValue > & getBuffer(const QuantityId id, const OrderEnum order)
Returns the buffer of given quantity and given order.
void insert(const QuantityId id, const OrderEnum order, const BufferSource source)
Creates a new storage with given ID.
Object providing safe access to continuous memory of data.
Derivative(const RunSettings &settings)
INLINE void additionalCreate(Accumulated &results)
INLINE void additionalInitialize(const Storage &storage, Accumulated &results)
INLINE bool additionalEquals(const Derivative &other) const
INLINE void eval(const Size i, const Size j, const Vector &grad)
Artificial thermal conductivity.
virtual void create(Storage &UNUSED(storage), IMaterial &UNUSED(material)) const override
ArtificialConductivity(const RunSettings &settings)
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 finalize(IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const Float UNUSED(t)) override
Container holding derivatives and the storage they accumulate to.
virtual void require(AutoPtr< IDerivative > &&derivative)
Adds derivative if not already present.
Helper template for derivatives that define both the symmetrized and asymmetric variant.
Wrapper of an integral value providing functions for reading and modifying individual bits.
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.
Thrown when components of the run are mutually incompatible.
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.
Container storing all quantities used within the simulations.
Array< TValue > & getDt(const QuantityId key)
Retrieves a quantity derivative from the storage, given its key and value type.
auto getValues(const QuantityId first, const QuantityId second, const TArgs... others)
Retrieves an array of quantities from the key.
Array< TValue > & getValue(const QuantityId key)
Retrieves a quantity values from the storage, given its key and value type.
@ PRESSURE
Use force from pressure gradient in the solver.
@ PRESSURE_DIFFERENCE
Signal speed given by the absolute value of pressure difference, as in Price (2008)
@ VELOCITY_DIFFERENCE
Signal speed given by relative velocity projected to the positive vector, as in Valdarnini (2018),...
@ SPH_SOLVER_FORCES
List of forces to compute by the solver.
@ SPH_AC_ALPHA
Artificial conductivity alpha coefficient.
@ SPH_AC_BETA
Artificial conductivity beta coefficient.
@ SPH_AC_SIGNAL_SPEED
Type of the signal speed used by artificial conductivity.