99 void enforce(
const Size i,
151 bool useCorrectionTensor;
246 if (term !=
nullptr) {
264 template <
typename Term>
266 static_assert(std::is_base_of<IEquationTerm, Term>::value,
"Can be used only for terms");
267 for (
const auto& ptr : terms) {
269 if (
typeid(term) ==
typeid(Term)) {
278 for (
const auto& term : terms) {
279 term->setDerivatives(derivatives, settings);
285 for (
const auto& term : terms) {
286 term->initialize(scheduler, storage, t);
294 for (
const auto& term :
reverse(terms)) {
295 term->finalize(scheduler, storage, t);
301 for (
const auto& term : terms) {
302 term->create(storage, material);
311 template <
typename Term,
typename... TArgs>
313 return EquationHolder(makeShared<Term>(std::forward<TArgs>(args)...));
Definitions of physical constaints (in SI units).
INLINE EquationHolder makeTerm(TArgs &&... args)
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 int DIMENSIONS
Number of spatial dimensions in the code.
Helper objects allowing to iterate in reverse, iterate over multiple containeres, etc.
ReverseAdapter< TContainer > reverse(TContainer &&container)
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
Container for storing particle quantities and materials.
Evolutionary equation for the (scalar) smoothing length.
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.
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.
Size dimensions
Number of spatial dimensions of the simulation. This should match the dimensions of the SPH kernel.
struct AdaptiveSmoothingLength::@17 enforcing
Object providing safe access to continuous memory of data.
Generic dynamically allocated resizable storage.
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
INLINE TCounter size() const noexcept
void pushAll(const TIter first, const TIter last)
Helper term to keep smoothing length constant during the simulation.
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.
Equation for evolution of density.
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.
Container holding equation terms.
EquationHolder(const SharedPtr< IEquationTerm > &term)
EquationHolder & operator+=(const EquationHolder &other)
void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings) const
Calls EquationTerm::setDerivatives for all stored equation terms.
bool contains() const
Checks if the holder contains term of given type.
void create(Storage &storage, IMaterial &material) const
Calls EquationTerm::create for all stored equation terms.
EquationHolder operator+(const EquationHolder &other) const
void initialize(IScheduler &scheduler, Storage &storage, const Float t)
Calls EquationTerm::initialize for all stored equation terms.
void finalize(IScheduler &scheduler, Storage &storage, const Float t)
Calls EquationTerm::finalize for all stored equation terms.
Represents a term or terms appearing in evolutionary equations.
virtual void finalize(IScheduler &scheduler, Storage &storage, const Float t)=0
Computes all the derivatives and/or quantity values based on accumulated derivatives.
virtual void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings)=0
Sets derivatives required by this term.
virtual void initialize(IScheduler &scheduler, Storage &storage, const Float t)=0
Initialize all the derivatives and/or quantity values before derivatives are computed.
virtual void create(Storage &storage, IMaterial &material) const =0
Creates all quantities needed by the term using given material.
Material settings and functions specific for one material.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Object representing a 1D interval of real numbers.
Navier-Stokes equation of motion.
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.
Equation of motion due to pressure gradient.
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.
Equation of motion for solid body and constitutive equation for the stress tensor (Hooke's law)
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.
Container storing all quantities used within the simulations.
Base class for all polymorphic objects.