    

 ## On this page

  

 

 # IRockyFluidScalars Struct Reference

 Last update: 16.07.2025 

`#include <<a class="el" href="rocky__fluid__scalars_8hpp_source.xhtml">rocky_fluid_scalars.hpp</a>>`

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

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

ROCKY\_FUNCTIONS double [get\_scalar](#a75d5c92f06422a5d29704788404405d0) (int scalar\_index) const ROCKY\_FUNCTIONS void [set\_scalar](#aec66ca90576555d400f9c6d401b049e4) (int scalar\_index, double value) const ROCKY\_FUNCTIONS void [add\_scalar](#a536c29f3a14dc5bbed6047f43baa37ec) (int scalar\_index, double value) const ROCKY\_FUNCTIONS void [max\_scalar](#aaa969c416dea0ac4eb4721c5b8d75b24) (int scalar\_index, double value) const <a id="details" name="details"></a>## Detailed Description

During the iterative process of a simulation, `<a class="el" href="structIRockyFluidScalars.xhtml">IRockyFluidScalars</a>` gives access to all fluid scalars defined in the project. These fluid scalars can be built-in scalars defined in the Rocky solver, or custom fluid scalars defined by the current module or other active modules.



## Member Function Documentation

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

 ROCKY\_FUNCTIONS void IRockyFluidScalars::add\_scalar  ( int *scalar\_index*,    double *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. In the case of fluid scalars that are marked as additional variables to be shared with Fluent, the value refers to the particle's contribution to the fluid cell, since Rocky will convert it to the cell value automatically by dividing by the cell volume \[m3\] which the particle belongs to, and by the CFD timestep \[s\]. For example, when adding a mass source \[kg\] to the fluid, the valuewill be converted to kg/m3.s before sending it to Fluent.In the case of fluid scalars which are Fluent additional inputs, 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="a75d5c92f06422a5d29704788404405d0" name="a75d5c92f06422a5d29704788404405d0"></a>## [◆ ](#a75d5c92f06422a5d29704788404405d0)get\_scalar()

 ROCKY\_FUNCTIONS double IRockyFluidScalars::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="aaa969c416dea0ac4eb4721c5b8d75b24" name="aaa969c416dea0ac4eb4721c5b8d75b24"></a>## [◆ ](#aaa969c416dea0ac4eb4721c5b8d75b24)max\_scalar()

 ROCKY\_FUNCTIONS void IRockyFluidScalars::max\_scalar  ( int *scalar\_index*,    double *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="aec66ca90576555d400f9c6d401b049e4" name="aec66ca90576555d400f9c6d401b049e4"></a>## [◆ ](#aec66ca90576555d400f9c6d401b049e4)set\_scalar()

 ROCKY\_FUNCTIONS void IRockyFluidScalars::set\_scalar  ( int *scalar\_index*,    double *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. In the case of fluid scalars that are marked as additional variables to be shared with Fluent, the value refers to the particle's contribution to the fluid cell, since Rocky will convert it to the cell value automatically by dividing by the cell volume \[m3\] which the particle belongs to, and by the CFD timestep \[s\]. For example, when adding a mass source \[kg\] to the fluid, the valuewill be converted to kg/m3.s before sending it to Fluent.Parameters scalar\_indexThe integer index that was associated to the scalar variable during the setup of the module.valueThe value that must be stored.