OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
app_thermal_test.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2013 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: app_thermal_test.h 21-05-2013
11 // - Description: Class designed to test thermal transport equation.
12 // - Developers: Madhur Bhaiya
13 // - Id: $Id: app_thermal_test.h 2605 2014-08-15 03:36:44Z secanell $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef _FUELCELL__APP_THERMAL_TEST__H
18 #define _FUELCELL__APP_THERMAL_TEST__H
19 
20 // Include deal.II classes
21 #include "base/parameter_handler.h"
22 #include "base/function_lib.h"
23 #include "base/function.h"
24 #include "base/quadrature_lib.h"
25 
26 #include "lac/block_vector.h"
27 #include "lac/full_matrix.h"
28 #include "lac/solver_cg.h"
29 #include "lac/solver_gmres.h"
30 #include "lac/precondition.h"
31 #include "lac/precondition_block.h"
32 #include "lac/block_matrix_array.h"
33 #include "lac/sparse_ilu.h"
34 #include "lac/sparse_direct.h"
35 
36 #include "grid/grid_generator.h"
37 #include "grid/tria_accessor.h"
38 #include "grid/tria_iterator.h"
39 #include "grid/tria_boundary_lib.h"
40 
41 #include "fe/fe_values.h"
42 
43 #include "numerics/vector_tools.h"
44 #include "numerics/matrix_tools.h"
45 #include "numerics/error_estimator.h"
46 
47 #include "boost/shared_ptr.hpp"
48 
49 // Include FuelCell classes
50 #include "fcst_constants.h"
52 #include "solver_utils.h"
53 #include "linear_solvers.h"
54 
55 #include "geometries.h"
56 
57 #include "gas_diffusion_layer.h"
58 
59 // Equation Classes
61 
62 //Include STL
63 #include <fstream>
64 #include <iostream>
65 #include <sstream>
66 #include <cmath>
67 #include <vector>
68 #include <algorithm>
69 
70 
71 namespace FuelCell
72 {
73  namespace InitialSolution
74  {
80  template <int dim>
82  :
83  public Function<dim>
84  {
85  public:
89  AppThermalTestIC (const std::string& type);
93  virtual ~AppThermalTestIC (){};
94 
99  virtual double value (const Point<dim> &p,
100  const unsigned int component = 0) const;
101 
102  private:
103 
104  std::string case_type;
105  };
106  } //end namespace InitialSolution
107 
108 
109  namespace Application
110  {
111  //---------------------------------------------------------------------------
112  //---------------------------------------------------------------------------
113  //---------------------------------------------------------------------------
121  template <int dim>
123  :
125  {
126  public:
127 
129 
130 
137  AppThermalTest (boost::shared_ptr<FuelCell::ApplicationCore::ApplicationData> data = boost::shared_ptr<FuelCell::ApplicationCore::ApplicationData> ());
138 
142  virtual ~AppThermalTest (){};
149  virtual void declare_parameters(ParameterHandler& param);
150 
157  virtual void set_parameters(const std::vector<std::string>& name_dvar,
158  const std::vector<double>& value_dvar,
159  ParameterHandler& param){};
160 
165  void initialize_triangulation(ParameterHandler& param);
166 
170  virtual void initialize(ParameterHandler& param);
171 
175  virtual void initialize_solution (FuelCell::ApplicationCore::FEVector& initial_guess,
176  std::shared_ptr<Function<dim> > initial_function = std::shared_ptr<Function<dim> >());
178 
180 
181 
187  virtual void cell_matrix(FuelCell::ApplicationCore::MatrixVector& cell_matrices,
188  const typename DoFApplication<dim>::CellInfo& cell);
198  virtual void cell_residual(FuelCell::ApplicationCore::FEVector& cell_vector,
199  const typename DoFApplication<dim>::CellInfo& cell);
200 
204  virtual void bdry_matrix(FuelCell::ApplicationCore::MatrixVector& bdry_matrices,
205  const typename DoFApplication<dim>::FaceInfo& bdry_info);
206 
210  virtual void bdry_residual(FuelCell::ApplicationCore::FEVector& bdry_vector,
211  const typename DoFApplication<dim>::FaceInfo& bdry_info);
213 
220  virtual void dirichlet_bc(std::map<unsigned int, double>& boundary_values) const;
221 
225  virtual double estimate(const FuelCell::ApplicationCore::FEVectors& sol);
226 
227 
232  virtual void data_out(const std::string& basename,
233  const FuelCell::ApplicationCore::FEVectors& vectors);
234 
238  virtual void cell_responses (std::vector<double>& resp,
239  const typename DoFApplication<dim>::CellInfo& info,
245  virtual void global_responses (std::vector<double>& resp,
247 
248 
249  protected:
250 
251 
253 
254  boost::shared_ptr< FuelCellShop::Layer::GasDiffusionLayer<dim> > test_layer;
256 
258 
259 
264 
266  std::string case_type;
267 
268 
269  };
270  }
271 }
272 
273 #endif //_FUELCELL__AppThermalTest_H
virtual void set_parameters(const std::vector< std::string > &name_dvar, const std::vector< double > &value_dvar, ParameterHandler &param)
Function called by optimization loop in order to set the values in the ParameterHandler to the new de...
Definition: app_thermal_test.h:157
virtual void bdry_residual(FuelCell::ApplicationCore::FEVector &bdry_vector, const typename DoFApplication< dim >::FaceInfo &bdry_info)
Assemble local boundary residual.
virtual void data_out(const std::string &basename, const FuelCell::ApplicationCore::FEVectors &vectors)
Reimplementation of the routine in the base class BaseApplication in namespace AppFrame so that the r...
boost::shared_ptr< FuelCellShop::Layer::GasDiffusionLayer< dim > > test_layer
Definition: app_thermal_test.h:254
virtual void cell_residual(FuelCell::ApplicationCore::FEVector &cell_vector, const typename DoFApplication< dim >::CellInfo &cell)
Integration of the rhs of the equations.
virtual void initialize_solution(FuelCell::ApplicationCore::FEVector &initial_guess, std::shared_ptr< Function< dim > > initial_function=std::shared_ptr< Function< dim > >())
Initialize nonlinear solution.
This class is used when solving the problem using Newton&#39;s method to provide an initial solution...
Definition: app_thermal_test.h:81
virtual void declare_parameters(ParameterHandler &param)
Declare all parameters that are needed for:
virtual double estimate(const FuelCell::ApplicationCore::FEVectors &sol)
Estimate error per cell.
This class deals with Thermal Transport Equation.
Definition: thermal_transport_equation.h:190
AppThermalTest(boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data=boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData >())
Constructor.
virtual void initialize(ParameterHandler &param)
Call the other initialize routines from the inherited classes.
virtual double value(const Point< dim > &p, const unsigned int component=0) const
This is the member function that computes the value of the initial solution for a given point...
This class is created for the objects handed to the mesh loops.
Definition: mesh_loop_info_objects.h:625
std::string case_type
Definition: app_thermal_test.h:104
virtual ~AppThermalTestIC()
Destructor.
Definition: app_thermal_test.h:93
virtual ~AppThermalTest()
Destructor.
Definition: app_thermal_test.h:142
AppThermalTestIC(const std::string &type)
Constructor.
std::vector< MatrixBlock< FullMatrix< double > > > MatrixVector
The matrix vector used in the mesh loops.
Definition: matrix_block.h:102
std::map< unsigned int, double > boundary_values
Variable to store boundary values, so they only need to be computed once per mesh refinement...
Definition: block_matrix_application.h:324
std::string case_type
String to determine the case type.
Definition: app_thermal_test.h:266
This class is used to test thermal transport equation (fourier equation) against analytical solutions...
Definition: app_thermal_test.h:122
virtual void global_responses(std::vector< double > &resp, const FuelCell::ApplicationCore::FEVector &sol)
This class is used to evaluate all responses that do not require looping over cells.
Definition: app_thermal_test.h:245
virtual void bdry_matrix(FuelCell::ApplicationCore::MatrixVector &bdry_matrices, const typename DoFApplication< dim >::FaceInfo &bdry_info)
Assemble local boundary matrix.
virtual void dirichlet_bc(std::map< unsigned int, double > &boundary_values) const
Member function used to set dirichlet boundary conditions.
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
virtual void cell_responses(std::vector< double > &resp, const typename DoFApplication< dim >::CellInfo &info, const FuelCell::ApplicationCore::FEVector &sol)
Compute the value of all objective function and constraints.
Definition: app_thermal_test.h:238
Application handling matrices and assembling the linear system to solve the sensitivity equations...
Definition: optimization_block_matrix_application.h:62
virtual void cell_matrix(FuelCell::ApplicationCore::MatrixVector &cell_matrices, const typename DoFApplication< dim >::CellInfo &cell)
Integration of local bilinear form.
FuelCellShop::Equation::ThermalTransportEquation< dim > thermal_transport
ThermalTransportEquation object.
Definition: app_thermal_test.h:262
boost::shared_ptr< ApplicationData > data
Object for auxiliary data.
Definition: application_base.h:342
void initialize_triangulation(ParameterHandler &param)
Initilize and create the grid Determines whether reading from a grid file or creating new...