OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members
FuelCellShop::SolutionVariable Struct Reference

This structure is used to encapsulate data from constant values and variable solution data that is used in Layer classes to compute effective transport properties. More...

#include <fcst_variables.h>

Public Member Functions

Initialization
 SolutionVariable ()
 Default Constructor. More...
 
 SolutionVariable (const std::vector< double > *data_in, const VariableNames &name_in)
 Constructor for setting up the pointer to solution variable values and name of the solution variable. More...
 
 SolutionVariable (const double &value, const unsigned int &length, const VariableNames &name_in)
 Constructor to initialize the solution variable values, taking a default value and size of the vector as an input argument. More...
 
 SolutionVariable (const std::vector< double > &data_in, const VariableNames &name_in)
 Constructor to initialize the solution variable values, taking values as an input vector argument. More...
 
Accessors
const std::vector< double > & get_default_data () const
 Return a reference to the default_data stored in the class. More...
 
const std::vector< double > * get_data () const
 
VariableNames get_variablename () const
 Function to get the VariableNames enumeration corresponding to this struct. More...
 
const bool is_initialized () const
 Function to determine whether the structure is initialized or not. More...
 
const bool is_default_data_initialized () const
 
const bool is_data_initialized () const
 
unsigned int size () const
 Function to the length of the internal data element. More...
 

Private Attributes

DATA
std::vector< double > default_data
 Constant data. More...
 
const std::vector< double > * data
 Data in quadrature points of a mesh entity. More...
 
VariableNames name
 FCST variable name stored in VariableNames enumeration. More...
 
bool initialized
 true if either default_data or data is initialized. More...
 
bool initialized_default_data
 true if default_data is initialized. More...
 
bool initialized_data
 true if data is initialized. More...
 

Operators

const double & operator[] (const unsigned int &i) const
 Operator to access the value at a particular quadrature point in the cell. More...
 
SolutionVariable operator* (const SolutionVariable &left, const double &right)
 Operator SolutionVariable * double. More...
 
SolutionVariable operator* (const double &left, const SolutionVariable &right)
 Operator double * SolutionVariable. More...
 
SolutionVariable operator/ (const SolutionVariable &left, const double &right)
 Operator SolutionVariable / double. More...
 

Detailed Description

This structure is used to encapsulate data from constant values and variable solution data that is used in Layer classes to compute effective transport properties.

This structure is usually generated inside Equation classes and then passed to the layer class as appropriate. The layer then harvests the appropriate information.

This structure is used to store values for a particular solution variable, at all quadrature points in the cell. It is best utilized while setting previous Newton iteration values from application to the layer classes etc. It is recommended that those classes which require certain old solution values to compute effective properties etc. should contain this structure as their data member. This structure has four constructors. Default constructor doesn't set any value. It also sets the Boolean member initialized to false. This can be checked by using is_initialized member function and is helpful to determine whether any values are stored or not inside the object. The other constructor takes std::vector<double>* corresponding to the solution variable values and enumeration VariableNames representing the name of the solution variable. The VariableNames of the solution variable can be accessed by get_variablename() method. In order to access value at a particular quadrature point, operator [ ] is provided. Other two constructors are useful in the case when we set some default values for a particular variable (which is not being solved in the current application).

Sample Usage:

* // Inside the application, let's pass temperature vector from old solution to the layer class.
* // Old solution is accessed from FuelCell::ApplicationCore::DoFApplication<dim>::CellInfo cell_info object.
*
* SolutionVariable temperature_old( &cell_info.values[last_iter][temp_index], VariableNames::temperature_of_REV );
* layer.set_solution( temperature_old );
*
* // Let us compute the temperature in Celsius at first quadrature point in the layer/kinetics etc. class:
*
* SolutionVariable temperature_cell;
* // Inside the layer/kinetics etc. class, temperature values are set into the temperature_cell structure using the set_solution method from the application.
*
* if (temperature_cell.is_initialized() && (temperature_cell.get_variablename() == VariableNames::temperature_of_REV)
* {
* double temp_celsius = temperature_cell[0] - 273.15;
* }
*

Can we create a "super" SolutionVariable object that stores all constant and variable data needed at each quadrature point? The amount of data needed would be provided by SystemManagement in combination with Equation classes.

Author
Philip Wardlaw
Madhur Bhaiya
Marc Secanell
Valentin N. Zingan

Constructor & Destructor Documentation

FuelCellShop::SolutionVariable::SolutionVariable ( )
inline

Default Constructor.

FuelCellShop::SolutionVariable::SolutionVariable ( const std::vector< double > *  data_in,
const VariableNames name_in 
)
inline

Constructor for setting up the pointer to solution variable values and name of the solution variable.

FuelCellShop::SolutionVariable::SolutionVariable ( const double &  value,
const unsigned int &  length,
const VariableNames name_in 
)
inline

Constructor to initialize the solution variable values, taking a default value and size of the vector as an input argument.

Note
This constructor is recommended when the solution variable values are not being solved for in the application, while it is a required variable to compute certain properties. Then, it can be used to set some default values.
FuelCellShop::SolutionVariable::SolutionVariable ( const std::vector< double > &  data_in,
const VariableNames name_in 
)
inline

Constructor to initialize the solution variable values, taking values as an input vector argument.

Note
This constructor is recommended when the solution variable values are not being solved for in the application, while it is a required variable to compute certain properties. Then, it can be used to set some default values.

Member Function Documentation

const std::vector<double>* FuelCellShop::SolutionVariable::get_data ( ) const
inline
const std::vector<double>& FuelCellShop::SolutionVariable::get_default_data ( ) const
inline

Return a reference to the default_data stored in the class.

The default_data is the data that was passed to the class in the constructor.

VariableNames FuelCellShop::SolutionVariable::get_variablename ( ) const
inline
const bool FuelCellShop::SolutionVariable::is_data_initialized ( ) const
inline
const bool FuelCellShop::SolutionVariable::is_default_data_initialized ( ) const
inline
const bool FuelCellShop::SolutionVariable::is_initialized ( ) const
inline
const double& FuelCellShop::SolutionVariable::operator[] ( const unsigned int &  i) const
inline

Operator to access the value at a particular quadrature point in the cell.

Note
Solution values vector should be initialized before using this operator. Also, the input index should not be out of range.
unsigned int FuelCellShop::SolutionVariable::size ( ) const
inline

Function to the length of the internal data element.

Friends And Related Function Documentation

SolutionVariable operator* ( const SolutionVariable left,
const double &  right 
)
friend

Operator SolutionVariable * double.

All default_data at quadrature points is multilpied by right operand. The multiplication is performed on default_data only. Therefore, to use this operator, default_data is initialized and data is NOT.

SolutionVariable operator* ( const double &  left,
const SolutionVariable right 
)
friend

Operator double * SolutionVariable.

All default_data at quadrature points is multilpied by left operand. The multiplication is performed on default_data only. Therefore, to use this operator, default_data is initialized and data is NOT.

SolutionVariable operator/ ( const SolutionVariable left,
const double &  right 
)
friend

Operator SolutionVariable / double.

All default_data at quadrature points is divided by right operand. The division is performed on default_data only. Therefore, to use this operator, default_data is initialized and data is NOT.

Member Data Documentation

const std::vector<double>* FuelCellShop::SolutionVariable::data
private

Data in quadrature points of a mesh entity.

Warning
Only one of either default_data or data is initialize. The selection occurs depending on the constructor used.
std::vector<double> FuelCellShop::SolutionVariable::default_data
private

Constant data.

Warning
Only one of either default_data or data is initialize. The selection occurs depending on the constructor used.
bool FuelCellShop::SolutionVariable::initialized
private

true if either default_data or data is initialized.

bool FuelCellShop::SolutionVariable::initialized_data
private

true if data is initialized.

bool FuelCellShop::SolutionVariable::initialized_default_data
private

true if default_data is initialized.

VariableNames FuelCellShop::SolutionVariable::name
private

FCST variable name stored in VariableNames enumeration.


The documentation for this struct was generated from the following file: