SPH
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SymmetricSolver< Dim > Class Template Reference

Basic solver for integration of SPH equations. More...

#include <SymmetricSolver.h>

Inheritance diagram for SymmetricSolver< Dim >:
ISolver Polymorphic SummationSolver< Dim >

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...
 
- Public Member Functions inherited from ISolver
virtual void collide (Storage &UNUSED(storage), Statistics &UNUSED(stats), const Float UNUSED(dt))
 Detects the collisions and computes new positions of particles. More...
 
- Public Member Functions inherited from Polymorphic
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 IBasicFindergetFinder (ArrayView< const Vector > r)
 
virtual void sanityCheck (const Storage &storage) const
 Used to check internal consistency of the solver. More...
 

Protected Attributes

ISchedulerscheduler
 Scheduler to parallelize the solver. More...
 
ThreadLocal< ThreadDatathreadData
 Thread-local structure caching all buffers needed to compute derivatives. More...
 
EquationHolder equations
 Holds all equation terms evaluated by the solver. More...
 
AutoPtr< IBoundaryConditionbc
 Boundary condition used by the solver. More...
 
AutoPtr< ISymmetricFinderfinder
 Structure used to search for neighbouring particles. More...
 
LutKernel< Dim > kernel
 Selected SPH kernel. More...
 

Detailed Description

template<Size Dim>
class SymmetricSolver< Dim >

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.

Constructor & Destructor Documentation

◆ SymmetricSolver() [1/2]

template<Size Dim>
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.

Parameters
schedulerScheduler used for parallelization.
settingsSettings containing parameter of the solver (SPH kernel used, etc.)
eqsList of equations to solve.
bcBoundary conditions used during the simulation.
Todo:
we have to somehow enforce either conservation of smoothing length or some EquationTerm that will evolve it. Or maybe just move smoothing length to separate quantity to get rid of these issues?

Definition at line 15 of file SymmetricSolver.cpp.

◆ SymmetricSolver() [2/2]

template<Size Dim>
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.

◆ ~SymmetricSolver()

template<Size Dim>
SymmetricSolver< Dim >::~SymmetricSolver ( )
default

Member Function Documentation

◆ afterLoop()

template<Size Dim>
void SymmetricSolver< Dim >::afterLoop ( Storage storage,
Statistics stats 
)
protectedvirtual

Definition at line 153 of file SymmetricSolver.cpp.

◆ beforeLoop()

template<Size Dim>
void SymmetricSolver< Dim >::beforeLoop ( Storage storage,
Statistics stats 
)
protectedvirtual
Todo:
there functions HAVE to be called, so it doesn't make sense to have them virtual - instead split it into a mandatory function and another one (empty by default) than can be overriden

Definition at line 144 of file SymmetricSolver.cpp.

◆ create()

template<Size Dim>
void SymmetricSolver< Dim >::create ( Storage storage,
IMaterial material 
) const
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.

Parameters
storageParticle storage that shall be modified as needed by the solver.
materialMaterial 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.

◆ getFinder()

template<Size Dim>
RawPtr< const IBasicFinder > SymmetricSolver< Dim >::getFinder ( ArrayView< const Vector r)
protectedvirtual
Todo:
same thing as in AsymmetricSolver -> move to shared parent?

Definition at line 183 of file SymmetricSolver.cpp.

◆ integrate()

template<Size Dim>
void SymmetricSolver< Dim >::integrate ( Storage storage,
Statistics stats 
)
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).

Parameters
storageStorage containing all quantities.
statsObject where the solver saves all computed statistics of the run.

Implements ISolver.

Definition at line 58 of file SymmetricSolver.cpp.

◆ loop()

template<Size Dim>
void SymmetricSolver< Dim >::loop ( Storage storage,
Statistics stats 
)
protectedvirtual

Definition at line 109 of file SymmetricSolver.cpp.

◆ sanityCheck()

template<Size Dim>
void SymmetricSolver< Dim >::sanityCheck ( const Storage storage) const
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.

Member Data Documentation

◆ bc

template<Size Dim>
AutoPtr<IBoundaryCondition> SymmetricSolver< Dim >::bc
protected

Boundary condition used by the solver.

Definition at line 57 of file SymmetricSolver.h.

◆ equations

template<Size Dim>
EquationHolder SymmetricSolver< Dim >::equations
protected

Holds all equation terms evaluated by the solver.

Definition at line 54 of file SymmetricSolver.h.

◆ finder

template<Size Dim>
AutoPtr<ISymmetricFinder> SymmetricSolver< Dim >::finder
protected

Structure used to search for neighbouring particles.

Definition at line 60 of file SymmetricSolver.h.

◆ kernel

template<Size Dim>
LutKernel<Dim> SymmetricSolver< Dim >::kernel
protected

Selected SPH kernel.

Definition at line 63 of file SymmetricSolver.h.

◆ scheduler

template<Size Dim>
IScheduler& SymmetricSolver< Dim >::scheduler
protected

Scheduler to parallelize the solver.

Definition at line 48 of file SymmetricSolver.h.

◆ threadData

template<Size Dim>
ThreadLocal<ThreadData> SymmetricSolver< Dim >::threadData
protected

Thread-local structure caching all buffers needed to compute derivatives.

Definition at line 51 of file SymmetricSolver.h.


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