Peano
Loading...
Searching...
No Matches
exaparty::kernels::legacy Namespace Reference

Legacy SPH implementation. More...

Namespaces

namespace  adiabaticIndex
 
namespace  eos
 
namespace  hydroDimensions
 
namespace  kernelHydro
 

Functions

template<typename Particle >
bool prepareDensityUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 Prepares a particle for the density calculation.
 
template<typename Particle >
void prepareDensity (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename Particle >
void hydro_end_density (Particle *localParticle)
 Finishes the density calculation.
 
template<typename Particle >
bool endDensityCalculationUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void endDensityCalculation (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename ParticleA , typename ParticleB = ParticleA>
void density_kernel (ParticleA &localParticle, const ParticleB &activeParticle)
 The actual density kernel, which interacts a local particle and an active particle, and updates the local particle.
 
template<typename Particle >
bool densityKernelUpdateParticlePredicate (const peano4::datamanagement::CellMarker &marker, const bool &localParticleIsContainedInCell, const Particle &localParticle)
 Predicate to decide if to update a particle according to density kernel.
 
template<typename ParticleA , typename ParticleB = ParticleA>
bool densityKernelEvaluatePairInteractionPredicate (const peano4::datamanagement::CellMarker &marker, const ParticleA &localParticle, const ParticleB &activeParticle)
 Predicate if two particles contribute towards the density checks.
 
template<typename ParticleA , typename ParticleB = ParticleA>
void densityKernel (const peano4::datamanagement::CellMarker &marker, ParticleA &localParticle, const ParticleB &activeParticle)
 Invoke density kernel without any outer additional admissibility checks.
 
template<typename Particle >
void hydro_prepare_force (Particle &localParticle)
 Prepare a particle for the force calculation.
 
template<typename Particle >
bool prepareHydroForceUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void prepareHydroForce (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename Particle >
void hydro_reset_acceleration (Particle &localParticle)
 Reset acceleration fields of a particle.
 
template<typename Particle >
bool resetAccelerationUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void resetAcceleration (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename Particle >
void hydro_end_force (Particle &localParticle)
 Finishes the force calculation.
 
template<typename Particle >
bool endHydroForceCalculationUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void endHydroForceCalculation (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename ParticleA , typename ParticleB = ParticleA>
void __attribute__ ((always_inline)) force_kernel(ParticleA &localParticle
 The actual force kernel, which interacts a local particle and an active particle, and updates the local particle.
 
template<typename Particle >
bool forceKernelUpdateParticlePredicate (const peano4::datamanagement::CellMarker &marker, const bool &localParticleIsContainedInCell, const Particle &localParticle)
 
template<typename ParticleA , typename ParticleB = ParticleA>
bool forceKernelEvaluatePairInteractionPredicate (const peano4::datamanagement::CellMarker &marker, const ParticleA &localParticle, const ParticleB &activeParticle)
 
template<typename ParticleA , typename ParticleB = ParticleA>
InlineMethod void forceKernel (const peano4::datamanagement::CellMarker &marker, ParticleA &localParticle, const ParticleB &activeParticle)
 Generic force kernel implementation.
 
template<typename Particle >
void predict_hyrdro (Particle *particle)
 Predict hydro terms (SWIFT) Relevant for inactive particles when using local-timestepping, but always used.
 
template<typename Particle >
bool predictHydroUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void predictHydro (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename Particle >
bool forceKernelDistanceCheck (Particle *__restrict__ localParticle, const Particle *__restrict__ activeParticle)
 Check distance between two particles.
 
template<typename Particle >
void leapfrog_drift_global_time_step_size (Particle &particle)
 Update a particle with the leapfrog KDK integrator.
 
template<typename Particle >
bool leapfrogDriftWithGlobalTimeStepSizeParticleUpdatePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void leapfrogDriftWithGlobalTimeStepSize (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename Particle >
void hydro_predict_extra (Particle &localParticle)
 Predict additional particle fields forward in time when drifting.
 
template<typename Particle >
bool hydroPredictExtraUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void hydroPredictExtra (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename Particle >
void leapfrog_kick_global_time_step_size (Particle &particle)
 Kick steps.
 
template<typename Particle >
bool leapfrogKickWithGlobalTimeStepSizeUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void leapfrogKickWithGlobalTimeStepSize (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename Particle >
void hydro_kick_extra_global_time_step_size (Particle &localParticle)
 Kick the additional variables.
 
template<typename Particle >
bool leapfrogKickExtraWithGlobalTimeStepSizeUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void leapfrogKickExtraWithGlobalTimeStepSize (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename Particle >
void hydro_reset_predicted_values (Particle &localParticle)
 Sets the values to be predicted in the drifts to their values at a kick time.
 
template<typename Particle >
bool resetPredictedValuesUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void resetPredictedValues (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 
template<typename Particle >
void hydro_update_smoothing_length_and_rerun_if_required (Particle *localParticle)
 Derive smoothing length from density.
 
template<typename Particle >
bool updateSmoothingLengthAndRerunIfRequiredUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &localParticle)
 
template<typename Particle >
void updateSmoothingLengthAndRerunIfRequired (const peano4::datamanagement::VertexMarker &marker, Particle &localParticle)
 Wrapper around hydro_update_smoothing_length_and_rerun_if_required() with only one argument.
 
template<typename Particle >
bool resetSmoothingLengthIterationCounterUpdateParticlePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &particle)
 Reset smoothing length iteration related flags on a particle.
 
template<typename Particle >
void resetSmoothingLengthIterationCounter (const peano4::datamanagement::VertexMarker &marker, Particle &particle)
 
template<typename Particle >
void first_init_particle (Particle *particle)
 Initialise particles for the first time.
 
template<typename Particle >
bool firstInitParticleParticleUpdatePredicate (const peano4::datamanagement::VertexMarker &marker, const Particle &particle)
 In principle, we don't need to check for anything here, just overwrite particle data.
 
template<typename Particle >
void firstInitParticle (const peano4::datamanagement::VertexMarker &marker, Particle &particle)
 
template<typename Particle >
void hydro_init_particle (Particle *particle)
 Prepares a particle for the density calculation.
 
template<typename Particle >
double hydro_compute_timestep (Particle *particle)
 Computes the SPH time step size.
 
template<typename ParticleContainer >
void computeNextTimestep (const peano4::datamanagement::VertexMarker &marker, ParticleContainer &assignedParticles)
 computes the next time step size for all particles associated to this vertex, and writes it into the particle species.
 

Variables

void const ParticleB & activeParticle
 

Detailed Description

Legacy SPH implementation.

This implementation is very very close to the original Swift kernels. This can immediately be seen from the signature of the routines: The core routines all work solely with pointers.

For ExaParty however, we need signatures which work with references and also evaluate predicates. So each routine actually comes along as pair: The core science with a pointer and then a wrapper around it.

The wrapper vs implementation distinction also is reflected in the naming conventions: The actual physics remain written in C/Swift style, whereas the wrappers follow the Peano's C++ convention.

This file contains only the functions that we actually want to use from the original swift codebase, and maintains their original name. The idea is to eventually use the SWIFT implementation of these functions. But for now, we keep a (modified) version of them here.

A second point to keep these functions separate is the fact that they do different things for each SPH flavour. So they are intended to be replaceable anyway.

There are some notable exceptions which are missing from this collection of functions. Firstly, we keep the particle-particle interactions separately. We are tinkering with them in Peano and optimizing them in a different way. They are defined in ParticleParticleInteraction.h. Secondly, anything related to the computation of the smoothing lengths is defined in SmoothingLengthComputation.h. The smoothing length computation is intimately tied to the neighbour search algorithms, and cannot be separated trivially from the underlying codebase and infrastructure. As such, we can't simply re-use what original SWIFT does, but need to provide our own algorithms. In particular, we differentiate between the search radius and the interaction radius/ compact support radius of particles, which original swift doesn't. We provide smoothing length computation algorithms for both a constant search radius as well as a varying search radius.

Function Documentation

◆ __attribute__()

template<typename ParticleA , typename ParticleB = ParticleA>
void exaparty::kernels::legacy::__attribute__ ( (always_inline)  ) &

The actual force kernel, which interacts a local particle and an active particle, and updates the local particle.

In this kernel, we accumulate the sums necessary for the force interactions between particles. In the "Minimal" SPH, by the end of it we're updating the velocity and the internal energy via

\( \frac{d\mathbf{v}_i}{dt} = - \sum_j m_j \left[ \frac{f_i P_i}{\rho_i^2} \nabla_x W(\mathbf{x}_{ij}, h_i) + \frac{f_j P_j}{\rho_j^2} \nabla_x W(\mathbf{x}_{ij}, h_j) + \nu_{ij} \overline{\nabla_x W_{ij}} \right] \)

and

\( \frac{du_i}{dt} = \sum_j m_j \left[ \frac{f_i P_i}{\rho_i^2} \mathbf{v}_{ij} \cdot \nabla_x W(\mathbf{x}_{ij}, h_i) + \frac{1}{2} \nu_{ij} \mathbf{v}_{ij} \cdot \overline{\nabla_x W_{ij}} \right] \)

where

\( \nu_{ij} = -\frac{1}{2} \frac{\alpha \mu_{ij} v_{sig,ij}}{\overline{\rho}_{ij}}\)

\( v_{sig,ij} = c_i + c_j - \beta \mu_{ij}\)

\( \mu_{ij} = \frac{\mathbf{v}_{ij} \cdot \mathbf{x}_{ij}}{|\mathbf{x}_{ij}|}\) if \( \mathbf{v}_{ij} \cdot \mathbf{x}_{ij} < 0\), or 0 otherwise

\( f_i = \left( 1 + \frac{h_i}{3 \rho_i} \frac{\partial \rho_i}{\partial h_i} \right)^{-1} \)

\( c_i\): soundspeed of particle i

\( P_i\): pressure of particle i

\( \mathbf{x}_{ij} = \mathbf{x}_{i} - \mathbf{x}_{j} \)

\( \mathbf{v}_{ij} = \mathbf{v}_{i} - \mathbf{v}_{j} \)

\( \alpha, \beta \): user set viscosity coefficient. Usually 0 and 3, respectively.

\( \overline{\rho}_{ij} = \frac{1}{2} (\rho_i + \rho_j) \)

\( \overline{\nabla_x W}_{ij} = \frac{1}{2} (\nabla_x W_i + \nabla_x W_j) \)

For a kernel

\( W(\mathbf{x}_{ij}, h) = \frac{1}{h^d} f \left( \frac{\mathbf{x}_{ij}}{h} \right) = \frac{1}{h^d} f \left( q \right) \)

in \( d \) dimensions, we have

\( \nabla_x W(\mathbf{x}_{ij}, h) = \frac{1}{h^{d+1}} \frac{\partial f(q)}{\partial q} \frac{\mathbf{x}_{ij}}{|\mathbf{x}_{ij}|} \)

Vectorisation

This operation struggles to vectorise, as we have the statement

if ((tarch::la::smaller(r, iactRi) or tarch::la::smaller(r, iactRj))
and tarch::la::greater(r, 0.0))
{
static InlineMethod bool smaller(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
Smaller operator for floating point values.
bool greater(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)

in there. This if statement encapsulates quite a lot of operations. The Intel compiler therefore cannot vectorise this routine anymore.

See also
forceKernelVectorised()

◆ computeNextTimestep()

template<typename ParticleContainer >
void exaparty::kernels::legacy::computeNextTimestep ( const peano4::datamanagement::VertexMarker &  marker,
ParticleContainer &  assignedParticles 
)

computes the next time step size for all particles associated to this vertex, and writes it into the particle species.

◆ density_kernel()

template<typename ParticleA , typename ParticleB = ParticleA>
void exaparty::kernels::legacy::density_kernel ( ParticleA &  localParticle,
const ParticleB &  activeParticle 
)

The actual density kernel, which interacts a local particle and an active particle, and updates the local particle.

In this particle-particle interaction loop, we accumulate several quantities. For the subsequent force computation, we need to collect the density

\( \rho_i = \rho(\mathbf{x}_i) = \sum_j m_j W(r_{ij}, h_i)\)

and its derivative w.r.t. \( h \) :

\( \frac{\partial \rho_i}{\partial h} = \sum_j m_j \frac{\partial W(r_{ij}, h_i)}{\partial h} \)

(see the \(f_i\) in exaparty::kernels::legacy::force_kernel to see where and how it is used) where \( m_j \) is the particle mass, \( r_{ij} \) is the distance between particle \(i \) and \( j \), \(h_i \) is the smoothing length of \(i \) and \( W(r, h) \) is the SPH kernel function we use.

Let

\( W = \frac{1}{h^\nu} f\left( \frac{r}{h}\right) \equiv \frac{1}{h^\nu} f( q ) \)

for \( \nu \) dimensions. Then

\( \frac{\partial W(r_{ij}, h_i)}{\partial h} = - \nu \frac{1}{h ^ {\nu + 1}} f(r/h) + \frac{1}{h^\nu} \frac{\partial f(q)}{\partial h} = - \nu \frac{1}{h ^ {\nu + 1}} f(q) + \frac{1}{h^\nu} \frac{\partial f(q)}{\partial q} \frac{\partial q}{\partial h} = - \frac{1}{h} \left( \nu W(q) + q \frac{\partial W(q)}{\partial q} \right) \)

which is a quantity we accumulate in the density interaction kernel for the estimate of \( \frac{\partial \rho_i}{\partial h} \).

Similarly, for the computation of the smoothing length, we require to accumulate the analgue number densities (and its derivative w.r.t. h):

\( n_i = \sum_j W(r_{ij}, h_i)\)

\( \frac{\partial n_i}{\partial h} = \sum_j \frac{\partial W(r_{ij}, h_i)}{\partial h} \)

◆ densityKernel()

template<typename ParticleA , typename ParticleB = ParticleA>
void exaparty::kernels::legacy::densityKernel ( const peano4::datamanagement::CellMarker &  marker,
ParticleA &  localParticle,
const ParticleB &  activeParticle 
)

Invoke density kernel without any outer additional admissibility checks.

This routine forwards the function call to density_kernel(). Please consult this routine for additional information.

The kernel assumes that the predicates all hold, i.e. we do not check them anymore. As exaparty::kernels::localParticleCanBeUpdatedInCellKernel(), we don't have to check anything and directly forward the call to the Swift 1 "legacy" kernel. It makes no sense to use this version in the generic pair-wise interactions, but it makes sense to combine it with coalesced memory accesses and a dedicated outer predicate.

That is, a vanilla density calculation equals

workItemParticleSet[workItem], workItemParticleSet[workItem],
createCoalescedMemoryIndices(), createCoalescedMemoryIndices(),
::exaparty::kernels::legacy::densityKernel<globaldata::HydroPart>,
::exaparty::kernels::alwaysUpdateInCellKernel<globaldata::HydroPart>,
::exaparty::kernels::localParticleCanBeUpdatedInCellKernelFromAnyOtherParticle<globaldata::HydroPart>);
void forAllParticlePairs(const exaparty::CellMetaData &cellMetaData, auto &localParticles, auto &activeParticles, ::exaparty::kernels::kernelrealisation::GenericRealisation realisation)
Run over all local particle-active particle combinations.

whereas we can use an optimised version such as

workItemParticleSet[workItem], workItemParticleSet[workItem],
createCoalescedMemoryIndices(), createCoalescedMemoryIndices(),
::exaparty::kernels::legacy::densityKernelWithoutChecks<globaldata::HydroPart>,
::exaparty::kernels::localParticleCanBeUpdatedInCellKernel<globaldata::HydroPart>,
::exaparty::kernels::legacy::densityKernelPairEvaluationPredicate<globaldata::HydroPart>);

◆ densityKernelEvaluatePairInteractionPredicate()

template<typename ParticleA , typename ParticleB = ParticleA>
bool exaparty::kernels::legacy::densityKernelEvaluatePairInteractionPredicate ( const peano4::datamanagement::CellMarker &  marker,
const ParticleA &  localParticle,
const ParticleB &  activeParticle 
)

Predicate if two particles contribute towards the density checks.

This predicate assumes that exaparty::kernels::localParticleCanBeUpdatedInCellKernel() holds. It then evaluates if activeParticle contributes towards localParticle. Is used by the densityKernel() to find out if the actual density calculation is to be invoked, but can also be used as explicit check in combination with densityKernelWithoutChecks().

Optimisation

  • The comparison of radii has to be done by comaring the squares, as we otherwise would need a square root.

exaparty::kernels::localParticleCanBeUpdatedInCellKernel<globaldata::HydroPart>

◆ densityKernelUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::densityKernelUpdateParticlePredicate ( const peano4::datamanagement::CellMarker &  marker,
const bool &  localParticleIsContainedInCell,
const Particle &  localParticle 
)

Predicate to decide if to update a particle according to density kernel.

This is an implementation of the concept UpdateParticleAssignedToCellPredicate() for densityKernel(), i.e. should be used in combination with the latter.

The function delegates to exaparty::kernels::localParticleCanBeUpdatedInCellKernel() and combines it with localParticle.getSmoothingLengthConverged(): We only consider updating a particles if its smoothing length computation has not yet converged.

◆ endDensityCalculation()

template<typename Particle >
void exaparty::kernels::legacy::endDensityCalculation ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 64 of file Density.h.

References assertion, endDensityCalculationUpdateParticlePredicate(), and hydro_end_density().

Here is the call graph for this function:

◆ endDensityCalculationUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::endDensityCalculationUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 53 of file Density.h.

Referenced by endDensityCalculation().

Here is the caller graph for this function:

◆ endHydroForceCalculation()

template<typename Particle >
void exaparty::kernels::legacy::endHydroForceCalculation ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 106 of file HydroForce.h.

References assertion, endHydroForceCalculationUpdateParticlePredicate(), and hydro_end_force().

Here is the call graph for this function:

◆ endHydroForceCalculationUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::endHydroForceCalculationUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 95 of file HydroForce.h.

Referenced by endHydroForceCalculation().

Here is the caller graph for this function:

◆ first_init_particle()

template<typename Particle >
void exaparty::kernels::legacy::first_init_particle ( Particle *  particle)

Initialise particles for the first time.

This method is intended to be called during startup only, not every simulation step.

Referenced by firstInitParticle().

Here is the caller graph for this function:

◆ firstInitParticle()

template<typename Particle >
void exaparty::kernels::legacy::firstInitParticle ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  particle 
)

Definition at line 75 of file Swift.h.

References assertion, first_init_particle(), and firstInitParticleParticleUpdatePredicate().

Here is the call graph for this function:

◆ firstInitParticleParticleUpdatePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::firstInitParticleParticleUpdatePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  particle 
)

In principle, we don't need to check for anything here, just overwrite particle data.

In practice, this messes with the dependency checks.

Definition at line 67 of file Swift.h.

References exaparty::kernels::localParticleCanBeUpdatedInVertexKernel().

Referenced by firstInitParticle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ forceKernel()

template<typename ParticleA , typename ParticleB = ParticleA>
InlineMethod void exaparty::kernels::legacy::forceKernel ( const peano4::datamanagement::CellMarker &  marker,
ParticleA &  localParticle,
const ParticleB &  activeParticle 
)

Generic force kernel implementation.

Is to be used in combination with

  • forceKernelUpdateParticlePredicate() and
  • forceKernelEvaluatePairInteractionPredicate()

◆ forceKernelDistanceCheck()

template<typename Particle >
bool exaparty::kernels::legacy::forceKernelDistanceCheck ( Particle *__restrict__  localParticle,
const Particle *__restrict__  activeParticle 
)

Check distance between two particles.

First part of force kernel routine, where we check if two particles are close enough to actually interact. This routine also returns true if localParticle and activeParticle are the same. That is, it does not check for equality. Therefore, the routine has to be used with forceKernelVectorised() which in turn checks the distance interally but masks out zero distances.

◆ forceKernelEvaluatePairInteractionPredicate()

template<typename ParticleA , typename ParticleB = ParticleA>
bool exaparty::kernels::legacy::forceKernelEvaluatePairInteractionPredicate ( const peano4::datamanagement::CellMarker &  marker,
const ParticleA &  localParticle,
const ParticleB &  activeParticle 
)

◆ forceKernelUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::forceKernelUpdateParticlePredicate ( const peano4::datamanagement::CellMarker &  marker,
const bool &  localParticleIsContainedInCell,
const Particle &  localParticle 
)

◆ hydro_compute_timestep()

template<typename Particle >
double exaparty::kernels::legacy::hydro_compute_timestep ( Particle *  particle)

Computes the SPH time step size.

May depend on SPH flavour.

◆ hydro_end_density()

template<typename Particle >
void exaparty::kernels::legacy::hydro_end_density ( Particle *  localParticle)

Finishes the density calculation.

Multiplies the density and number of neighbours by the appropiate constants and add the self-contribution term. Additional quantities such as velocity gradients will also get the final terms added to them here.

Also adds/multiplies the cosmological terms if need be. (Not implemented yet)

Referenced by endDensityCalculation().

Here is the caller graph for this function:

◆ hydro_end_force()

template<typename Particle >
void exaparty::kernels::legacy::hydro_end_force ( Particle &  localParticle)

Finishes the force calculation.

Multiplies the force and accelerations by the appropiate constants and add the self-contribution term. In most cases, there is little to do here.

Cosmological terms are also added/multiplied here.

Parameters
localParticleThe particle to act upon

Referenced by endHydroForceCalculation().

Here is the caller graph for this function:

◆ hydro_init_particle()

template<typename Particle >
void exaparty::kernels::legacy::hydro_init_particle ( Particle *  particle)

Prepares a particle for the density calculation.

Zeroes all the relevant arrays in preparation for the sums taking place in the various density loop over neighbours. Typically, all fields of the density sub-structure of a particle get zeroed in here.

Referenced by prepareDensity().

Here is the caller graph for this function:

◆ hydro_kick_extra_global_time_step_size()

template<typename Particle >
void exaparty::kernels::legacy::hydro_kick_extra_global_time_step_size ( Particle &  localParticle)

Kick the additional variables.

Additional hydrodynamic quantites are kicked forward in time here. These include thermal quantities (thermal energy or total energy or entropy, ...). The additional quantities being updated here depend on the exact SPH flavour being used.

Kick extra step, i.e. update some thermodynamic quantities forward in time. In particular, U is integrated forward in time treating it as the velocity.

Referenced by leapfrogKickExtraWithGlobalTimeStepSize().

Here is the caller graph for this function:

◆ hydro_predict_extra()

template<typename Particle >
void exaparty::kernels::legacy::hydro_predict_extra ( Particle &  localParticle)

Predict additional particle fields forward in time when drifting.

Additional hydrodynamic quantites are drifted forward in time here. These include thermal quantities (thermal energy or total energy or entropy, ...). Note that which and how quantities get updated depends on the specific SPH flavour.

Referenced by hydroPredictExtra().

Here is the caller graph for this function:

◆ hydro_prepare_force()

template<typename Particle >
void exaparty::kernels::legacy::hydro_prepare_force ( Particle &  localParticle)

Prepare a particle for the force calculation.

Convert some quantities coming from the density loop over neighbours into quantities ready to be used in the force loop over neighbours. Quantities are typically read from the density sub-structure and written to the force sub-structure. Examples of calculations done here include the calculation of viscosity term constants, thermal conduction terms, hydro conversions, etc.

Referenced by prepareHydroForce().

Here is the caller graph for this function:

◆ hydro_reset_acceleration()

template<typename Particle >
void exaparty::kernels::legacy::hydro_reset_acceleration ( Particle &  localParticle)

Reset acceleration fields of a particle.

Resets all hydro acceleration and time derivative fields in preparation for the sums taking place in the various force interactions.

Referenced by resetAcceleration().

Here is the caller graph for this function:

◆ hydro_reset_predicted_values()

template<typename Particle >
void exaparty::kernels::legacy::hydro_reset_predicted_values ( Particle &  localParticle)

Sets the values to be predicted in the drifts to their values at a kick time.

Referenced by resetPredictedValues().

Here is the caller graph for this function:

◆ hydro_update_smoothing_length_and_rerun_if_required()

template<typename Particle >
void exaparty::kernels::legacy::hydro_update_smoothing_length_and_rerun_if_required ( Particle *  localParticle)

Derive smoothing length from density.

This routine is to be called directly after hydro_end_density. It updates the smoothing length according to the updated density quantities and then decides if the smoothing length computation has terminated with something reasonable. If not, the routine triggers an iteration rerun on this species. The rerun will mean that we recalculate the density (as it depends on the smoothing length) and then check again if we have converged.

The smoothing length is defined by a user-set parameter \(\eta \) which specifies it in units of the (local) mean interparticle separation:

\( h = \eta \langle x \rangle = \eta \left(\frac{1}{n(\mathbf{x})} \right)^{1/\nu} \)

where \( n \) is the local number density of particles (which is the same as the inverse of volume), and \( \nu \) is the number of dimensions of the problem.

This is, however, a circular definition: The local number density of particles is estimated via the smoothing length as

\( n_i = \sum_j W(r_{ij}, h_i)\) .

So we must solve this problem iteratively. We can rewrite the equation above as:

\( h^\nu n = \eta^\nu \Rightarrow h^\nu n - \eta^\nu = 0 \)

And use this equation as a function whose root we're trying to find: Let \( f(h) \) be

\( f(h) = h^\nu \sum_j W(r_{ij}, h_i) - \eta^\nu \)

It has an analytic derivative:

\( \frac{\partial f(h)}{\partial h} = \nu h^{\nu-1} \sum_j W(r_{ij}, h_i) + h^\nu \sum_j \frac{\partial W(r_{ij}, h_i)}{\partial h} \)

With an analytic function and its derivative, we make use of the Newton-Raphson iterative root finding method to find the \(h\) for which \( f(h) = 0 \).

Referenced by updateSmoothingLengthAndRerunIfRequired().

Here is the caller graph for this function:

◆ hydroPredictExtra()

template<typename Particle >
void exaparty::kernels::legacy::hydroPredictExtra ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 100 of file Leapfrog.h.

References assertion, hydro_predict_extra(), and hydroPredictExtraUpdateParticlePredicate().

Here is the call graph for this function:

◆ hydroPredictExtraUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::hydroPredictExtraUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 89 of file Leapfrog.h.

Referenced by hydroPredictExtra().

Here is the caller graph for this function:

◆ leapfrog_drift_global_time_step_size()

template<typename Particle >
void exaparty::kernels::legacy::leapfrog_drift_global_time_step_size ( Particle &  particle)

Update a particle with the leapfrog KDK integrator.

The code should invoke this routine only in touchVertexLastTime(). It should never change the particle position throughout the mesh traversal, as it might introduce inconsistent particle data structure.

We do not update all particles but merely those which are labelled as local. Virtual particles are mere copies from another tree. We should not alter their states or positions. Any neighbour who is in charge of the particle should do this, and we then expect such a rank to send over a new copy. Drift step.

In this, we move the particles by a full time-step using:

\( {\bf x}^{n+1} = {\bf x}^{n} + {\bf v}^{n+1/2}{\Delta t} \)

Notice that this operation modifies the particle topology and hence particles must be re-sorted before further operations can be executed.

It's important to take the "V_full" here, not the fluid velocity V. V_full doesn't get touched outside of kicks. V will be interpolated/ integrated in time as the time step progresses. V_full is the correct choice here.

Note that original SWIFT predicts the velocities at this point. We moved that into hydroPredictExtra().

Referenced by leapfrogDriftWithGlobalTimeStepSize().

Here is the caller graph for this function:

◆ leapfrog_kick_global_time_step_size()

template<typename Particle >
void exaparty::kernels::legacy::leapfrog_kick_global_time_step_size ( Particle &  particle)

Kick steps.

There are two kick steps in the KDK scheme, in which we update the particle velocity by a half-timestep using:

Kick1: \( {\bf v}^{n+\frac{1}{2}} = {\bf v}^{n} + {\bf a}^{n}\frac{\Delta t}{2} \)

Kick2: \( {\bf v}^{n+1} = {\bf v}^{n+\frac{1}{2}} + {\bf a}^{n+1}\frac{\Delta t}{2} \)

Additionally, thermal quantities are being updated. In the case of "Minimal" SPH, we update

Kick1: \( {u}^{n+\frac{1}{2}} = u^{n} + \frac{\partial u}{\partial t}^{n}\frac{\Delta t}{2} \)

Kick2: \( {u}^{n+1} = u^{n+\frac{1}{2}} + \frac{\partial u}{\partial t}^{n+1}\frac{\Delta t}{2} \)

The update of thermal quantities has been separated into hydro_kick_extra_global_time_step_size as it depends on the SPH flavour used, and needs to be replaceable.

Notice that the last kick in this sequence is implicit if \({\bf a}\) depends on \({\bf v}\) (e.g. due to artificial viscosity terms), which in principle requires extra treatments (see e.g. Price et al. 2017).

While the time integration scheme should be kick1 - drift - kick2, we do a slightly different sequence. First, we do a kick1 during initialization. Then every subsequent normal simulation step does a drift - kick2 - kick1 sequence. The reason for that is to permit individual time step sizes for individual particles: By starting the particle time step with a drift, we can always drift neighbours to their correct positions, even when they are inactive (= not being updated in the current step). The drifts are linear operations which in principle can be concatenated in any number, provided the total time a particle is being drifted sums up to the correct value. So for example, it should be equivalent to compute

\( K_1(\Delta t/2) \circ D(\Delta t) \circ K_2(\Delta t/2) \)

or

\( K_1(\Delta t/2) \circ D(\Delta t/4) \circ D(\Delta t/4) \circ D(\Delta t/4) \circ D(\Delta t/4) \circ K_2(\Delta t/2) \).

Once the kick2 operation is complete, the "predicted" values stemming from the "prediction" step in hydro_predict_extra() after a drift need to be reset to up-to-date current values that the particle carries. So after a kick2, we reset them using hydro_reset_predicted_values().

So in total, there are two additional steps that you have to add afterwards.

This version is tailored towards the SPH time integration, where we access additional particle fields which are otherwise not present, such as the time derivative of the internal energy.

Referenced by leapfrogKickWithGlobalTimeStepSize().

Here is the caller graph for this function:

◆ leapfrogDriftWithGlobalTimeStepSize()

template<typename Particle >
void exaparty::kernels::legacy::leapfrogDriftWithGlobalTimeStepSize ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 62 of file Leapfrog.h.

References assertion2, leapfrog_drift_global_time_step_size(), and leapfrogDriftWithGlobalTimeStepSizeParticleUpdatePredicate().

Here is the call graph for this function:

◆ leapfrogDriftWithGlobalTimeStepSizeParticleUpdatePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::leapfrogDriftWithGlobalTimeStepSizeParticleUpdatePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 53 of file Leapfrog.h.

Referenced by leapfrogDriftWithGlobalTimeStepSize().

Here is the caller graph for this function:

◆ leapfrogKickExtraWithGlobalTimeStepSize()

template<typename Particle >
void exaparty::kernels::legacy::leapfrogKickExtraWithGlobalTimeStepSize ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 227 of file Leapfrog.h.

References assertion, hydro_kick_extra_global_time_step_size(), and leapfrogKickExtraWithGlobalTimeStepSizeUpdateParticlePredicate().

Here is the call graph for this function:

◆ leapfrogKickExtraWithGlobalTimeStepSizeUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::leapfrogKickExtraWithGlobalTimeStepSizeUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 216 of file Leapfrog.h.

Referenced by leapfrogKickExtraWithGlobalTimeStepSize().

Here is the caller graph for this function:

◆ leapfrogKickWithGlobalTimeStepSize()

template<typename Particle >
void exaparty::kernels::legacy::leapfrogKickWithGlobalTimeStepSize ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 189 of file Leapfrog.h.

References assertion, leapfrog_kick_global_time_step_size(), and leapfrogKickWithGlobalTimeStepSizeUpdateParticlePredicate().

Here is the call graph for this function:

◆ leapfrogKickWithGlobalTimeStepSizeUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::leapfrogKickWithGlobalTimeStepSizeUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 178 of file Leapfrog.h.

Referenced by leapfrogKickWithGlobalTimeStepSize().

Here is the caller graph for this function:

◆ predict_hyrdro()

template<typename Particle >
void exaparty::kernels::legacy::predict_hyrdro ( Particle *  particle)

Predict hydro terms (SWIFT) Relevant for inactive particles when using local-timestepping, but always used.

Referenced by predictHydro().

Here is the caller graph for this function:

◆ predictHydro()

template<typename Particle >
void exaparty::kernels::legacy::predictHydro ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 263 of file HydroForce.h.

References assertion, predict_hyrdro(), and predictHydroUpdateParticlePredicate().

Here is the call graph for this function:

◆ predictHydroUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::predictHydroUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 251 of file HydroForce.h.

Referenced by predictHydro().

Here is the caller graph for this function:

◆ prepareDensity()

template<typename Particle >
void exaparty::kernels::legacy::prepareDensity ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 30 of file Density.h.

References assertion, hydro_init_particle(), and prepareDensityUpdateParticlePredicate().

Here is the call graph for this function:

◆ prepareDensityUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::prepareDensityUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Prepares a particle for the density calculation.

Definition at line 19 of file Density.h.

Referenced by prepareDensity().

Here is the caller graph for this function:

◆ prepareHydroForce()

template<typename Particle >
void exaparty::kernels::legacy::prepareHydroForce ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 39 of file HydroForce.h.

References assertion, hydro_prepare_force(), and prepareHydroForceUpdateParticlePredicate().

Here is the call graph for this function:

◆ prepareHydroForceUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::prepareHydroForceUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 28 of file HydroForce.h.

Referenced by prepareHydroForce().

Here is the caller graph for this function:

◆ resetAcceleration()

template<typename Particle >
void exaparty::kernels::legacy::resetAcceleration ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 70 of file HydroForce.h.

References assertion, hydro_reset_acceleration(), and resetAccelerationUpdateParticlePredicate().

Here is the call graph for this function:

◆ resetAccelerationUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::resetAccelerationUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 59 of file HydroForce.h.

Referenced by resetAcceleration().

Here is the caller graph for this function:

◆ resetPredictedValues()

template<typename Particle >
void exaparty::kernels::legacy::resetPredictedValues ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Definition at line 259 of file Leapfrog.h.

References assertion, hydro_reset_predicted_values(), and resetPredictedValuesUpdateParticlePredicate().

Here is the call graph for this function:

◆ resetPredictedValuesUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::resetPredictedValuesUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 248 of file Leapfrog.h.

Referenced by resetPredictedValues().

Here is the caller graph for this function:

◆ resetSmoothingLengthIterationCounter()

template<typename Particle >
void exaparty::kernels::legacy::resetSmoothingLengthIterationCounter ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  particle 
)

Definition at line 112 of file SmoothingLength.h.

References assertion, and resetSmoothingLengthIterationCounterUpdateParticlePredicate().

Here is the call graph for this function:

◆ resetSmoothingLengthIterationCounterUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::resetSmoothingLengthIterationCounterUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  particle 
)

Reset smoothing length iteration related flags on a particle.

Definition at line 104 of file SmoothingLength.h.

Referenced by resetSmoothingLengthIterationCounter().

Here is the caller graph for this function:

◆ updateSmoothingLengthAndRerunIfRequired()

template<typename Particle >
void exaparty::kernels::legacy::updateSmoothingLengthAndRerunIfRequired ( const peano4::datamanagement::VertexMarker &  marker,
Particle &  localParticle 
)

Wrapper around hydro_update_smoothing_length_and_rerun_if_required() with only one argument.

Further to that, it also adds some consistency checks as discussed in the context of genericalgorithm remarks".

Definition at line 81 of file SmoothingLength.h.

References assertion, assertion2, hydro_update_smoothing_length_and_rerun_if_required(), tarch::la::min(), and updateSmoothingLengthAndRerunIfRequiredUpdateParticlePredicate().

Here is the call graph for this function:

◆ updateSmoothingLengthAndRerunIfRequiredUpdateParticlePredicate()

template<typename Particle >
bool exaparty::kernels::legacy::updateSmoothingLengthAndRerunIfRequiredUpdateParticlePredicate ( const peano4::datamanagement::VertexMarker &  marker,
const Particle &  localParticle 
)

Definition at line 67 of file SmoothingLength.h.

Referenced by updateSmoothingLengthAndRerunIfRequired().

Here is the caller graph for this function:

Variable Documentation

◆ activeParticle

void const ParticleB& exaparty::kernels::legacy::activeParticle

Definition at line 209 of file HydroForce.h.