SPH
|
Basic solver for integration of SPH equations. More...
#include <SymmetricSolver.h>
Classes | |
struct | ThreadData |
Public Member Functions | |
SymmetricSolver (IScheduler &scheduler, const RunSettings &settings, const EquationHolder &eqs, AutoPtr< IBoundaryCondition > &&bc) | |
Creates a symmetric solver, given the list of equations to solve. More... | |
SymmetricSolver (IScheduler &scheduler, const RunSettings &settings, const EquationHolder &eqs) | |
Creates a symmetric solver, using boundary conditions specified in settings. More... | |
~SymmetricSolver () | |
virtual void | integrate (Storage &storage, Statistics &stats) override |
Computes derivatives of all time-dependent quantities. More... | |
virtual void | create (Storage &storage, IMaterial &material) const override |
Initializes all quantities needed by the solver in the storage. More... | |
![]() | |
virtual void | collide (Storage &UNUSED(storage), Statistics &UNUSED(stats), const Float UNUSED(dt)) |
Detects the collisions and computes new positions of particles. More... | |
![]() | |
virtual | ~Polymorphic () |
Protected Member Functions | |
virtual void | loop (Storage &storage, Statistics &stats) |
virtual void | beforeLoop (Storage &storage, Statistics &stats) |
virtual void | afterLoop (Storage &storage, Statistics &stats) |
virtual RawPtr< const IBasicFinder > | getFinder (ArrayView< const Vector > r) |
virtual void | sanityCheck (const Storage &storage) const |
Used to check internal consistency of the solver. More... | |
Protected Attributes | |
IScheduler & | scheduler |
Scheduler to parallelize the solver. More... | |
ThreadLocal< ThreadData > | threadData |
Thread-local structure caching all buffers needed to compute derivatives. More... | |
EquationHolder | equations |
Holds all equation terms evaluated by the solver. More... | |
AutoPtr< IBoundaryCondition > | bc |
Boundary condition used by the solver. More... | |
AutoPtr< ISymmetricFinder > | finder |
Structure used to search for neighbouring particles. More... | |
LutKernel< Dim > | kernel |
Selected SPH kernel. More... | |
Basic solver for integration of SPH equations.
The solver takes an array of equation terms and evaluate them, using compute gradients of SPH kernel. By default, no equations are evaluated, except for a 'dummy equation' counting number of neighbours. All equations are evaluated symmetrically, meaning each particle pair is visited (at most) once and the derivatives of quantities are computed for both particles at once. All derivatives computed by the solver must be thus symmetric (i.e. derived from SymmetricDerivative). Symmetric evaluation allows faster computation, at cost of higher memory overhead (each thread has its own buffers where the computed derivatives are accumulated) and cannot be use when more than one pass over particle neighbours is needed to compute the derivative (unless the user constructs two SymmetricSolvers with different sets of equations).
Definition at line 31 of file SymmetricSolver.h.
NAMESPACE_SPH_BEGIN SymmetricSolver< Dim >::SymmetricSolver | ( | IScheduler & | scheduler, |
const RunSettings & | settings, | ||
const EquationHolder & | eqs, | ||
AutoPtr< IBoundaryCondition > && | bc | ||
) |
Creates a symmetric solver, given the list of equations to solve.
Constructor may throw if the list of equations is not consistent with the solver.
scheduler | Scheduler used for parallelization. |
settings | Settings containing parameter of the solver (SPH kernel used, etc.) |
eqs | List of equations to solve. |
bc | Boundary conditions used during the simulation. |
Definition at line 15 of file SymmetricSolver.cpp.
SymmetricSolver< Dim >::SymmetricSolver | ( | IScheduler & | scheduler, |
const RunSettings & | settings, | ||
const EquationHolder & | eqs | ||
) |
Creates a symmetric solver, using boundary conditions specified in settings.
Definition at line 49 of file SymmetricSolver.cpp.
|
default |
|
protectedvirtual |
Definition at line 153 of file SymmetricSolver.cpp.
|
protectedvirtual |
Definition at line 144 of file SymmetricSolver.cpp.
|
overridevirtual |
Initializes all quantities needed by the solver in the storage.
When called, storage already contains particle positions and their masses. All remaining quantities must be created by the solver. The function is called once for every body in the run. The given storage is guaranteed to be homogeneous; it contains only a single material.
storage | Particle storage that shall be modified as needed by the solver. |
material | Material containing parameters of the body being created. The solver can also set up necessary timestepping parameters of the material (ranges and minimal values of quantities). |
Implements ISolver.
Reimplemented in SummationSolver< Dim >.
Definition at line 98 of file SymmetricSolver.cpp.
|
protectedvirtual |
Definition at line 183 of file SymmetricSolver.cpp.
|
overridevirtual |
Computes derivatives of all time-dependent quantities.
The solver can also modify the quantities arbitrarily. It is however not recommended to perform the integration in the solver (using the time step stored in Statistics) as this is a job for timestepping. The solver can modify quantities using boundary conditions, inter-quantity relationships (such as the summation equation for density in SPH), clamping of values etc. It is also possible to add or remove particles in the storage and modify materials. Threads running concurrently with the solver must assume the solver can modify the storage at any time, so accessing the storage from different threads is only allowed before or after integrate; the is no locking for performance reasons.
All highest order derivatives are guaranteed to be set to zero when integrate is called (this is a responsibility of ITimeStepping implementation).
storage | Storage containing all quantities. |
stats | Object where the solver saves all computed statistics of the run. |
Implements ISolver.
Definition at line 58 of file SymmetricSolver.cpp.
|
protectedvirtual |
Definition at line 109 of file SymmetricSolver.cpp.
|
protectedvirtual |
Used to check internal consistency of the solver.
Ran when the solver is created. Function throws an exception if there are conflicting equations or the solver cannot solve given set of equations for some reason.
Definition at line 190 of file SymmetricSolver.cpp.
|
protected |
Boundary condition used by the solver.
Definition at line 57 of file SymmetricSolver.h.
|
protected |
Holds all equation terms evaluated by the solver.
Definition at line 54 of file SymmetricSolver.h.
|
protected |
Structure used to search for neighbouring particles.
Definition at line 60 of file SymmetricSolver.h.
|
protected |
Selected SPH kernel.
Definition at line 63 of file SymmetricSolver.h.
|
protected |
Scheduler to parallelize the solver.
Definition at line 48 of file SymmetricSolver.h.
|
protected |
Thread-local structure caching all buffers needed to compute derivatives.
Definition at line 51 of file SymmetricSolver.h.