Skip to main content

Rocky Solver SDK 2024 R2

IRockySPHElementScalarsModel Struct Reference

Last update: 08.07.2024

#include <rocky_sph_element_scalars.hpp>

Inherits ScalarsModel< rocky20::SPHParticleScalarsController >.

Public Member Functions

void set_operation (int scalar_index, ESPHOperationType operation, ESPHOperationPlace place)
 
int find (const char *name)
 
void reset (int scalar_index)
 
void set_dimension (int scalar_index, double dimension_factor)
 
template<class _data_type = float>
int add (const char *name, const char *unit, bool output=true)
 

Detailed Description

An IRockySPHElementScalarsModel object allows users to add new SPH element scalars, find SPH element scalars created in other modules or activate SPH element scalars defined into the Rocky solver, during the setup stage of a module. SPH element scalars are special variables attached to SPH elements, which are able to store values per SPH element that are preserved between time iterations during a simulation.

Member Function Documentation

◆ add()

template<class _data_type = float>
int IRockySPHElementScalarsModel::add ( const char *  name,
const char *  unit,
bool  output = true 
)

This method creates a new scalar variable of type double
for storing custom values during a simulation, preserving them between time iterations.
Parameters
nameThe name given to the scalar variable. The purpose of this name is twofold. First, it enables to find this scalar variable from other module, in order to share their values. Second, if the scalar variable can be displayed in a 3D window as a property, this name will identify it in the Rocky UI.
unitA string specifying the unit in S.I. associated to the scalar variable.
outputEnables/disables the storage in disk at output times, for the visualization and post-processing of the scalar values.
Returns
The index that will uniquely identify the scalar variable during the execution of the simulation.

◆ find()

int IRockySPHElementScalarsModel::find ( const char *  name)

This method searches for a scalar variable already created by other modules,
in order to allow access to its values, or store new values on it, during the execution of the simulation.
Parameters
nameThe name given to the scalar at the moment of its creation.
Returns
The index that uniquely identifies the wanted scalar if it was actually found. It returns -1 otherwise.

◆ reset()

void IRockySPHElementScalarsModel::reset ( int  scalar_index)

This method resets to zero all values stored in a scalar variable.
Parameters
scalar_indexThe index attributed to the scalar variable at the moment of its creation.

◆ set_dimension()

void IRockySPHElementScalarsModel::set_dimension ( int  scalar_index,
double  dimension_factor 
)

The purpose of this method is to associate a dimensional factor
to a scalar variable. This factor will be used to nondimensionalize their values. For instance, if the scalar represents a force, a force dimensional factor must be associated through this method. Dimensional factors for the fundamental magnitudes are provided by functions of a IRockyModel object.
Parameters
scalar_indexThe index attributed to the scalar variable at the moment of its creation.
dimension_factorThe appropriate dimensional factor for the scalar variable.

◆ set_operation()

void IRockySPHElementScalarsModel::set_operation ( int  scalar_index,
ESPHOperationType  operation,
ESPHOperationPlace  place 
)
SPH element scalars have a unique feature between all scalars in Rocky, which is the
ability of configuring automatic operations that the Rocky solver can perform over them at specific points of the iterative cycle. This method is designed for a custom module to perform such configuration. An example of the usage of such feature would be in a SPH scalar created for accumulating the heat flow rate that goes to every SPH element from its neighbors at a given time. That scalar needs to be reset before doing that accumulation, for instance, within a ROCKY_PLUGIN_PRE_MOVE_ON_SPH_PARTICLE_INTERACTIONS. Moreover, after performing the accumulation of individual heat flow rates, for multi-GPU simulations it will be needed to sum the values stored in halo regions before using them for solving the thermal balance equation for the SPH elements, and then update back those values across devices. The operations currently available and the points at which they can be performed are listed below.
Parameters
scalar_indexThe index of the SPH element scalar over which the operation will be made.
operationThe operation that will be performed. There are defined currently the following operations:
sphotReset: reset to zero all stored values. This operation takes place at the beginning of the SPH hooks iteration.
sphotSum: sum values stored in halo regions, in a multi-GPU scenario. This operation takes place after SPH Interactions hooks.
sphotUpdate: update the summed values back to the halo regions, in a multi-GPU scenario. This operation takes place after SPH Particles hooks.
placeThe point within the iterative loop where the operation will be performed. Each possible place is associated to one of the SPH hooks described in previously in section \techref{s:sph_hooks}. The corresponding enumerate keys that can be used to define those places are the following:
sphopPreForce
sphopPreForce1
sphopPreForce2
sphopPreForce3
sphopPreForce4
sphopForce
sphopPostForce
sphopPostForce1
sphopPostForce2
sphopPostForce3
sphopPostForce4
sphopPreMove
sphopPreMove1
sphopPreMove2
sphopPreMove3
sphopPreMove4
sphopPostMove
sphopPostMove1
sphopPostMove2
sphopPostMove3
sphopPostMove4
sphopHeatTransfer