OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
newton_w_3pp.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_w_3pp.h
11 // - Description: Base class for all variants of the Newton-Raphson solver
12 // - Developers: Jason Boisvert and M. Secanell
13 //
14 //---------------------------------------------------------------------------
15 
16 #ifndef __deal2__appframe__newton_w_3pp_h
17 #define __deal2__appframe__newton_w_3pp_h
18 
19 #include <solvers/newton_base.h>
20 
21 namespace FuelCell
22 {
23 namespace ApplicationCore
24 {
144  class Newton3pp : public newtonBase
145  {
146  public:
147 
149 
154 
164  void declare_parameters(ParameterHandler& param);
165 
169  void initialize(ParameterHandler& param);
170 
179  const FuelCell::ApplicationCore::FEVectors& in_vectors);
180 
181  private:
186  {
187  // Depends in which refinement
188  const double* ref = get_data()->scalar("Refinement");
189  //FcstUtilities::log << "Ref: "<< *ref <<"\n";
190  if (*ref == 0)
191  {
192  max_reduction_factor = 0.90;
193  min_reduction_factor = 0.01;
194  alpha=0.01;
195  }
196  else
197  {
198  max_reduction_factor = 0.90;
199  min_reduction_factor = 0.50;
200  alpha=0.001;
201  }
202  }
203 
207  double sum_of_squares(double residual_norm);
208 
212  double three_point_step (int line_search_iterations,double lambda_current, double lambda_previous, double mf_original, double mf_current, double mf_previous);
213 
217  bool armijo(double step_length,double residual_norm,double new_residual_norm);
218 
255  double alpha;
256 
262 
267  };
268 }
269 }
270 
271 #endif
double alpha
This parameter is used in order to assess when the line search should be stopped. ...
Definition: newton_w_3pp.h:255
bool armijo(double step_length, double residual_norm, double new_residual_norm)
Determines step size by three point parabolic function.
double sum_of_squares(double residual_norm)
Sum of squares.
double min_reduction_factor
min_reduction_factor corresponds to
Definition: newton_w_3pp.h:242
void initialize(ParameterHandler &param)
Initialize NewtonBase and any additional parameters.
bool use_predefined
Flag so that predefined parameters are used.
Definition: newton_w_3pp.h:266
bool with_prediction
Boolean variable that specifies if the three-point method is used with (true) or without (false) pred...
Definition: newton_w_3pp.h:261
void set_predefined_parameters()
Define default parameters for convergence.
Definition: newton_w_3pp.h:185
double max_reduction_factor
Convergance criterion.
Definition: newton_w_3pp.h:238
static const FuelCell::ApplicationCore::Event bad_derivative
Definition: newton_w_3pp.h:148
boost::shared_ptr< ApplicationData > get_data()
Get access to the protected variable data.
void declare_parameters(ParameterHandler &param)
Declare any additional parameters necessary for the solver.
SmartPointer< ApplicationBase > app
Pointer to the application this one depends upon.
Definition: application_wrapper.h:106
Application class performing Newton&#39;s iteration.
Definition: newton_w_3pp.h:144
Base class for applications.
Definition: application_base.h:113
Base class for all classes performing Newton&#39;s iteration.
Definition: newton_base.h:156
virtual void solve(FuelCell::ApplicationCore::FEVector &u, const FuelCell::ApplicationCore::FEVectors &in_vectors)
The actual Newton solver.
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
double three_point_step(int line_search_iterations, double lambda_current, double lambda_previous, double mf_original, double mf_current, double mf_previous)
Merit Function.
Newton3pp(ApplicationBase &app)
Constructor.