SPH
|
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>
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... | |
![]() | |
virtual | ~Polymorphic () |
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)\)
|
inlineexplicit |
|
inlineoverridevirtual |
Creates all quantities needed by the term using given material.
Called once for every body in the simulation.
Implements IEquationTerm.
|
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.
|
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.
|
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.