    

 ## On this page

  

 

 # IRockyFluidScalarsModel Struct Reference

 Last update: 16.07.2025 

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

Inherits ScalarsModel&lt; rocky20::FluidScalarsController &gt;.

## <a id="pub-types" name="pub-types"></a>Public Types

enum [SpeciesVariableType](#a1465371482cae63842154f22ab4ebbb4) { **MoleFraction**, **MassDiffusivity**, **MolecularWeight**, **MassSource** } ## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

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) <a id="details" name="details"></a>## Detailed Description

An `<a class="el" href="structIRockyFluidScalarsModel.xhtml">IRockyFluidScalarsModel</a>` 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

<a id="a1465371482cae63842154f22ab4ebbb4" name="a1465371482cae63842154f22ab4ebbb4"></a>## [◆ ](#a1465371482cae63842154f22ab4ebbb4)SpeciesVariableType

 enum [IRockyFluidScalarsModel::SpeciesVariableType](#a1465371482cae63842154f22ab4ebbb4)

Enumerate with the types of species variables



## Member Function Documentation

<a id="a9e0b69da64fd09543ff1b9a43c30e6b3" name="a9e0b69da64fd09543ff1b9a43c30e6b3"></a>## [◆ ](#a9e0b69da64fd09543ff1b9a43c30e6b3)add()

 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 nameThe 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.unitA string specifying the unit in S.I. associated to the scalar variable.outputEnables/disables the storage in disk at output times, for the visualization and post-processing of the scalar values.ReturnsThe index that will uniquely identify the scalar variable during the execution of the simulation. 



<a id="a6f1e21645261447c930050eff3ecb35b" name="a6f1e21645261447c930050eff3ecb35b"></a>## [◆ ](#a6f1e21645261447c930050eff3ecb35b)enable\_storage\_cell\_volume()

 void IRockyFluidScalarsModel::enable\_storage\_cell\_volume  ( ) 

This method enables the fluid cell volume scalar.



<a id="a9b9a2807854efdeaea33d558210c3901" name="a9b9a2807854efdeaea33d558210c3901"></a>## [◆ ](#a9b9a2807854efdeaea33d558210c3901)find()

 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 nameThe name given to the scalar at the moment of its creation.ReturnsThe index that uniquely identifies the wanted scalar if it was actually found. It returns -1 otherwise. 



<a id="a427a7869774490548c1bf586eb982efd" name="a427a7869774490548c1bf586eb982efd"></a>## [◆ ](#a427a7869774490548c1bf586eb982efd)find\_species\_scalar()

 int IRockyFluidScalarsModel::find\_species\_scalar  ( const [SpeciesVariableType](#a1465371482cae63842154f22ab4ebbb4) *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 typeThe type of the species variable according to the enum SpeciesVariableType species\_nameThe species name phase\_nameThe phase nameReturnsThe index that uniquely identifies the wanted scalar if it was actually found. It returns -1 otherwise. 



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

 std::string IRockyFluidScalarsModel::get\_scalar\_name  ( int *index*) 

This method returns the scalar name if it exists.Parameters indexThe index of the scalarReturnsthe scalar name if the index is valid. Throws an error otherwise. 



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

 std::string IRockyFluidScalarsModel::get\_scalar\_unit  ( int *index*) 

This method returns the scalar unit if it exists.Parameters indexThe index of the scalarReturnsthe scalar unit if the index is valid. Throws an error otherwise.. 



<a id="a91892f2da14aaaf2473361223db628c4" name="a91892f2da14aaaf2473361223db628c4"></a>## [◆ ](#a91892f2da14aaaf2473361223db628c4)reset()

 void IRockyFluidScalarsModel::reset  ( int *scalar\_index*) 

This method resets to zero all values stored in a scalar variable.Parameters scalar\_indexThe index attributed to the scalar variable at the moment of its creation. 



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

 void IRockyFluidScalarsModel::set\_dimension  ( int *scalar\_index*,    double *dimension\_factor* )

The purpose of this method is to associate a dimensional factorto 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 `<a class="el" href="structIRockyModel.xhtml">IRockyModel</a>` object.Parameters scalar\_indexThe index attributed to the scalar variable at the moment of its creation.dimension\_factorThe appropriate dimensional factor for the scalar variable.