OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scaling.h
Go to the documentation of this file.
1 // ------------------------------------------------------------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2006-2016 by Energy Systems Design Laboratory, University of Alberta
6 //
7 // This software is distributed under the MIT license
8 // For more information, see the README file in /doc/LICENSE
9 //
10 // - Class: scaling.h
11 // - Description: This class allows scaling of any of the vector valued equations by a constant to help with
12 // stability of finding a solution.
13 //
14 // - Developers: Chad Balen, University of Alberta
15 //
16 // ------------------------------------------------------------------------------------------------------------------------------
17 
18 #ifndef _FUELCELL_SCALING__H
19 #define _FUELCELL_SCALING__H
20 
21 //OpenFCST required header files:
23 #include <utils/fcst_utilities.h> // For converting string to map in initialize()
24 
25 namespace FuelCell
26 {
27 
99  class Scaling
100  {
101  public:
106 
110  ~Scaling();
111 
127  void declare_parameters (ParameterHandler &param) const;
128 
133  void initialize (ParameterHandler& param);
134 
138  const bool get_apply_scaling_bool() const
139  {
140  return applyScaling;
141  }
142 
146  void scale_cell_matrix(MatrixVector& cell_matrices);
147 
151  void scale_cell_residual(FEVector& cell_res);
152 
164  void scale_bdry_matrix(MatrixVector& local_bdry_matrices, MatrixVector& bdry_matrices);
165 
178  void scale_bdry_residual(FEVector& local_bdry_res, FEVector& bdry_res);
179 
184  void create_local_bdry_matrix(MatrixVector& local_bdry_matrices, MatrixVector& bdry_matrices);
185 
186  private:
191 
195  bool applyScaling = false;
196 
200  std::map<std::string, double> ScalingMap;
201 
202  };
203 
204 }
205 
206 #endif // _FUELCELL_SCALING__H
void scale_cell_matrix(MatrixVector &cell_matrices)
Function scales cell_matrix, typically called in cell_matrix().
~Scaling()
Destructor.
std::map< std::string, double > ScalingMap
Map of the FuelCell::SystemManagement EquationNames (LHS) and their respective scaling factor...
Definition: scaling.h:200
FuelCell::SystemManagement * system_management
Pointer to the external YourApplication&lt;dim&gt;::system_management object.
Definition: scaling.h:190
void initialize(ParameterHandler &param)
Class used to read in data and initialize the necessary data to compute the coefficients.
std::vector< MatrixBlock< FullMatrix< double > > > MatrixVector
The matrix vector used in the mesh loops.
Definition: matrix_block.h:102
Scaling(FuelCell::SystemManagement &system_management)
Constructor.
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...
IMPORTANT: Add all new solution variables and equations here !
Definition: system_management.h:300
const bool get_apply_scaling_bool() const
Function to return applyScaling bool.
Definition: scaling.h:138
void scale_bdry_residual(FEVector &local_bdry_res, FEVector &bdry_res)
Function scales bdry_residual, typically called in bdry_residual().
Class used to store, read from file and define scaling factors to be applied to equations in equation...
Definition: scaling.h:99
BlockVector< double > FEVector
The vector class used by applications.
Definition: application_data.h:46
void scale_bdry_matrix(MatrixVector &local_bdry_matrices, MatrixVector &bdry_matrices)
Function scales bdry_matrix, typically called in bdry_matrix().
void declare_parameters(ParameterHandler &param) const
Declare all necessary parameters in order to compute the coefficients.
bool applyScaling
Bool to determine if user wants scalin to occur as based on parameter file.
Definition: scaling.h:195
void scale_cell_residual(FEVector &cell_res)
Function scales cell_residual, typically called in cell_residual().