23 Float prevFactor = 1._f;
26 if (factor != prevFactor && y > 0._f) {
27 y += (1._f -
sqrt(2._f) / 2._f) * dy;
32 Float delta = (row % 2) ? 0.5_f * factor * dx : 0._f;
33 r.
push(
Vector(x + delta, y, 0._f, factor * h));
84 const Float eta = 1.5_f;
86 for (
Size i = 0; i < pos.
size(); ++i) {
88 highCnt += int(
abs(pos[i][
Y]) < 0.25_f);
97 this->solver = makeAuto<SymmetricSolver<2>>(*scheduler, settings, eqs);
99 solver->create(*storage, mat);
101 mat.create(*storage, context);
108 for (
Size i = 0; i < rho.size(); ++i) {
109 if (
abs(r[i][
Y]) < 0.25_f) {
115 const Float A = 0.025_f;
116 const Float lambda = 1._f / 6._f;
117 if (
abs(r[i][
Y] - 0.25_f) < 0.025_f) {
118 v[i][
Y] = A *
sin(-2._f *
PI * (r[i][
X] + 1._f) / lambda);
119 }
else if (
abs(r[i][
Y] + 0.25_f) < 0.025_f) {
120 v[i][
Y] = A *
sin(2._f *
PI * (r[i][
X] + 1._f) / lambda);
122 u[i] = eosmat.getEos().getInternalEnergy(rho[i], 2.5_f);
const EmptyFlags EMPTY_FLAGS
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.
TEST_CASE("Kelvin-Helmholtz", "[kh]")
INLINE T sqrt(const T f)
Return a squared root of a value.
INLINE auto abs(const T &f)
constexpr Float PI
Mathematical constants.
@ 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.
@ SECOND
Quantity with 1st and 2nd derivative.
@ ZERO
Quantity without derivatives, or "zero order" of quantity.
NAMESPACE_SPH_BEGIN EquationHolder getStandardEquations(const RunSettings &settings, const EquationHolder &other)
Standard SPH equation set, using density and specific energy as independent variables.
BasicVector< Float > Vector
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
Block aligned with coordinate axes, defined by its center and length of each side.
Helper object defining three-dimensional interval (box).
INLINE const Vector & lower() const
Returns lower bounds of the box.
INLINE const Vector & upper() const
Returns upper bounds of the box.
Material holding equation of state.
Container holding equation terms.
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.
Base class for computational domains.
virtual Box getBoundingBox() const =0
Returns the bounding box of the domain.
Material settings and functions specific for one material.
Defines the interface for a run.
Statistics run(Storage &storage)
Runs the simulation.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Object representing a 1D interval of real numbers.
INLINE bool contains(const Float &value) const
Checks whether value is inside the interval.
virtual Array< Vector > generate(IScheduler &, const Size n, const IDomain &domain) const override
Generates the requested number of particles in the domain.
virtual void setUp(SharedPtr< Storage > storage) override
Prepares the run, creates logger, output, ...
virtual void tearDown(const Storage &UNUSED(storage), const Statistics &UNUSED(stats)) 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.
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.
Object holding various statistics about current run.
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.
Array< TValue > & getDt(const QuantityId key)
Retrieves a quantity derivative from the storage, given its key and value type.
MaterialView getMaterial(const Size matIdx) const
Returns an object containing a reference to given material.
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.
@ NONE
Gass or material with no stress tensor.
@ UNIFORM_GRID
Partitioning particles into a grid uniform in space.
@ COURANT
Time step determined using CFL condition.
@ TEXT_FILE
Formatted human-readable text file.
@ EULER_EXPLICIT
Explicit (forward) 1st-order integration.
@ CUBIC_SPLINE
M4 B-spline (piecewise cubic polynomial)
@ 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.
@ ENERGY
Initial specific internal energy.
@ ADIABATIC_INDEX
Adiabatic index used by some equations of state (such as ideal gas)
@ DENSITY
Density at zero pressure.
@ EOS
Equation of state for this material, see EosEnum for options.
@ ENERGY_RANGE
Allowed range of specific internal energy.
@ RHEOLOGY_YIELDING
Model of stress reducing used within the rheological model.
@ PERIODIC
Periodic boundary conditions.
@ RUN_OUTPUT_INTERVAL
Time interval of dumping data to disk.
@ TIMESTEPPING_MAX_TIMESTEP
@ SPH_USE_AC
Enables the artificial thermal conductivity term.
@ SPH_KERNEL
Index of SPH Kernel, see KernelEnum.
@ SPH_SOLVER_FORCES
List of forces to compute by the solver.
@ SPH_AV_BETA
Artificial viscosity beta coefficient.
@ SPH_AV_ALPHA
Artificial viscosity alpha coefficient.
@ RUN_OUTPUT_PATH
Path where all output files (dumps, logs, ...) will be written.
@ TIMESTEPPING_INITIAL_TIMESTEP
@ SPH_ADAPTIVE_SMOOTHING_LENGTH
Solution for evolutions of the smoothing length.
@ RUN_OUTPUT_TYPE
Selected format of the output file, see IoEnum.
@ TIMESTEPPING_INTEGRATOR
Selected timestepping integrator.
@ TIMESTEPPING_COURANT_NUMBER
Courant number.
@ SPH_FINDER
Structure for searching nearest neighbours of particles.
@ DOMAIN_TYPE
Computational domain, enforced by boundary conditions.
@ RUN_NAME
User-specified name of the run, used in some output files.
@ DOMAIN_SIZE
(Vector) size of a block domain
@ DOMAIN_BOUNDARY
Type of boundary conditions.
@ RUN_OUTPUT_NAME
File name of the output file (including extension), where d is a placeholder for output number.
@ BLOCK
Block with edge sizes given by vector.
AutoPtr< IMaterial > getMaterial(const BodySettings &settings)
Shared data used when creating all bodies in the simulation.