    

 ## On this page

  

 

 # IRockySPHElementScalars Struct Reference

 Last update: 17.07.2025 

`#include <<a class="el" href="rocky__sph__element__scalars_8hpp_source.xhtml">rocky_sph_element_scalars.hpp</a>>`

Inherits EntityScalars&lt; rocky20::SPHParticleScalars &gt;.

## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

template&lt;class \_data\_type = float&gt; ROCKY\_FUNCTIONS \_data\_type [get\_scalar](structIRockySPHElementScalars.xhtml#acf45b1ddd0d68df837ec264d2758693f) (int scalar\_index) const ROCKY\_FUNCTIONS float [get\_turbulent\_viscosity](structIRockySPHElementScalars.xhtml#af70cf6bb3041f4c5e9a8c336ea47b201) () const ROCKY\_FUNCTIONS float [get\_temperature](structIRockySPHElementScalars.xhtml#aa7d031c763a7c8c643ec7a86c07ae6d3) () const ROCKY\_FUNCTIONS float [get\_heat\_transfer](structIRockySPHElementScalars.xhtml#a8a1580996da5f171f535de7e7487fe01) () const template&lt;class \_data\_type = float&gt; ROCKY\_FUNCTIONS void [set\_scalar](structIRockySPHElementScalars.xhtml#a5dae91ede893e406367059aae00764d5) (int scalar\_index, \_data\_type value) const ROCKY\_FUNCTIONS void [set\_turbulent\_viscosity](structIRockySPHElementScalars.xhtml#aebb2bc65cb47b22517249ce65c8728a8) (const float value) ROCKY\_FUNCTIONS void [set\_temperature](structIRockySPHElementScalars.xhtml#aa04f956ddd857b6b6fd7e2a6fe44a494) (const float value) ROCKY\_FUNCTIONS void [set\_heat\_transfer](structIRockySPHElementScalars.xhtml#af40e66b6c4bbea654f110c9d42b3a72f) (const float value) template&lt;class \_data\_type = float&gt; ROCKY\_FUNCTIONS void [add\_scalar](structIRockySPHElementScalars.xhtml#a72d99d6c1f69b32a5e9e77325974b1f1) (int scalar\_index, \_data\_type value) const ROCKY\_FUNCTIONS void [add\_turbulent\_viscosity](structIRockySPHElementScalars.xhtml#a22c42af1b9c839d1693a42ac889a09df) (const float value) ROCKY\_FUNCTIONS void [add\_temperature](structIRockySPHElementScalars.xhtml#ae6f55ad8e1a6915cccbade3f199315a4) (const float value) ROCKY\_FUNCTIONS void [add\_heat\_transfer](structIRockySPHElementScalars.xhtml#ace6ee0291cca05f39eb04ba4c760afe0) (const float value) template&lt;class \_data\_type = float&gt; ROCKY\_FUNCTIONS void [max\_scalar](structIRockySPHElementScalars.xhtml#af020615c90124b8fe6d7168e964515b6) (int scalar\_index, \_data\_type value) const <a id="details" name="details"></a>## Detailed Description

When running a simulation, an `<a class="el" href="structIRockySPHElementScalars.xhtml">IRockySPHElementScalars</a>` object gives access to all SPH element scalars defined in the project. These SPH element scalars can be built-in scalars defined within the Rocky solver, or custom SPH element scalars defined by the current module or other active modules.



## Member Function Documentation

<a id="ace6ee0291cca05f39eb04ba4c760afe0" name="ace6ee0291cca05f39eb04ba4c760afe0"></a>## [◆ ](#ace6ee0291cca05f39eb04ba4c760afe0)add\_heat\_transfer()

 ROCKY\_FUNCTIONS void IRockySPHElementScalars::add\_heat\_transfer  ( const float  *value*) 

This method can be used for accumulating the heat transfer rate values that aSPH element interchanges with the surrounding SPH elements, DEM elements and geometries.Parameters valueThe heat transfer rate value to be added. 



<a id="a72d99d6c1f69b32a5e9e77325974b1f1" name="a72d99d6c1f69b32a5e9e77325974b1f1"></a>## [◆ ](#a72d99d6c1f69b32a5e9e77325974b1f1)add\_scalar()

template&lt;class _data_type = float&gt; 

 ROCKY\_FUNCTIONS void IRockySPHElementScalars::add\_scalar  ( int  *scalar\_index*,    \_data\_type  *value*   )  const

If a custom scalar variable was defined during the setup of the module,this method can be used to sum a value to the current one stored in it.Parameters scalar\_indexThe integer index that was associated to the scalar variable during the setup of the module.valueThe value that must be summed to the current stored value.  




<a id="ae6f55ad8e1a6915cccbade3f199315a4" name="ae6f55ad8e1a6915cccbade3f199315a4"></a>## [◆ ](#ae6f55ad8e1a6915cccbade3f199315a4)add\_temperature()

 ROCKY\_FUNCTIONS void IRockySPHElementScalars::add\_temperature  ( const float  *value*) 

This method sums a value to the current temperature of a SPH element.Parameters valueThe value to be added to the temperature. 



<a id="a22c42af1b9c839d1693a42ac889a09df" name="a22c42af1b9c839d1693a42ac889a09df"></a>## [◆ ](#a22c42af1b9c839d1693a42ac889a09df)add\_turbulent\_viscosity()

 ROCKY\_FUNCTIONS void IRockySPHElementScalars::add\_turbulent\_viscosity  ( const float  *value*) 

This method sums a value to the current turbulent viscosity stored for the SPH element.Parameters valueThe value summed to the turbulent viscosity. 



<a id="a8a1580996da5f171f535de7e7487fe01" name="a8a1580996da5f171f535de7e7487fe01"></a>## [◆ ](#a8a1580996da5f171f535de7e7487fe01)get\_heat\_transfer()

 ROCKY\_FUNCTIONS float IRockySPHElementScalars::get\_heat\_transfer  ( )  const

ReturnsThe value of the total heat transfer rate towards/from the SPH element. Heat transfer rate is a built-in SPH element scalar defined by the Rocky solver, which is activated when a thermal model is enabled in a project. 



<a id="acf45b1ddd0d68df837ec264d2758693f" name="acf45b1ddd0d68df837ec264d2758693f"></a>## [◆ ](#acf45b1ddd0d68df837ec264d2758693f)get\_scalar()

template&lt;class _data_type = float&gt; 

 ROCKY\_FUNCTIONS \_data\_type IRockySPHElementScalars::get\_scalar  ( int  *scalar\_index*)  const

If a custom scalar variable was defined during the setup of the module,the value currently stored can be accessed with this method.Parameters scalar\_indexThe integer index that was associated to the scalar variable during the setup of the module.ReturnsThe value currently stored in the scalar variable. 



<a id="aa7d031c763a7c8c643ec7a86c07ae6d3" name="aa7d031c763a7c8c643ec7a86c07ae6d3"></a>## [◆ ](#aa7d031c763a7c8c643ec7a86c07ae6d3)get\_temperature()

 ROCKY\_FUNCTIONS float IRockySPHElementScalars::get\_temperature  ( )  const

ReturnsThe value of the temperature of the SPH element. Temperature is a built-in SPH element scalar defined by the Rocky solver, which is activated when a thermal model is enabled in a project. 



<a id="af70cf6bb3041f4c5e9a8c336ea47b201" name="af70cf6bb3041f4c5e9a8c336ea47b201"></a>## [◆ ](#af70cf6bb3041f4c5e9a8c336ea47b201)get\_turbulent\_viscosity()

 ROCKY\_FUNCTIONS float IRockySPHElementScalars::get\_turbulent\_viscosity  ( )  const

ReturnsThe value of the turbulent viscosity. Turbulent viscosity is a built-in SPH element scalar defined in the Rocky solver, whose values can be calculated either by a built-in model or by a custom module. 



<a id="af020615c90124b8fe6d7168e964515b6" name="af020615c90124b8fe6d7168e964515b6"></a>## [◆ ](#af020615c90124b8fe6d7168e964515b6)max\_scalar()

template&lt;class _data_type = float&gt; 

 ROCKY\_FUNCTIONS void IRockySPHElementScalars::max\_scalar  ( int  *scalar\_index*,    \_data\_type  *value*   )  const

If a custom scalar variable was defined during the setup of the module,this method can be used to make the scalar store the maximum of a set of values. A common use of this method is, for instance, to find the maximum among a set of values associated to the contacts of a particle.Parameters scalar\_indexThe integer index that was associated to the scalar variable during the setup of the module.valueA value that must be checked if it is greater than the current stored value. 



<a id="af40e66b6c4bbea654f110c9d42b3a72f" name="af40e66b6c4bbea654f110c9d42b3a72f"></a>## [◆ ](#af40e66b6c4bbea654f110c9d42b3a72f)set\_heat\_transfer()

 ROCKY\_FUNCTIONS void IRockySPHElementScalars::set\_heat\_transfer  ( const float  *value*) 

This method can be used by a custom module implementing a thermal model in order toset the calculated value of the total heat transfer towards/from a SPH element.Parameters valueThe value of the heat transfer rate to be set. 



<a id="a5dae91ede893e406367059aae00764d5" name="a5dae91ede893e406367059aae00764d5"></a>## [◆ ](#a5dae91ede893e406367059aae00764d5)set\_scalar()

template&lt;class _data_type = float&gt; 

 ROCKY\_FUNCTIONS void IRockySPHElementScalars::set\_scalar  ( int  *scalar\_index*,    \_data\_type  *value*   )  const

If a custom scalar variable was defined during the setup of the module,this method can be used to store a value on it.Parameters scalar\_indexThe integer index that was associated to the scalar variable during the setup of the module.valueThe value that must be stored. 



<a id="aa04f956ddd857b6b6fd7e2a6fe44a494" name="aa04f956ddd857b6b6fd7e2a6fe44a494"></a>## [◆ ](#aa04f956ddd857b6b6fd7e2a6fe44a494)set\_temperature()

 ROCKY\_FUNCTIONS void IRockySPHElementScalars::set\_temperature  ( const float  *value*) 

This method can be used by a custom module implementing a thermal model in order toset the value of the temperature of a SPH element.Parameters valueThe value of the temperature to be set. 



<a id="aebb2bc65cb47b22517249ce65c8728a8" name="aebb2bc65cb47b22517249ce65c8728a8"></a>## [◆ ](#aebb2bc65cb47b22517249ce65c8728a8)set\_turbulent\_viscosity()

 ROCKY\_FUNCTIONS void IRockySPHElementScalars::set\_turbulent\_viscosity  ( const float  *value*) 

This method can be used by a custom module implementing a turbulent model in order toset the value of the turbulent viscosity for later use in the flow equations.Parameters valueThe value of the turbulent viscosity.