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: Jason Boisvert, M. Secanell, V. Zingan
13 // - $Id: newton_base.h 2605 2014-08-15 03:36:44Z secanell $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef __deal2__appframe__newton_base_h
18 #define __deal2__appframe__newton_base_h
19 
20 #include <lac/solver_control.h>
21 
22 #include "fe_vectors.h"
23 #include "application_data.h"
24 #include "event.h"
25 #include "application_base.h"
26 #include "application_wrapper.h"
27 
28 using namespace dealii;
29 using namespace FuelCell::ApplicationCore;
30 
31 namespace FuelCell
32 {
33 namespace ApplicationCore
34 {
162  {
163  public:
176 
188  virtual void declare_parameters (ParameterHandler& param);
189 
193  virtual void initialize (ParameterHandler& param);
194 
198  void _initialize (ParameterHandler& param);
199 
204  double threshold(double new_value);
205 
209  void initialize_initial_guess(BlockVector<double>& dst){};
210 
216  virtual void assemble();
217 
226  virtual double residual(FuelCell::ApplicationCore::FEVector& dst,
228 
237  virtual void solve(FuelCell::ApplicationCore::FEVector& u,
238  const FuelCell::ApplicationCore::FEVectors& in_vectors) = 0;
239 
243  ReductionControl control;
244 
248  double numIter;
249 
250  protected:
255  void debug_output(const FEVector& sol,
256  const FEVector& update,
257  const FEVector& residual) const;
258 
265 
295  unsigned int debug;
299  unsigned int step;
300 
318  std::vector<unsigned int> blocks;
319 
323  unsigned int n_blocks;
324  };
325 }
326 }
327 
328 #endif
unsigned int debug
Write debug output to FcstUtilities::log; the higher the number, the more output. ...
Definition: newton_base.h:295
bool debug_update
Print Newton update after each step into file Newton_dNNN?
Definition: newton_base.h:285
void initialize_initial_guess(BlockVector< double > &dst)
Control object for the Newton iteration.
Definition: newton_base.h:209
bool debug_solution
Print updated solution after each step into file Newton_uNNN?
Definition: newton_base.h:280
static const FuelCell::ApplicationCore::Event bad_derivative
The Event set by Jason if convergence is becoming bad and a new matrix should be assembled.
Definition: newton_base.h:170
bool debug_residual
Print Newton residual after each step into file Newton_rNNN?
Definition: newton_base.h:290
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:264
double assemble_threshold
Threshold for re-assembling matrix.
Definition: newton_base.h:275
Base class for applications.
Definition: application_base.h:114
Base class for all classes performing Newton&#39;s iteration.
Definition: newton_base.h:161
This class implements either iterative or time-stepping wrapper of applications.
Definition: application_wrapper.h:40
ReductionControl control
Control object for the Newton iteration.
Definition: newton_base.h:243
Objects of this kind are used to notify interior applications of changes provoked by an outer loop...
Definition: event.h:57
BlockVector< double > FEVector
The vector class used by applications.
Definition: application_data.h:39
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:299
unsigned int n_blocks
The total number of blocks.
Definition: newton_base.h:323
double numIter
Number of Iterations;.
Definition: newton_base.h:248
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:318