Skip to main content
#include <rocky_triangle_scalars.hpp> Inherits ScalarsModel< rocky20::TriangleScalarsController >.

Public Member Functions

Detailed Description

IRockyTriangleScalarsModel allows users to add new triangle scalars, find triangle scalars created in other modules or activate triangle scalars known to Rocky, during the setup phase of a module. Triangle scalars are special variables attached to boundary triangles, which are able to store values per triangle 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.

add_accumulation_scalar()

This method creates a new scalar variable of type defined by template parameter data_type for storing custom values during a simulation, preserving them between time iterations. The scalar added with this method has a special behavior defined for pulling data from devices in multi-gpu simulations: It will accumulate those values in the host memory. Parameters Returns The index that will uniquely identify the scalar variable during the execution of the simulation.

calculate_sum_over_geometries()

Returns A vector of the size of geometries in a project, in which every value is the sum of the triangle scalar values associated to the triangles belonging to a geometry. Those values are ordered in the vector according to the indices assigned to the geometries in a project. The sums are performed only if the triangle scalars are of type double or IRockyStatisticsAccumulator.

enable_storage_of_exchanged_heat()

This method activates an internal triangle scalar that accumulates the heat exchanged by geometry triangles with surrounding particles and/or SPH fluid elements during a simulation. The value of this scalar at each geometry triangle and at a given time will be equal to the sum of the heat received by the triangle from all particles and/or SPH elements that interacted with it since the last reset event, which is triggered by the IRockyTriangleScalarsModel::reset_exchanged_heat() function.

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.

pull_scalar_from_devices()

Copies the scalar values defined by scalar_index from the device memory to the host memory (DRAM). When running a simulation in multi-GPU, the values of different devices will be accumulated (summed) in the scalar host memory. This method can only be called for scalars added with add_accumulation_scalar in multi-gpu simulations. Parameters

push_scalar_to_devices()

Send the current scalar values defined by scalar_index located in host memory (DRAM) to the devices memory. Parameters

reset()

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

reset_exchanged_heat()

This method resets an internal triangle scalar that accumulates the heat exchanged by geometry triangles with surrounding particles and/or SPH fluid elements. For example, this function may be called from within the ROCKY_PLUGIN_BEGIN_ITERATION hook. In that case, at the end of an iteration, a custom module can get the value of the total heat received by each triangle during the last timestep.

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