SPH
Classes | Public Member Functions | List of all members
BalsaraSwitch< AV > Class Template Reference

Implementation of the Balsara switch [2], designed to reduce artificial viscosity in shear flows and avoid numerical issues, such as unphysical transport of angular momentum. More...

#include <Balsara.h>

Inheritance diagram for BalsaraSwitch< AV >:
IEquationTerm Polymorphic

Public Member Functions

 BalsaraSwitch (const RunSettings &settings)
 
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 ()
 

Detailed Description

template<typename AV>
class BalsaraSwitch< AV >

Implementation of the Balsara switch [2], designed to reduce artificial viscosity in shear flows and avoid numerical issues, such as unphysical transport of angular momentum.

Balsara switch is a template, needs another artificial viscosity as a template parameter. The template parameter shall be an IEquationTerm; Balsara switch then forward all functions (initialize, finalize, ...) to this base AV. Furthermore, the AV must define a class called Derivative with operator()(i, j), preferably force inlined, returing value \(\Pi_{ij}\) of the artificial viscosity between particles i and j.

Using this term, Balsara switch decreases the artificial viscosity by factor:

\[ f_{\rm Balsara} = \frac{| \nabla \cdot \vec v |}{|\nabla \cdot \vec v| + \|\nabla \times \vec v\| + \epsilon c_{\rm s} / h} \,. \]

To conserve the total momentum, the term is symmetrized over particle pair, \(f_{ij} = 0.5(f_i + f_j)\)

Definition at line 48 of file Balsara.h.

Constructor & Destructor Documentation

◆ BalsaraSwitch()

template<typename AV >
BalsaraSwitch< AV >::BalsaraSwitch ( const RunSettings settings)
inlineexplicit

Definition at line 103 of file Balsara.h.

Member Function Documentation

◆ create()

template<typename AV >
virtual void BalsaraSwitch< AV >::create ( Storage storage,
IMaterial material 
) const
inlineoverridevirtual

Creates all quantities needed by the term using given material.

Called once for every body in the simulation.

Implements IEquationTerm.

Definition at line 137 of file Balsara.h.

◆ finalize()

template<typename AV >
virtual void BalsaraSwitch< AV >::finalize ( IScheduler scheduler,
Storage storage,
const Float  t 
)
inlineoverridevirtual

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

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

Implements IEquationTerm.

Definition at line 120 of file Balsara.h.

◆ initialize()

template<typename AV >
virtual void BalsaraSwitch< AV >::initialize ( IScheduler scheduler,
Storage storage,
const Float  t 
)
inlineoverridevirtual

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 116 of file Balsara.h.

◆ setDerivatives()

template<typename AV >
virtual void BalsaraSwitch< AV >::setDerivatives ( DerivativeHolder derivatives,
const RunSettings settings 
)
inlineoverridevirtual

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 108 of file Balsara.h.


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