17 const Float z0 = 1.e-3_f;
20 while (phi >= 0._f && z < z_max) {
22 const Float d2phi = -2._f / z * dphi -
pow(phi, n);
45 const Float rho_c = 3._f * mass / (4._f *
PI *
pow<3>(
radius)) * z_star / (-3._f * dphi_star);
51 const Size i = el.index();
52 const Float x = el.value().y;
53 rho[i] = rho_c *
pow(x, n);
54 P[i] = P_c *
pow(x, n + 1);
82 for (
Size i = 0; i < points.
size(); ++i) {
99 for (
Size i = 0; i < points.
size(); ++i) {
103 Storage storage(makeShared<EosMaterial>(body));
Definitions of physical constaints (in SI units).
Filling spatial domain with SPH particles.
Object defining computational domain.
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.
Helper objects allowing to iterate in reverse, iterate over multiple containeres, etc.
IndexAdapter< TContainer > iterateWithIndex(TContainer &&container)
SPH-specific implementation of particle materials.
constexpr INLINE T sqr(const T &f) noexcept
Return a squared value.
constexpr INLINE Float pow< 3 >(const Float v)
constexpr INLINE Float pow< 4 >(const Float v)
constexpr INLINE Float pow(const Float v)
Power for floats.
constexpr Float PI
Mathematical constants.
#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.
Holder of quantity values and their temporal derivatives.
@ SECOND
Quantity with 1st and 2nd derivative.
@ ZERO
Quantity without derivatives, or "zero order" of quantity.
SequentialScheduler SEQUENTIAL
Global instance of the sequential scheduler.
Interface for executing tasks (potentially) asynchronously.
INLINE Float getLength(const Vector &v)
Returns the length of the vector. Enabled only for vectors of floating-point precision.
BasicVector< Float > Vector
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
INLINE TCounter size() const noexcept
Base class for generating vertices with specific distribution.
virtual Array< Vector > generate(IScheduler &scheduler, const Size n, const IDomain &domain) const =0
Generates the requested number of particles in the domain.
Equation of state for ideal gas.
virtual Float getInternalEnergy(const Float rho, const Float p) const override
Inverted function; computes specific internal energy u from given density rho and pressure p.
Object representing a 1D interval of real numbers.
INLINE Float upper() const
Returns upper bound of the interval.
Lut derivative() const
Computes the derivative of the function.
Interval getRange() const
Returns the definition interval of the function.
Size size() const
Returns the number of tabulated value.
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.
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.
Spherical domain, defined by the center of sphere and its radius.
virtual Float getVolume() const override
Returns the total volume of the domain.
Container storing all quantities used within the simulations.
Quantity & insert(const QuantityId key, const OrderEnum order, const TValue &defaultValue)
Creates a quantity in the storage, given its key, value type and order.
Creating code components based on values from settings.
@ NONE
Gass or material with no stress tensor.
@ IDEAL_GAS
Equation of state for ideal gas.
@ RHEOLOGY_DAMAGE
Model of fragmentation used within the rheological model.
@ DENSITY_RANGE
Allowed range of density. Densities of all particles all clamped to fit in the range.
@ ADIABATIC_INDEX
Adiabatic index used by some equations of state (such as ideal gas)
@ SMOOTHING_LENGTH_ETA
Eta-factor between smoothing length and particle concentration (h = eta * n^(-1/d) )
@ EOS
Equation of state for this material, see EosEnum for options.
@ RHEOLOGY_YIELDING
Model of stress reducing used within the rheological model.
constexpr Float gravity
Gravitational constant (CODATA 2014)
Star polytropicStar(const Float radius, const Float mass, const Float n)
Computes radial profiles of state quantities for a polytropic star.
Lut< Float > solveLaneEmden(const Float n, const Float dz=1.e-3_f, const Float z_max=1.e3_f)
Solves the Lane-Emden equation given the polytrope index.
Storage generateIc(const IDistribution &distribution, const Size particleCnt, const Float radius, const Float mass, const Float n)
Creates a spherical polytropic star.