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

This class is used to include routines that are used in the solve() routine of several applications such as AppCathode and AppPemfc. More...

#include <solver_utils.h>

Public Member Functions

 SolverUtils ()
 Constructor.
 
void check_diagonal (const BlockSparseMatrix< double > &A) const
 Check that the diagonal of the matrix does not have any zeros.
 
void output_diagonal (const BlockSparseMatrix< double > &A) const
 Output diagonal elements of the stiffness matrix to the screen.
 
void print_diagonal (const BlockSparseMatrix< double > &A, const std::string &file=std::string("diag_matrix.dat")) const
 Print the diagonal elements of a matrix to a file named diag_matrix.dat.
 
void repair_diagonal (BlockSparseMatrix< double > &A)
 This member function is used to make sure that the BlockSpareMatrix has no zeros in the diagonal.
 
void repair_diagonal (BlockSparseMatrix< double > &A, AppFrame::FEVector &, const AppFrame::FEVector &)
 This member function is used to make sure that the BlockSpareMatrix has no zeros in the diagonal.
 

Detailed Description

This class is used to include routines that are used in the solve() routine of several applications such as AppCathode and AppPemfc.

Author
Marc Secanell, 2008

Constructor & Destructor Documentation

SolverUtils::SolverUtils ( )

Constructor.

Member Function Documentation

void SolverUtils::check_diagonal ( const BlockSparseMatrix< double > &  A) const

Check that the diagonal of the matrix does not have any zeros.

If it does, the code issues a warning on optimized mode or throws an exception on debug mode

void SolverUtils::output_diagonal ( const BlockSparseMatrix< double > &  A) const

Output diagonal elements of the stiffness matrix to the screen.

void SolverUtils::print_diagonal ( const BlockSparseMatrix< double > &  A,
const std::string &  file = std::string("diag_matrix.dat") 
) const

Print the diagonal elements of a matrix to a file named diag_matrix.dat.

void SolverUtils::repair_diagonal ( BlockSparseMatrix< double > &  A)

This member function is used to make sure that the BlockSpareMatrix has no zeros in the diagonal.

If it has zeros, then, the diagonal is filled with the average value between the largest and the smallest number in the diagonal.

In most problems you will need to use this class to remove zeros in the diagonal for the equations that are not physical in certain domains. For example, when solving the catalyst layer, the membrane potential inside the GDL is NOT a physical quantity. Instead of adding a small number during assembly which would affect the solution, we add zeros. Then, we modify the diagonal matrix so that the value is zero everywhere on that domain and the fluxes at the boundaries between domains are not accounted for.

Referenced by FuelCell::InitialAndBoundaryData::apply_zero_boundary_values_to_linear_system().

Here is the caller graph for this function:

void SolverUtils::repair_diagonal ( BlockSparseMatrix< double > &  A,
AppFrame::FEVector ,
const AppFrame::FEVector  
)

This member function is used to make sure that the BlockSpareMatrix has no zeros in the diagonal.

If it has zeros, then we rewrite the equation so that we ensure the solution at that node has a value of zero. This is done by passing the solution vector to the function and setting the RHS to this value. The zero in the system matrix is set to 1, so that we have \( 1(-\delta u) = \delta u \)


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