OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
adaptive_refinement.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: adaptive_refinement.h
11 // - Description: Child of ApplicationCopy used to implement adaptive refinement
12 // - Developers: M. Secanell
13 // - $Id: adaptive_refinement.h 1389 2013-08-27 23:29:33Z zingan $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef _FUELCELL__ADAPTIVEREFINEMENT_H_
18 #define _FUELCELL__ADAPTIVEREFINEMENT_H_
19 
20 // Deal.II include files:
21 #include <base/parameter_handler.h>
22 #include <base/smartpointer.h>
23 #include <grid/tria.h>
24 
25 // Appframe include files:
26 #include <appframe/base.h>
27 #include <appframe/newton.h>
28 //#include <appframe/fe_vectors.h>
29 
30 // Fuel cell include files
32 
33 // STD include files
34 #include <string>
35 #include <stdio.h>
36 #include <stdlib.h>
37 
38 
39 namespace AppFrame
40 {
52 template <int dim>
54 {
55 public:
62 
67 
91  void declare_parameters ( ParameterHandler& param ) const;
92 
98  void set_parameters ( const std::vector<std::string>& name_dvar,
99  const std::vector<double>& value_dvar,
100  ParameterHandler& param );
105  void initialize ( ParameterHandler& param );
106 
110  void solve ( const std::string param_file, ParameterHandler& param );
111 
115  void test_derivatives ( const std::string input_file,
116  const std::string dvar,
117  const double value,
118  std::vector<double>& resp,
119  std::vector<std::vector<double> >& dresp,
120  const bool gradient = true );
121 
125  void print_parameters() const;
126 
130  void run_Newton();
131 
135  void run_Newton ( std::vector<double>& resp );
136 
140  void run_Newton ( std::vector<double>& resp, //std::vector<double> (),
141  std::vector<std::vector<double> >& dresp_dl ); //std::vector<std::vector<double> > (0, std::vector<double> ()));
142 
148  {
149  return solution;
150  }
151 
152 private:
160  std::string filename_initial_sol;
167 
169 
171 
177  unsigned int n_ref;
178 
180  bool gradients;
181 
184 
187 
193 };
194 }
195 
196 #endif