> ## 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.

# IRockyFluidScalarsModel Struct Reference

`#include <rocky_fluid_scalars.hpp>`

Inherits ScalarsModel\< rocky20::FluidScalarsController >.

## Public Types

| Type | Name |
| - | - |
| enum | [SpeciesVariableType](#a1465371482cae63842154f22ab4ebbb4) \{ **MoleFraction** , **MassDiffusivity** , **MolecularWeight** , **MassSource** } |

## Public Member Functions

| Type | Name |
| - | - |
| void | [enable\_storage\_cell\_volume](#a6f1e21645261447c930050eff3ecb35b) () |
| int | [find\_species\_scalar](#a427a7869774490548c1bf586eb982efd) (const [SpeciesVariableType](#a1465371482cae63842154f22ab4ebbb4) type, const std::string species\_name="", const std::string phase\_name="") |
| std::string | [get\_scalar\_name](#a42b5926c5293c2e9b6e1ae0bf6f3db2c) (int index) |
| std::string | [get\_scalar\_unit](#a702ee4844ebadeb36f72564dd8b6a732) (int index) |
| int | [find](#a9b9a2807854efdeaea33d558210c3901) (const char \*name) |
| int | [add](#a9e0b69da64fd09543ff1b9a43c30e6b3) (const char \*name, const char \*unit, bool output=true) |
| void | [reset](#a91892f2da14aaaf2473361223db628c4) (int scalar\_index) |
| void | [set\_dimension](#aceb74d48527a53376833f9336f0073cd) (int scalar\_index, double dimension\_factor) |

## Detailed Description

An [`IRockyFluidScalarsModel`](https://developer.synopsys.com/docs/rocky/rocky-solver-sdk/2025-r2/structIRockyFluidScalarsModel) allows users to add new fluid scalars, or find fluid scalars created in other modules, all during the setup phase of a module. Fluid scalars are special variables attached to CFD cell elements that store per-cell values preserved between simulation time iterations.

## Member Enumeration Documentation

### SpeciesVariableType

```cpp theme={null}
enum IRockyFluidScalarsModel::SpeciesVariableType
```

**Enumerate with the types of species variables**

## Member Function Documentation

### add()

```cpp theme={null}
int IRockyFluidScalarsModel::add(
    const char * name,
    const char * unit,
    bool output = true
)
```

**This method creates a new scalar variable of type `double`**

for storing custom values during a simulation, preserving them between time iterations.

**Parameters**

| Name | Description |
| - | - |
| name | The name given to the scalar variable. The purpose of this name is twofold. First, it enables to find this scalar variable from other module, in order to share their values. Second, if the scalar variable can be displayed in a 3D window as a property, this name will identify it in the Rocky UI. |
| unit | A string specifying the unit in S.I. associated to the scalar variable. |
| output | Enables/disables the storage in disk at output times, for the visualization and post-processing of the scalar values. |

**Returns**

The index that will uniquely identify the scalar variable during the execution of the simulation.

### enable\_storage\_cell\_volume()

```cpp theme={null}
void IRockyFluidScalarsModel::enable_storage_cell_volume()
```

**This method enables the fluid cell volume scalar.**

### find()

```cpp theme={null}
int IRockyFluidScalarsModel::find(const char * name)
```

**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**

| Name | Description |
| - | - |
| name | The name given to the scalar at the moment of its creation. |

**Returns**

The index that uniquely identifies the wanted scalar if it was actually found. It returns -1 otherwise.

### find\_species\_scalar()

```cpp theme={null}
int IRockyFluidScalarsModel::find_species_scalar(
    const SpeciesVariableType type,
    const std::string species_name = "",
    const std::string phase_name = ""
)
```

**This method searches for a species scalar variable already created by the CFD module,**

in order to allow access to its values, or store new values on it, during the execution of the simulation.

**Parameters**

| Name | Description |
| - | - |
| type | The type of the species variable according to the enum SpeciesVariableType |
| species\_name | The species name |
| phase\_name | The phase name |

**Returns**

The index that uniquely identifies the wanted scalar if it was actually found. It returns -1 otherwise.

### get\_scalar\_name()

```cpp theme={null}
std::string IRockyFluidScalarsModel::get_scalar_name(int index)
```

**This method returns the scalar name if it exists.**

**Parameters**

| Name | Description |
| - | - |
| index | The index of the scalar |

**Returns**

the scalar name if the index is valid. Throws an error otherwise.

### get\_scalar\_unit()

```cpp theme={null}
std::string IRockyFluidScalarsModel::get_scalar_unit(int index)
```

**This method returns the scalar unit if it exists.**

**Parameters**

| Name | Description |
| - | - |
| index | The index of the scalar |

**Returns**

the scalar unit if the index is valid. Throws an error otherwise..

### reset()

```cpp theme={null}
void IRockyFluidScalarsModel::reset(int scalar_index)
```

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

**Parameters**

| Name | Description |
| - | - |
| scalar\_index | The index attributed to the scalar variable at the moment of its creation. |

### set\_dimension()

```cpp theme={null}
void IRockyFluidScalarsModel::set_dimension(
    int scalar_index,
    double dimension_factor
)
```

**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`](https://developer.synopsys.com/docs/rocky/rocky-solver-sdk/2025-r2/structIRockyModel) object.

**Parameters**

| Name | Description |
| - | - |
| scalar\_index | The index attributed to the scalar variable at the moment of its creation. |
| dimension\_factor | The appropriate dimensional factor for the scalar variable. |
