OpenFCST: The open-source Fuel Cell Simulation Toolbox
|
Class used to store, read from file and define scaling factors to be applied to equations in equation matrix and solutions in solution residual. More...
#include <scaling.h>
Public Member Functions | |
Scaling (FuelCell::SystemManagement &system_management) | |
Constructor. More... | |
~Scaling () | |
Destructor. More... | |
void | declare_parameters (ParameterHandler ¶m) const |
Declare all necessary parameters in order to compute the coefficients. More... | |
void | initialize (ParameterHandler ¶m) |
Class used to read in data and initialize the necessary data to compute the coefficients. More... | |
const bool | get_apply_scaling_bool () const |
Function to return applyScaling bool. More... | |
void | scale_cell_matrix (MatrixVector &cell_matrices) |
Function scales cell_matrix, typically called in cell_matrix(). More... | |
void | scale_cell_residual (FEVector &cell_res) |
Function scales cell_residual, typically called in cell_residual(). More... | |
void | scale_bdry_matrix (MatrixVector &local_bdry_matrices, MatrixVector &bdry_matrices) |
Function scales bdry_matrix, typically called in bdry_matrix(). More... | |
void | scale_bdry_residual (FEVector &local_bdry_res, FEVector &bdry_res) |
Function scales bdry_residual, typically called in bdry_residual(). More... | |
void | create_local_bdry_matrix (MatrixVector &local_bdry_matrices, MatrixVector &bdry_matrices) |
Due to issues with MatrixVector this function, loops through all the blocks and correctly sizes local_bdry_matrices for you. More... | |
Private Attributes | |
FuelCell::SystemManagement * | system_management |
Pointer to the external YourApplication<dim>::system_management object. More... | |
bool | applyScaling = false |
Bool to determine if user wants scalin to occur as based on parameter file. More... | |
std::map< std::string, double > | ScalingMap |
Map of the FuelCell::SystemManagement EquationNames (LHS) and their respective scaling factor. More... | |
Class used to store, read from file and define scaling factors to be applied to equations in equation matrix and solutions in solution residual.
It stores the following:
applyScaling
ScalingMap
NOTE: applyScaling
does not necessarliy prevent use of function calls from Scaling class. That must be implemented in the application class. This bool just provides the necessary information for implementation.
WARNING: you should have a thourough understanding of how the equations are applied before using this class. As well, always confirm that you have applied them correctly and solutions match a case when no scaling occured.
In the input file, the following parameters can be specified (see declare_parameters ), with examples of how to use:
In order to use this class, first an object of the class needs to be created. Usually, one such objects exists in every application. To create the object, include the .h file in the include application file and in the application data member section add the object. For example:
Once the object is created, the section where the input data will be specified in the input file needs to be declared. To do so, in the declare_parameters section of your application call the following:
Finally, once the input file has been read by our application, your class needs to be initialized. You may want to use get_apply_scaling_bool() to set a bool that will tell your applications if scaling will occur. This bool can then be checked before scaling functions are called. That way, if no scaling is required then the functions do not need to be called. This is achieved using the function initialize()
You are now ready to use your Scaling object.
FuelCell::Scaling::Scaling | ( | FuelCell::SystemManagement & | system_management | ) |
Constructor.
FuelCell::Scaling::~Scaling | ( | ) |
Destructor.
void FuelCell::Scaling::create_local_bdry_matrix | ( | MatrixVector & | local_bdry_matrices, |
MatrixVector & | bdry_matrices | ||
) |
Due to issues with MatrixVector this function, loops through all the blocks and correctly sizes local_bdry_matrices
for you.
local_bdry_matrices
is returned by reference.
void FuelCell::Scaling::declare_parameters | ( | ParameterHandler & | param | ) | const |
Declare all necessary parameters in order to compute the coefficients.
The parameters that can be specified in the input file are as follows:
|
inline |
Function to return applyScaling
bool.
This way you can check bool before calling scaling functions to prevent wasted time running scaling functions.
References applyScaling.
void FuelCell::Scaling::initialize | ( | ParameterHandler & | param | ) |
Class used to read in data and initialize the necessary data to compute the coefficients.
void FuelCell::Scaling::scale_bdry_matrix | ( | MatrixVector & | local_bdry_matrices, |
MatrixVector & | bdry_matrices | ||
) |
Function scales bdry_matrix, typically called in bdry_matrix().
Call at then end of function.
NOTE: at beginning of function create a local boundary residual like so,
FEVector local_bdry_res(this->block_info.local);
and use this FEVector in assemble_bdry_residual() functions. Finally call scale_bdry_residual() and give the local boundary residual as first argument, and the actual boundary residual as second argument. The correct actual boundary residual is then returned by reference.
Function scales bdry_residual, typically called in bdry_residual().
Call at then end of function.
NOTE: at beginning of function create a local boundary matrix like so,
MatrixVector local_bdry_matrices; Scale.create_local_bdry_matrix(local_bdry_matrices, bdry_matrices); // See create_local_bdry_matrix() for more information
and use this MatrixVector in assemble_bdry_residual() functions. Finally call scale_bdry_matrix() and give the local boundary matrix as first argument, and the actual boundary matrix as second argument. The correct actual boundary matrix is then returned by reference.
void FuelCell::Scaling::scale_cell_matrix | ( | MatrixVector & | cell_matrices | ) |
Function scales cell_matrix, typically called in cell_matrix().
Call at then end of function.
void FuelCell::Scaling::scale_cell_residual | ( | FEVector & | cell_res | ) |
Function scales cell_residual, typically called in cell_residual().
Call at then end of function.
|
private |
Bool to determine if user wants scalin to occur as based on parameter file.
This way you can check bool before calling scaling functions to prevent wasted time running scaling functions.
Referenced by get_apply_scaling_bool().
|
private |
Map of the FuelCell::SystemManagement EquationNames (LHS) and their respective scaling factor.
|
private |
Pointer to the external YourApplication<dim>::system_management object.