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 // - $Id: newton_w_3pp.h 2605 2014-08-15 03:36:44Z secanell $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef __deal2__appframe__newton_w_3pp_h
18 #define __deal2__appframe__newton_w_3pp_h
19 
20 #include <newton_base.h>
21 
22 namespace FuelCell
23 {
24 namespace ApplicationCore
25 {
145  class Newton3pp : public newtonBase
146  {
147  public:
148 
150 
155 
165  void declare_parameters(ParameterHandler& param);
166 
170  void initialize(ParameterHandler& param);
171 
180  const FuelCell::ApplicationCore::FEVectors& in_vectors);
181 
182  private:
187  {
188  // Depends in which refinement
189  const double* ref = get_data()->scalar("Refinement");
190  //FcstUtilities::log << "Ref: "<< *ref <<"\n";
191  if (*ref == 0)
192  {
193  max_reduction_factor = 0.90;
194  min_reduction_factor = 0.01;
195  alpha=0.01;
196  }
197  else
198  {
199  max_reduction_factor = 0.90;
200  min_reduction_factor = 0.50;
201  alpha=0.001;
202  }
203  }
204 
208  double sum_of_squares(double residual_norm);
209 
213  double three_point_step (int line_search_iterations,double lambda_current, double lambda_previous, double mf_original, double mf_current, double mf_previous);
214 
218  bool armijo(double step_length,double residual_norm,double new_residual_norm);
219 
256  double alpha;
257 
263 
268  };
269 }
270 }
271 
272 #endif
double alpha
This parameter is used in order to assess when the line search should be stopped. ...
Definition: newton_w_3pp.h:256
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:243
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:267
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:262
void set_predefined_parameters()
Define default parameters for convergence.
Definition: newton_w_3pp.h:186
double max_reduction_factor
Convergance criterion.
Definition: newton_w_3pp.h:239
static const FuelCell::ApplicationCore::Event bad_derivative
Definition: newton_w_3pp.h:149
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:107
Application class performing Newton&#39;s iteration.
Definition: newton_w_3pp.h:145
Base class for applications.
Definition: application_base.h:114
Base class for all classes performing Newton&#39;s iteration.
Definition: newton_base.h:161
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: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
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.