SPH
Public Member Functions | Protected Attributes | List of all members
AdaptiveSmoothingLength Class Reference

Evolutionary equation for the (scalar) smoothing length. More...

#include <EquationTerm.h>

Inheritance diagram for AdaptiveSmoothingLength:
IEquationTerm Polymorphic

Public Member Functions

 AdaptiveSmoothingLength (const RunSettings &settings, const Size dimensions=DIMENSIONS)
 
virtual void setDerivatives (DerivativeHolder &derivatives, const RunSettings &settings) override
 Sets derivatives required by this term. More...
 
virtual void initialize (IScheduler &scheduler, Storage &storage, const Float t) override
 Initialize all the derivatives and/or quantity values before derivatives are computed. More...
 
virtual void finalize (IScheduler &scheduler, Storage &storage, const Float t) override
 Computes all the derivatives and/or quantity values based on accumulated derivatives. More...
 
virtual void create (Storage &storage, IMaterial &material) const override
 Creates all quantities needed by the term using given material. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Protected Attributes

Size dimensions
 Number of spatial dimensions of the simulation. This should match the dimensions of the SPH kernel. More...
 
Float minimal
 Minimal allowed value of the smoothing length. More...
 
struct {
   Float   strength
 
   Interval   range
 
enforcing
 

Detailed Description

Evolutionary equation for the (scalar) smoothing length.

The smoothing length is evolved using first-order equation, 'mirroring' changes in density in order to keep the particle concentration approximately constant. The derivative of smoothing length \(h\) of i-th particle computed using:

\[ \frac{{\rm d} h_i}{{\rm d} t} = \frac{h_i}{D} \nabla \cdot \vec v_i \,, \]

where \(D\) is the number of spatial dimensions (3 unless specified otherwise) and \(\vec v_i\) is the velocity of the particle.

It is possible to add additional term into the equation that increases/decreases the smoothing length when number of neighbours is too low/high. This is done by setting flag SmoothingLengthEnum::SOUND_SPEED_ENFORCING to settings entry RunSettingsId::ADAPTIVE_SMOOTHING_LENGTH. The allowed range of neighbours is then controlled by RunSettingsId::SPH_NEIGHBOUR_RANGE. Note that the number of neighbours is not guaranteed to be in the given range, the actual number of neighbours cannot be precisely controlled.

Definition at line 65 of file EquationTerm.h.

Constructor & Destructor Documentation

◆ AdaptiveSmoothingLength()

AdaptiveSmoothingLength::AdaptiveSmoothingLength ( const RunSettings settings,
const Size  dimensions = DIMENSIONS 
)
explicit

Definition at line 369 of file EquationTerm.cpp.

Member Function Documentation

◆ create()

void AdaptiveSmoothingLength::create ( Storage storage,
IMaterial material 
) const
overridevirtual

Creates all quantities needed by the term using given material.

Called once for every body in the simulation.

Implements IEquationTerm.

Definition at line 419 of file EquationTerm.cpp.

◆ finalize()

void AdaptiveSmoothingLength::finalize ( IScheduler scheduler,
Storage storage,
const Float  t 
)
overridevirtual

Computes all the derivatives and/or quantity values based on accumulated derivatives.

Called every time step after derivatives are evaluated and saved to storage.

Todo:
generalize for grad v

Implements IEquationTerm.

Definition at line 396 of file EquationTerm.cpp.

◆ initialize()

void AdaptiveSmoothingLength::initialize ( IScheduler scheduler,
Storage storage,
const Float  t 
)
overridevirtual

Initialize all the derivatives and/or quantity values before derivatives are computed.

Called at the beginning of every time step. Note that derivatives need not be zeroed out manually, this is already done by timestepping (for derivatives of quantities) and solver (for accumulated values).

Implements IEquationTerm.

Definition at line 386 of file EquationTerm.cpp.

◆ setDerivatives()

void AdaptiveSmoothingLength::setDerivatives ( DerivativeHolder derivatives,
const RunSettings settings 
)
overridevirtual

Sets derivatives required by this term.

The derivatives are then automatically evaluated by the solver, the equation term can access the result in finalize function. This function is called once for each thread at the beginning of the run.

Implements IEquationTerm.

Definition at line 382 of file EquationTerm.cpp.

Member Data Documentation

◆ dimensions

Size AdaptiveSmoothingLength::dimensions
protected

Number of spatial dimensions of the simulation. This should match the dimensions of the SPH kernel.

Definition at line 68 of file EquationTerm.h.

◆ 

struct { ... } AdaptiveSmoothingLength::enforcing

◆ minimal

Float AdaptiveSmoothingLength::minimal
protected

Minimal allowed value of the smoothing length.

Definition at line 71 of file EquationTerm.h.

◆ range

Interval AdaptiveSmoothingLength::range

Definition at line 75 of file EquationTerm.h.

◆ strength

Float AdaptiveSmoothingLength::strength

Definition at line 74 of file EquationTerm.h.


The documentation for this class was generated from the following files: