Structure IRockyFluidScalarsModel
Last update: 09.03.2026
#include
An IRockyFluidScalarsModel 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.
Inherits from:
- ScalarsModel\ rocky20::FluidScalarsController >
Members
- add
- enable_storage_cell_volume
- find
- find_species_scalar
- get_scalar_name
- get_scalar_unit
- MassDiffusivity
- MassSource
- MolecularWeight
- MoleFraction
- reset
- set_dimension
- SpeciesVariableType
Public types
Enumeration type SpeciesVariableType
#include
enum SpeciesVariableType {
MoleFraction,
MassDiffusivity,
MolecularWeight,
MassSource
}
Enumerate with the types of species variables:
Enumerator MoleFraction
Enumerator MassDiffusivity
Enumerator MolecularWeight
Enumerator MassSource
Public functions
Function enable_storage_cell_volume
void IRockyFluidScalarsModel::enable_storage_cell_volume()
This method enables the fluid cell volume scalar.:
Return type: void
Function find_species_scalar
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:
- 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.
Parameters:
- const SpeciesVariableType type
- const std::string species_name = ""
- const std::string phase_name = ""
Return type: int
Function get_scalar_name
std::string IRockyFluidScalarsModel::get_scalar_name(int index)
This method returns the scalar name if it exists.:
Parameters:
- index: The index of the scalar
Returns:
the scalar name if the index is valid. Throws an error otherwise.
Parameters:
- int index
Return type: std::string
Function get_scalar_unit
std::string IRockyFluidScalarsModel::get_scalar_unit(int index)
This method returns the scalar unit if it exists.:
Parameters:
- index: The index of the scalar
Returns:
the scalar unit if the index is valid. Throws an error otherwise..
Parameters:
- int index
Return type: std::string
Function 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:
- 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.
Parameters:
- const char * name
Return type: int
Function 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:
- 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.
Parameters:
- const char * name
- const char * unit
- bool output = true
Return type: int
Function reset
void IRockyFluidScalarsModel::reset(int scalar_index)
This method resets to zero all values stored in a scalar variable.:
Parameters:
- scalar_index: The index attributed to the scalar variable at the moment of its creation.
Parameters:
- int scalar_index
Return type: void
Function set_dimension
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 object.
Parameters:
- 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.
Parameters:
- int scalar_index
- double dimension_factor
Return type: void
[const]: https://img.shields.io/badge/-const-lightblue (const)