SPH
EquationTerm.cpp
Go to the documentation of this file.
2 #include "objects/Exceptions.h"
3 #include "sph/Materials.h"
5 #include "sph/kernel/Kernel.h"
6 #include "system/Factory.h"
7 #include "thread/Scheduler.h"
8 
10 
14 
15 public:
16  void initialize(const Storage& input) {
17  rho = input.getValue<Float>(QuantityId::DENSITY);
18  }
19 
20  template <typename T>
21  INLINE T eval(const Size i, const Size j, const T& vi, const T& vj) const {
22  return vi / sqr(rho[i]) + vj / sqr(rho[j]);
23  }
24 };
25 
29 
30 public:
31  void initialize(const Storage& input) {
32  rho = input.getValue<Float>(QuantityId::DENSITY);
33  }
34 
35  template <typename T>
36  INLINE T eval(const Size i, const Size j, const T& vi, const T& vj) const {
37  return (vi + vj) / (rho[i] * rho[j]);
38  }
39 };
40 
41 template <typename Discr>
42 class PressureGradient : public AccelerationTemplate<PressureGradient<Discr>> {
43 private:
45  Discr discr;
46 
47 public:
49 
51 
52  INLINE void additionalInitialize(const Storage& input, Accumulated& UNUSED(results)) {
54  discr.initialize(input);
55  }
56 
57  INLINE bool additionalEquals(const PressureGradient& UNUSED(other)) const {
58  return true;
59  }
60 
61  template <bool Symmetric>
62  INLINE Tuple<Vector, Float> eval(const Size i, const Size j, const Vector& grad) {
63  const Vector f = discr.eval(i, j, p[i], p[j]) * grad;
64  SPH_ASSERT(isReal(f));
65  return { -f, 0._f };
66  }
67 };
68 
69 void PressureForce::setDerivatives(DerivativeHolder& derivatives, const RunSettings& settings) {
70  const DiscretizationEnum formulation =
72  switch (formulation) {
76  break;
80  break;
81  default:
83  }
84 }
85 
87  Storage& UNUSED(storage),
88  const Float UNUSED(t)) {}
89 
90 void PressureForce::finalize(IScheduler& scheduler, Storage& storage, const Float UNUSED(t)) {
95  parallelFor(scheduler, 0, du.size(), [&](const Size i) INL { //
96  du[i] -= p[i] / rho[i] * divv[i];
97  SPH_ASSERT(isReal(du[i]));
98  });
99 }
100 
101 void PressureForce::create(Storage& storage, IMaterial& material) const {
102  if (!dynamic_cast<EosMaterial*>(&material)) {
103  throw InvalidSetup("PressureForce needs to be used with EosMaterial or derived");
104  }
105  const Float u0 = material.getParam<Float>(BodySettingsId::ENERGY);
108  // need to create quantity for velocity divergence so that we can save it to storage later
110 }
111 
112 
113 template <typename Discr>
114 class StressDivergence : public AccelerationTemplate<StressDivergence<Discr>> {
115 private:
117  Discr discr;
118 
119 public:
120  explicit StressDivergence(const RunSettings& settings)
122 
124 
125  INLINE void additionalInitialize(const Storage& input, Accumulated& UNUSED(results)) {
127  discr.initialize(input);
128  }
129 
130  INLINE bool additionalEquals(const StressDivergence& UNUSED(other)) const {
131  return true;
132  }
133 
134  template <bool Symmetrize>
135  INLINE Tuple<Vector, Float> eval(const Size i, const Size j, const Vector& grad) {
136  const Vector f = discr.eval(i, j, s[i], s[j]) * grad;
137  SPH_ASSERT(isReal(f));
138  return { f, 0._f };
139  }
140 };
141 
143  // the correction tensor is associated with velocity gradient, which we are creating in this term, so we
144  // need to also create the correction tensor (if requested)
148  useCorrectionTensor = settings.get<bool>(RunSettingsId::SPH_STRAIN_RATE_CORRECTION_TENSOR);
149 }
150 
151 void SolidStressForce::setDerivatives(DerivativeHolder& derivatives, const RunSettings& settings) {
152  derivatives.require(makeDerivative<VelocityGradient>(
155  if (useCorrectionTensor) {
156  derivatives.require(makeAuto<CorrectionTensor>(settings));
157  }
158 
159  const DiscretizationEnum formulation =
161  switch (formulation) {
163  derivatives.require(makeAuto<StressDivergence<StandardForceDiscr>>(settings));
164  break;
167  break;
168  default:
170  }
171 }
172 
174  Storage& UNUSED(storage),
175  const Float UNUSED(t)) {}
176 
177 void SolidStressForce::finalize(IScheduler& scheduler, Storage& storage, const Float UNUSED(t)) {
183 
184  for (Size matIdx = 0; matIdx < storage.getMaterialCnt(); ++matIdx) {
185  MaterialView material = storage.getMaterial(matIdx);
186  const YieldingEnum yield = material->getParam<YieldingEnum>(BodySettingsId::RHEOLOGY_YIELDING);
187  if (yield == YieldingEnum::NONE) {
188  // no rheology, do not integrate stress tensor
189  continue;
190  }
191  const Float mu = material->getParam<Float>(BodySettingsId::SHEAR_MODULUS);
192  IndexSequence seq = material.sequence();
193  parallelFor(scheduler, *seq.begin(), *seq.end(), [&](const Size i) INL {
194  du[i] += 1._f / rho[i] * ddot(s[i], gradv[i]);
195 
196  // Hooke's law
197  TracelessTensor dev(gradv[i] - SymmetricTensor::identity() * gradv[i].trace() / 3._f);
198  ds[i] += 2._f * mu * dev;
199  SPH_ASSERT(isReal(du[i]) && isReal(ds[i]));
200  });
201  }
202 }
203 
204 void SolidStressForce::create(Storage& storage, IMaterial& material) const {
207  const Float s_min = material.getParam<Float>(BodySettingsId::STRESS_TENSOR_MIN);
209 
212  // storage.insert<Vector>(QuantityId::VELOCITY_ROTATION, OrderEnum::ZERO, Vector(0._f));
213 
214  if (useCorrectionTensor) {
215  storage.insert<SymmetricTensor>(
217  }
218 }
219 
222  TODO("implement");
223  // no need to do 'hacks' with gradient for fluids
224  derivatives.require(makeDerivative<VelocityGradient>(settings, DerivativeFlag::CORRECTED));
225 }
226 
228  Storage& UNUSED(storage),
229  const Float UNUSED(t)) {
230  TODO("implement");
231 }
232 
233 void NavierStokesForce::finalize(IScheduler& UNUSED(scheduler), Storage& storage, const Float UNUSED(t)) {
239 
240  TODO("parallelize");
241  for (Size matIdx = 0; matIdx < storage.getMaterialCnt(); ++matIdx) {
242  MaterialView material = storage.getMaterial(matIdx);
243  const Float mu = material->getParam<Float>(BodySettingsId::SHEAR_MODULUS);
244  for (Size i : material.sequence()) {
245  du[i] += 1._f / rho[i] * ddot(s[i], gradv[i]);
247  TracelessTensor dev(gradv[i] - SymmetricTensor::identity() * gradv[i].trace() / 3._f);
248  ds[i] += 2._f * mu * dev;
249  SPH_ASSERT(isReal(du[i]) && isReal(ds[i]));
250  }
251  }
252 }
253 
254 void NavierStokesForce::create(Storage& storage, IMaterial& material) const {
259 }
260 
261 
264 
265  LutKernel<3> kernel = Factory::getKernel<3>(settings);
266  // central value of the kernel
267  w0 = kernel.valueImpl(0);
268 }
269 
271  // this formulation uses equation \dot \rho_i = m_i \sum_j m_j/rho_j \nabla \cdot \vec v where the
272  // velocity divergence is taken either directly, or as a trace of strength velocity gradient, see
273  // below.
275  if (forces.has(ForceEnum::SOLID_STRESS)) {
277  derivatives.require(makeDerivative<VelocityGradient>(settings, flags));
278  } else if (mode == ContinuityEnum::SUM_ONLY_UNDAMAGED) {
279  throw InvalidSetup("This mode of the continuity equation requires stress tensor.");
280  }
281  derivatives.require(makeDerivative<VelocityDivergence>(settings));
282 }
283 
284 void ContinuityEquation::initialize(IScheduler& scheduler, Storage& storage, const Float UNUSED(t)) {
290  parallelFor(scheduler, 0, rho.size(), [&](const Size i) INL {
291  if (bulk[i] < rho[i]) {
292  const Float D = pow<3>(damage[i]);
293  p[i] = (1._f - D) * p[i];
294  }
295  });
296  }
297 }
298 
299 void ContinuityEquation::finalize(IScheduler& scheduler, Storage& storage, const Float UNUSED(t)) {
300  ArrayView<Float> rho, drho;
301  tie(rho, drho) = storage.getAll<Float>(QuantityId::DENSITY);
303 
304  switch (mode) {
306  parallelFor(scheduler, 0, rho.size(), [&](const Size i) INL { //
307  drho[i] += -rho[i] * divv[i];
308  });
309  break;
314  parallelFor(scheduler, 0, rho.size(), [&](const Size i) INL {
315  if (reduce[i] > 0._f) {
316  drho[i] += -rho[i] * gradv[i].trace();
317  } else {
318  drho[i] += -rho[i] * divv[i];
319  }
320  });
321  break;
322  }
325  ArrayView<Float> bulk, dbulk;
326  tie(bulk, dbulk) = storage.getAll<Float>(QuantityId::BULK_DENSITY);
327  parallelFor(scheduler, 0, rho.size(), [&](const Size i) INL {
328  if (bulk[i] >= rho[i] && divv[i] < 0._f) {
329  drho[i] += -rho[i] * divv[i];
330  } else {
331  drho[i] += -reduce[i] * rho[i] * divv[i];
332  }
333 
334  dbulk[i] += -bulk[i] * divv[i];
335  });
336  break;
337  }
338  default:
340  }
341 }
342 
343 void ContinuityEquation::create(Storage& storage, IMaterial& material) const {
344  const Float rho0 = material.getParam<Float>(BodySettingsId::DENSITY);
346 
347  // set minimal density based on masses and smoothing kernel
350  Float rhoLimit = LARGE;
351  for (Size i = 0; i < r.size(); ++i) {
352  rhoLimit = min(rhoLimit, m[i] * w0 / pow<3>(r[i][H]));
353  }
354  const Interval rhoRange = material.getParam<Interval>(BodySettingsId::DENSITY_RANGE);
355  const Float rhoSmall = material.getParam<Float>(BodySettingsId::DENSITY_MIN);
356  const Float rho_min = max(rhoLimit, rhoRange.lower());
357  const Float rho_max = rhoRange.upper();
358  material.setRange(QuantityId::DENSITY, Interval(rho_min, rho_max), rhoSmall);
359 
361 
364  material.setRange(QuantityId::BULK_DENSITY, Interval(rho_min, rho_max), rhoSmall);
365  }
366 }
367 
368 
370  : dimensions(dimensions) {
376  } else {
377  enforcing.strength = -INFTY;
378  }
380 }
381 
383  derivatives.require(makeDerivative<VelocityDivergence>(settings));
384 }
385 
387  Storage& storage,
388  const Float UNUSED(t)) {
390  // clamp smoothing lengths
391  for (Size i = 0; i < r.size(); ++i) {
392  r[i][H] = max(r[i][H], minimal);
393  }
394 }
395 
396 void AdaptiveSmoothingLength::finalize(IScheduler& scheduler, Storage& storage, const Float UNUSED(t)) {
397  ArrayView<const Float> divv, cs;
400  ArrayView<Vector> r, v, dv;
401  tie(r, v, dv) = storage.getAll<Vector>(QuantityId::POSITION);
402 
403  parallelFor(scheduler, 0, r.size(), [&](const Size i) INL {
404  // 'continuity equation' for smoothing lengths
405  if (r[i][H] > 2._f * minimal) {
406  v[i][H] = r[i][H] / dimensions * divv[i];
407  } else {
408  v[i][H] = 0._f;
409  }
410 
412  // no acceleration of smoothing lengths (we evolve h as first-order quantity)
413  dv[i][H] = 0._f;
414 
415  this->enforce(i, v, cs, neighCnt);
416  });
417 }
418 
419 void AdaptiveSmoothingLength::create(Storage& storage, IMaterial& UNUSED(material)) const {
421 }
422 
423 INLINE void AdaptiveSmoothingLength::enforce(const Size i,
426  ArrayView<const Size> neighCnt) {
427  if (enforcing.strength <= -1.e2_f) {
428  // too weak enforcing, effectively has no effect
429  return;
430  }
431 
432  // check upper limit of neighbour count
433  const Float dn1 = neighCnt[i] - enforcing.range.upper();
434  SPH_ASSERT(dn1 < neighCnt.size());
435  if (dn1 > 0._f) {
436  // sound speed is used to add correct dimensions to the term
437  v[i][H] -= exp(enforcing.strength * dn1) * cs[i];
438  return;
439  }
440  // check lower limit of neighbour count
441  const Float dn2 = enforcing.range.lower() - neighCnt[i];
442  SPH_ASSERT(dn2 < neighCnt.size());
443  if (dn2 > 0._f) {
444  v[i][H] += exp(enforcing.strength * dn2) * cs[i];
445  }
446 
447  SPH_ASSERT(isReal(v[i]));
448 }
449 
451  const RunSettings& UNUSED(settings)) {}
452 
454  Storage& UNUSED(storage),
455  const Float UNUSED(t)) {}
456 
457 void ConstSmoothingLength::finalize(IScheduler& scheduler, Storage& storage, const Float UNUSED(t)) {
458  ArrayView<Vector> r, v, dv;
459  tie(r, v, dv) = storage.getAll<Vector>(QuantityId::POSITION);
460  parallelFor(scheduler, 0, r.size(), [&v, &dv](const Size i) INL {
461  v[i][H] = 0._f;
462  dv[i][H] = 0._f;
463  });
464 }
465 
466 void ConstSmoothingLength::create(Storage& UNUSED(storage), IMaterial& UNUSED(material)) const {}
467 
INLINE bool isReal(const AntisymmetricTensor &t)
INLINE Float ddot(const AntisymmetricTensor &t1, const AntisymmetricTensor &t2)
Double-dot product t1 : t2 = sum_ij t1_ij t2_ij.
#define SPH_ASSERT(x,...)
Definition: Assert.h:94
#define TODO(x)
Definition: Assert.h:84
#define NOT_IMPLEMENTED
Helper macro marking missing implementation.
Definition: Assert.h:100
INLINE AutoPtr< T > makeAuto(TArgs &&... args)
Definition: AutoPtr.h:124
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
DerivativeFlag
@ SUM_ONLY_UNDAMAGED
Only undamaged particles (particles with damage > 0) from the same body (body with the same flag) wil...
@ CORRECTED
Use correction tensor on kernel gradient when evaluating the derivative.
Right-hand side term of SPH equations.
uint32_t Size
Integral type used to index arrays (by default).
Definition: Globals.h:16
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Definition: Globals.h:13
SPH kernels.
SPH-specific implementation of particle materials.
constexpr INLINE T max(const T &f1, const T &f2)
Definition: MathBasic.h:20
NAMESPACE_SPH_BEGIN constexpr INLINE T min(const T &f1, const T &f2)
Minimum & Maximum value.
Definition: MathBasic.h:15
constexpr INLINE T sqr(const T &f) noexcept
Return a squared value.
Definition: MathUtils.h:67
constexpr INLINE Float pow< 3 >(const Float v)
Definition: MathUtils.h:132
constexpr Float INFTY
Definition: MathUtils.h:38
INLINE T exp(const T f)
Definition: MathUtils.h:269
constexpr Float LARGE
Definition: MathUtils.h:34
#define INLINE
Macros for conditional compilation based on selected compiler.
Definition: Object.h:31
#define UNUSED(x)
Definition: Object.h:37
#define NAMESPACE_SPH_END
Definition: Object.h:12
#define INL
Definition: Object.h:32
@ BULK_DENSITY
Bulk density, may be lower than the material density.
@ VELOCITY_DIVERGENCE
Velocity divergence.
@ STRAIN_RATE_CORRECTION_TENSOR
Correction tensor used to improve conservation of total angular momentum.
@ DEVIATORIC_STRESS
Deviatoric stress tensor, always a traceless tensor.
@ PRESSURE
Pressure, affected by yielding and fragmentation model, always a scalar quantity.
@ VELOCITY_GRADIENT
Velocity gradient.
@ DAMAGE
Damage.
@ 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.
@ NEIGHBOUR_CNT
Number of neighbouring particles (in radius h * kernel.radius)
@ SOUND_SPEED
Sound speed, always a scalar quantity.
@ STRESS_REDUCING
Total stress reduction factor due to damage and yielding. Is always scalar.
@ FIRST
Quantity with 1st derivative.
@ ZERO
Quantity without derivatives, or "zero order" of quantity.
Interface for executing tasks (potentially) asynchronously.
INLINE void parallelFor(IScheduler &scheduler, const Size from, const Size to, TFunctor &&functor)
Executes a functor concurrently from all available threads.
Definition: Scheduler.h:98
StaticArray< T0 &, sizeof...(TArgs)+1 > tie(T0 &t0, TArgs &... rest)
Creates a static array from a list of l-value references.
Definition: StaticArray.h:281
@ H
Definition: Vector.h:25
Helper template specifically used to implement forces.
AccelerationTemplate(const RunSettings &settings, const Flags< DerivativeFlag > flags=EMPTY_FLAGS)
Storage for accumulating derivatives.
Definition: Accumulated.h:30
AdaptiveSmoothingLength(const RunSettings &settings, const Size dimensions=DIMENSIONS)
virtual void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings) override
Sets derivatives required by this term.
Float minimal
Minimal allowed value of the smoothing length.
Definition: EquationTerm.h:71
virtual void finalize(IScheduler &scheduler, Storage &storage, const Float t) override
Computes all the derivatives and/or quantity values based on accumulated derivatives.
virtual void initialize(IScheduler &scheduler, Storage &storage, const Float t) override
Initialize all the derivatives and/or quantity values before derivatives are computed.
virtual void create(Storage &storage, IMaterial &material) const override
Creates all quantities needed by the term using given material.
struct AdaptiveSmoothingLength::@17 enforcing
INLINE TCounter size() const
Definition: ArrayView.h:101
Discretization of pressure term in code SPH5.
INLINE T eval(const Size i, const Size j, const T &vi, const T &vj) const
void initialize(const Storage &input)
virtual void finalize(IScheduler &scheduler, Storage &storage, const Float t) override
Computes all the derivatives and/or quantity values based on accumulated derivatives.
virtual void create(Storage &storage, IMaterial &material) const override
Creates all quantities needed by the term using given material.
virtual void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings) override
Sets derivatives required by this term.
virtual void initialize(IScheduler &scheduler, Storage &storage, const Float t) override
Initialize all the derivatives and/or quantity values before derivatives are computed.
virtual void initialize(IScheduler &scheduler, Storage &storage, const Float t) override
Initialize all the derivatives and/or quantity values before derivatives are computed.
virtual void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings) override
Sets derivatives required by this term.
ContinuityEquation(const RunSettings &settings)
virtual void create(Storage &storage, IMaterial &material) const override
Creates all quantities needed by the term using given material.
virtual void finalize(IScheduler &scheduler, Storage &storage, const Float t) override
Computes all the derivatives and/or quantity values based on accumulated derivatives.
Container holding derivatives and the storage they accumulate to.
Definition: Derivative.h:173
virtual void require(AutoPtr< IDerivative > &&derivative)
Adds derivative if not already present.
Definition: Derivative.cpp:77
Material holding equation of state.
Definition: Materials.h:21
Wrapper of an integral value providing functions for reading and modifying individual bits.
Definition: Flags.h:20
constexpr INLINE bool has(const TEnum flag) const
Checks if the object has a given flag.
Definition: Flags.h:77
Material settings and functions specific for one material.
Definition: IMaterial.h:110
INLINE TValue getParam(const BodySettingsId paramIdx) const
Returns a parameter associated with given particle.
Definition: IMaterial.h:137
void setRange(const QuantityId id, const Interval &range, const Float minimal)
Sets the timestepping parameters of given quantity.
Definition: IMaterial.cpp:17
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Definition: Scheduler.h:27
Object representing a 1D interval of real numbers.
Definition: Interval.h:17
INLINE Float lower() const
Returns lower bound of the interval.
Definition: Interval.h:74
INLINE Float upper() const
Returns upper bound of the interval.
Definition: Interval.h:79
static Interval unbounded()
Returns an unbounded (infinite) interval.
Definition: Interval.h:109
Thrown when components of the run are mutually incompatible.
Definition: Exceptions.h:24
Non-owning wrapper of a material and particles with this material.
Definition: IMaterial.h:30
INLINE IndexSequence sequence()
Returns iterable index sequence.
Definition: IMaterial.h:75
virtual void create(Storage &storage, IMaterial &material) const override
Creates all quantities needed by the term using given material.
virtual void initialize(IScheduler &scheduler, Storage &storage, const Float t) override
Initialize all the derivatives and/or quantity values before derivatives are computed.
virtual void finalize(IScheduler &scheduler, Storage &storage, const Float t) override
Computes all the derivatives and/or quantity values based on accumulated derivatives.
virtual void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings) override
Sets derivatives required by this term.
virtual void initialize(IScheduler &scheduler, Storage &storage, const Float t) override
Initialize all the derivatives and/or quantity values before derivatives are computed.
virtual void finalize(IScheduler &scheduler, Storage &storage, const Float t) override
Computes all the derivatives and/or quantity values based on accumulated derivatives.
virtual void create(Storage &storage, IMaterial &material) const override
Creates all quantities needed by the term using given material.
virtual void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings) override
Sets derivatives required by this term.
INLINE Tuple< Vector, Float > eval(const Size i, const Size j, const Vector &grad)
INLINE void additionalCreate(Accumulated &UNUSED(results))
INLINE bool additionalEquals(const PressureGradient &UNUSED(other)) const
INLINE void additionalInitialize(const Storage &input, Accumulated &UNUSED(results))
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.
Definition: Settings.h:326
Flags< TValue > getFlags(const TEnum idx) const
Returns Flags from underlying value stored in settings.
Definition: Settings.h:348
virtual void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings) override
Sets derivatives required by this term.
virtual void initialize(IScheduler &scheduler, Storage &storage, const Float t) override
Initialize all the derivatives and/or quantity values before derivatives are computed.
virtual void create(Storage &storage, IMaterial &material) const override
Creates all quantities needed by the term using given material.
SolidStressForce(const RunSettings &settings)
virtual void finalize(IScheduler &scheduler, Storage &storage, const Float t) override
Computes all the derivatives and/or quantity values based on accumulated derivatives.
Discretization of pressure term in standard SPH formulation.
void initialize(const Storage &input)
INLINE T eval(const Size i, const Size j, const T &vi, const T &vj) const
Container storing all quantities used within the simulations.
Definition: Storage.h:230
Size getMaterialCnt() const
Return the number of materials in the storage.
Definition: Storage.cpp:437
Quantity & insert(const QuantityId key, const OrderEnum order, const TValue &defaultValue)
Creates a quantity in the storage, given its key, value type and order.
Definition: Storage.cpp:270
StaticArray< Array< TValue > &, 3 > getAll(const QuantityId key)
Retrieves quantity buffers from the storage, given its key and value type.
Definition: Storage.cpp:163
Array< TValue > & getDt(const QuantityId key)
Retrieves a quantity derivative from the storage, given its key and value type.
Definition: Storage.cpp:217
auto getValues(const QuantityId first, const QuantityId second, const TArgs... others)
Retrieves an array of quantities from the key.
Definition: Storage.h:359
MaterialView getMaterial(const Size matIdx) const
Returns an object containing a reference to given material.
Definition: Storage.cpp:366
bool has(const QuantityId key) const
Checks if the storage contains quantity with given key.
Definition: Storage.cpp:130
Array< TValue > & getValue(const QuantityId key)
Retrieves a quantity values from the storage, given its key and value type.
Definition: Storage.cpp:191
INLINE void additionalCreate(Accumulated &UNUSED(results))
INLINE Tuple< Vector, Float > eval(const Size i, const Size j, const Vector &grad)
StressDivergence(const RunSettings &settings)
INLINE void additionalInitialize(const Storage &input, Accumulated &UNUSED(results))
INLINE bool additionalEquals(const StressDivergence &UNUSED(other)) const
Symmetric tensor of 2nd order.
static INLINE SymmetricTensor identity()
Returns an identity tensor.
static INLINE SymmetricTensor null()
Returns a tensor with all zeros.
Symmetric traceless 2nd order tensor.
Heterogeneous container capable of storing a fixed number of values.
Definition: Tuple.h:146
Creating code components based on values from settings.
ForceEnum
Definition: Settings.h:658
YieldingEnum
Definition: Settings.h:743
@ NONE
Gass or material with no stress tensor.
DiscretizationEnum
Definition: Settings.h:735
@ STANDARD
P_i / rho_i^2 + P_j / rho_j^2.
@ BENZ_ASPHAUG
(P_i + P_j) / (rho_i rho_j)
ContinuityEnum
Definition: Settings.h:721
@ DAMAGED_DECREASE_BULK_DENSITY
@ STANDARD
Normal continuity equation, using velocity divergence computed from all neighbors.
@ STRESS_TENSOR
Initial values of the deviatoric stress tensor.
@ ENERGY_MIN
Estimated minimal value of energy used to determine timestepping error.
@ DENSITY_RANGE
Allowed range of density. Densities of all particles all clamped to fit in the range.
@ ENERGY
Initial specific internal energy.
@ SHEAR_MODULUS
Shear modulus mu (a.k.a Lame's second parameter) of the material.
@ DENSITY
Density at zero pressure.
@ STRESS_TENSOR_MIN
Estimated minial value of stress tensor components used to determined timestepping error.
@ ENERGY_RANGE
Allowed range of specific internal energy.
@ RHEOLOGY_YIELDING
Model of stress reducing used within the rheological model.
SmoothingLengthEnum
Definition: Settings.h:768
@ SPH_STRAIN_RATE_CORRECTION_TENSOR
@ SPH_CONTINUITY_MODE
Specifies how the density is evolved, see ContinuityEnum.
@ SPH_SOLVER_FORCES
List of forces to compute by the solver.
@ SPH_ADAPTIVE_SMOOTHING_LENGTH
Solution for evolutions of the smoothing length.
@ SPH_SMOOTHING_LENGTH_MIN
Minimal value of smoothing length.
@ SPH_DISCRETIZATION
Specifies a discretization of SPH equations; see DiscretizationEnum.