> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Structure IRockyFluidScalars

![][C++]
![][public]

**#include \<rocky\_fluid\_scalars.hpp>**

During the iterative process of a simulation, `IRockyFluidScalars` 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.

**Inherits from**:

* EntityScalars\< rocky20::FluidScalars >

## Members

* [add\_scalar](#structIRockyFluidScalars_1a536c29f3a14dc5bbed6047f43baa37ec)
* [get\_scalar](#structIRockyFluidScalars_1a75d5c92f06422a5d29704788404405d0)
* [max\_scalar](#structIRockyFluidScalars_1aaa969c416dea0ac4eb4721c5b8d75b24)
* [set\_scalar](#structIRockyFluidScalars_1aec66ca90576555d400f9c6d401b049e4)

## Public functions

### Function get\_scalar

![][public]
![][const]

```cpp theme={null}
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\_index**: The integer index that was associated to the scalar variable during the setup of the module.

**Returns**:

The value currently stored in the scalar variable.

**Parameters**:

* int **scalar\_index**

**Return type**: ROCKY\_FUNCTIONS double

### Function set\_scalar

![][public]
![][const]

```cpp theme={null}
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 value**:

will be converted to kg/m3.s before sending it to Fluent.

**Parameters**:

* **scalar\_index**: The integer index that was associated to the scalar variable during the setup of the module.
* **value**: The value that must be stored.

**Parameters**:

* int **scalar\_index**
* double **value**

**Return type**: ROCKY\_FUNCTIONS void

### Function add\_scalar

![][public]
![][const]

```cpp theme={null}
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 value**:

will be converted to kg/m3.s before sending it to Fluent.

\*\*In the case of fluid scalars which are Fluent additional inputs, \*\*:

**Parameters**:

* **scalar\_index**: The integer index that was associated to the scalar variable during the setup of the module.
* **value**: The value that must be summed to the current stored value.\


**Parameters**:

* int **scalar\_index**
* double **value**

**Return type**: ROCKY\_FUNCTIONS void

### Function max\_scalar

![][public]
![][const]

```cpp theme={null}
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\_index**: The integer index that was associated to the scalar variable during the setup of the module.
* **value**: A value that must be checked if it is greater than the current stored value.

**Parameters**:

* int **scalar\_index**
* double **value**

**Return type**: ROCKY\_FUNCTIONS void

[public]: https://img.shields.io/badge/-public-brightgreen "public"

[C++]: https://img.shields.io/badge/language-C%2B%2B-blue "C++"

[const]: https://img.shields.io/badge/-const-lightblue "const"
