OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
newton_base.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2009-13 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: newton_base.h
11 // - Description: Base class for all variants of the Newton-Raphson solver
12 // - Developers: J. Boisvert, M. Secanell, V. Zingan
13 //
14 //---------------------------------------------------------------------------
15 
16 #ifndef __deal2__appframe__newton_base_h
17 #define __deal2__appframe__newton_base_h
18 
19 #include <deal.II/lac/solver_control.h>
20 
22 
23 using namespace dealii;
24 using namespace FuelCell::ApplicationCore;
25 
26 namespace FuelCell
27 {
28 namespace ApplicationCore
29 {
157  {
158  public:
171 
183  virtual void declare_parameters (ParameterHandler& param);
184 
188  virtual void initialize (ParameterHandler& param);
189 
193  void _initialize (ParameterHandler& param);
194 
199  double threshold(double new_value);
200 
204  void initialize_initial_guess(BlockVector<double>& dst){};
205 
211  virtual void assemble();
212 
221  virtual double residual(FuelCell::ApplicationCore::FEVector& dst,
223 
232  virtual void solve(FuelCell::ApplicationCore::FEVector& u,
233  const FuelCell::ApplicationCore::FEVectors& in_vectors) = 0;
234 
238  ReductionControl control;
239 
243  double numIter;
244 
245  protected:
250  void debug_output(const FEVector& sol,
251  const FEVector& update,
252  const FEVector& residual) const;
253 
260 
290  unsigned int debug;
294  unsigned int step;
295 
313  std::vector<unsigned int> blocks;
314 
318  unsigned int n_blocks;
319  };
320 }
321 }
322 
323 #endif
unsigned int debug
Write debug output to FcstUtilities::log; the higher the number, the more output. ...
Definition: newton_base.h:290
bool debug_update
Print Newton update after each step into file Newton_dNNN?
Definition: newton_base.h:280
void initialize_initial_guess(BlockVector< double > &dst)
Control object for the Newton iteration.
Definition: newton_base.h:204
bool debug_solution
Print updated solution after each step into file Newton_uNNN?
Definition: newton_base.h:275
static const FuelCell::ApplicationCore::Event bad_derivative
The Event set if convergence is becoming bad and a new matrix should be assembled.
Definition: newton_base.h:165
bool debug_residual
Print Newton residual after each step into file Newton_rNNN?
Definition: newton_base.h:285
bool assemble_now
This flag is set by the function assemble(), indicating that the matrix must be assembled anew upon s...
Definition: newton_base.h:259
double assemble_threshold
Threshold for re-assembling matrix.
Definition: newton_base.h:270
Base class for applications.
Definition: application_base.h:113
Base class for all classes performing Newton&#39;s iteration.
Definition: newton_base.h:156
This class implements either iterative or time-stepping wrapper of applications.
Definition: application_wrapper.h:39
ReductionControl control
Control object for the Newton iteration.
Definition: newton_base.h:238
Objects of this kind are used to notify interior applications of changes provoked by an outer loop...
Definition: event.h:51
BlockVector< double > FEVector
The vector class used by applications.
Definition: application_data.h:46
The data type used in function calls of Application.
Definition: fe_vectors.h:59
unsigned int step
The number of a basic Newton iteration.
Definition: newton_base.h:294
unsigned int n_blocks
The total number of blocks.
Definition: newton_base.h:318
double numIter
Number of Iterations;.
Definition: newton_base.h:243
std::vector< unsigned int > blocks
This vector specifies the blocks of the global solution which are supposed to be treated specially...
Definition: newton_base.h:313