OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
FuelCell::Scaling Class Reference

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>

Collaboration diagram for FuelCell::Scaling:
Collaboration graph
[legend]

Public Member Functions

 Scaling (FuelCell::SystemManagement &system_management)
 Constructor. More...
 
 ~Scaling ()
 Destructor. More...
 
void declare_parameters (ParameterHandler &param) const
 Declare all necessary parameters in order to compute the coefficients. More...
 
void initialize (ParameterHandler &param)
 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::SystemManagementsystem_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...
 

Detailed Description

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:

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:

* subsection Equations
* (...)
* set Apply scaling = true # true | false
* set Equation matrix scaling = Kerkhof-Geboers Fluid Transport Equations - steady-state - compressible - isothermal - single-phase - multi-component - mass conservation - species 1:1.0e-4
* end
*

Usage Details:

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:

* #include "scaling.h"
*
* // Then in the data member declaration (usually a private member)
*

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:

* //--------- IN DECLARE_PARAMETERS ------------------------------------------------------
* template <int dim>
* void
* NAME::AppCathodeKG<dim>::declare_parameters(ParameterHandler& param)
* {
* (...)
* Scale.declare_parameters(param);
* (...)
* }
*

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()

* //--------- IN INITIALIZE ------------------------------------------------------
* template <int dim>
* void
* NAME::AppCathodeKG<dim>::initialize(ParameterHandler& param)
* {
* (...)
* Scale.initialize(param);
* bool applyScaling = Scale.get_apply_scaling_bool();
* }
*

You are now ready to use your Scaling object.

Author
C.Balen, 2009-2016

Constructor & Destructor Documentation

FuelCell::Scaling::Scaling ( FuelCell::SystemManagement system_management)

Constructor.

FuelCell::Scaling::~Scaling ( )

Destructor.

Member Function Documentation

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:

* subsection Fuel cell data
* (...)
* subsection Equations
* set Apply scaling = false
* set Equation matrix scaling = Electron Transport Equation:1e-4
* end
* end
*
const bool FuelCell::Scaling::get_apply_scaling_bool ( ) const
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.

void FuelCell::Scaling::scale_bdry_residual ( FEVector local_bdry_res,
FEVector bdry_res 
)

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.

Member Data Documentation

bool FuelCell::Scaling::applyScaling = false
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().

std::map<std::string, double> FuelCell::Scaling::ScalingMap
private

Map of the FuelCell::SystemManagement EquationNames (LHS) and their respective scaling factor.

FuelCell::SystemManagement* FuelCell::Scaling::system_management
private

Pointer to the external YourApplication<dim>::system_management object.


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