Skip to main content
#include <rocky_sph_element_scalars.hpp> Inherits ScalarsModel< rocky20::SPHParticleScalarsController >.

Public Member Functions

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()

This method creates a new scalar variable of type double for storing custom values during a simulation, preserving them between time iterations. Parameters Returns The index that will uniquely identify the scalar variable during the execution of the simulation.

enable_variable_molecular_viscosity()

Enables a known-scalar that defines the molecular viscosity as a variable property of SPH Elements. When this scalar is enabled, a different value of molecular viscosity can be specified for each element in a simulation, and this value will be used everywhere in the Rocky solver instead of the constant value specified for the fluid’s material in the Rocky UI.

enable_velocity_gradient()

Enables the automatic calculation of the components of the velocity gradient, which are needed for the calculation of the strain-rate tensor.

find()

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 Returns The index that uniquely identifies the wanted scalar if it was actually found. It returns -1 otherwise.

reset()

This method resets to zero all values stored in a scalar variable. Parameters

set_dimension()

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

set_operation()

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