SPH
Public Member Functions | List of all members
DerivativeCriterion Class Reference

Criterion setting time step based on value-to-derivative ratio for time-dependent quantities. More...

#include <TimeStepCriterion.h>

Inheritance diagram for DerivativeCriterion:
ITimeStepCriterion Polymorphic

Public Member Functions

 DerivativeCriterion (const RunSettings &settings)
 
virtual TimeStep compute (IScheduler &scheduler, Storage &storage, Float maxStep, Statistics &stats) override
 Computes the value of the time step. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Detailed Description

Criterion setting time step based on value-to-derivative ratio for time-dependent quantities.

The value-to-derivative ratio is evaluated for each particle and each first-order quantity in the storage. This criterion ensures a constant relative error of the timestepping algorithms. Quantities that allows for (zero or negative) values, such as all vector and tensor quantities, have to be treated differently, as zero values with any non-zero derivatives would formally lead to zero time step. Therefore, all time-depended quantities have a scale value assigned. For quantity value

\[x\]

with scale value

\[x_0\]

and derivative

\[dx\]

, the time step is computed as

\[ dt = \frac{|x| + x_0}{|dx|} \]

.

The scale value can be chosen arbitrarily, it represents a transitional value between relative and absolute error of the quantity. The optimal scale value is about 0.01 to 0.1 of the typical value of the quantity in the run; for density 2700 kg/m^3, the default scale value is 50 kg/m^3. Larger scale value makes the criterion less restrictive (allowing larger time steps), and vice versa. Setting the scale value to a very large number (10^20, for example) excludes the quantity from the criterion.

The scale value can be set differently for each material. The value can be set by calling IMaterial::setRange and later obtained by IMaterial::minimal.

By default, the most restrictive time step is chosen, i.e. the lowest time step for all particles and all quantities. This can be relaxed by setting a power (parameter RunSettingsId::TIMESTEPPING_MEAN_POWER) of a mean, computed from time steps of individual particles. This makes the resulting time step more 'smooth', as it is less influenced by outliers. The lower the value of the power, the more restrictive time step.

Note
The computed mean can be quite imprecise as it uses approximative pow function. This shouldn't be an issue as there is no need for exact value of time step.
Todo:
currently only used on first-order quantities.

Definition at line 79 of file TimeStepCriterion.h.

Constructor & Destructor Documentation

◆ DerivativeCriterion()

DerivativeCriterion::DerivativeCriterion ( const RunSettings settings)
explicit

Definition at line 121 of file TimeStepCriterion.cpp.

Member Function Documentation

◆ compute()

TimeStep DerivativeCriterion::compute ( IScheduler scheduler,
Storage storage,
Float  maxStep,
Statistics stats 
)
overridevirtual

Computes the value of the time step.

Parameters
schedulerScheduler than can be used for parallelization.
storageStorage containing all physical quantities from which the time step is determined.
maxStepMaximal allowed time step.
statsUsed to save statistics of the criterion.
Returns
Computed time step and ID of criterion that determined the value.

Implements ITimeStepCriterion.

Definition at line 127 of file TimeStepCriterion.cpp.


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