OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
equation_base.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2006-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: equation_base.h
11 // - Description: This is a base class for all available FCST equations
12 // - Developers: Valentin N. Zingan, University of Alberta
13 // Marc Secanell Gallart, University of Alberta
14 // - Id: $Id: equation_base.h 1384 2013-08-22 21:40:07Z zingan $
15 //
16 // ----------------------------------------------------------------------------
17 
18 #ifndef _FCST_FUELCELLSHOP_EQUATION_EQUATION_BASE_H_
19 #define _FCST_FUELCELLSHOP_EQUATION_EQUATION_BASE_H_
20 
21 #include "system_management.h"
23 #include "base_layer.h"
24 #include "fem_extras.h"
25 #include "fcst_utilities.h"
26 #include "fcst_constants.h"
27 
28 using namespace dealii;
29 using namespace AppFrame;
30 
31 namespace FuelCellShop
32 {
33 namespace Equation
34 {
35 
37 
38 
62  struct BoundaryType
63  {
67  std::string boundary_name;
68 
72  unsigned int boundary_id;
73 
77  std::string boundary_condition;
78  };
79 
87  struct OutputType
88  {
92  std::string variable_name;
93 
104  };
105 
106  // ############################################################################################## Bhaiya #######
107 
122  {
126  unsigned int solution_index;
127 
131  unsigned int block_index;
132 
137  unsigned int fetype_index;
138 
145  };
146 
147  // ############################################################################################## Bhaiya #######
148 
150 
152 
153 
154  // ############################################################################################## Bhaiya #######
155 
160  DeclException2(VariableShouldExistForEquation,
161  std::string,
162  std::string,
163  << "The user-defined variable with name \"" << arg1 << "\" should be one of the solution variables for equation with name \"" << arg2 << "\"");
164 
170  DeclException2(IndexDoNotMatch,
171  std::string,
172  std::string,
173  << "The index of variable \"" << arg1 << "\" do not match with the index of equation \"" << arg2 << "\"");
174 
175  // ############################################################################################## Bhaiya #######
176 
178 
198 template<int dim>
199 class EquationBase : public Subscriptor
200 {
201 public:
202 
204 
205 
209  virtual void assemble_cell_matrix(AppFrame::MatrixVector& cell_matrices,
210  const typename AppFrame::DoFApplication<dim>::CellInfo& cell_info,
212  {
213  print_caller_name(__FUNCTION__);
214  }
215 
219  virtual void assemble_cell_residual(AppFrame::FEVector& cell_residual,
220  const typename AppFrame::DoFApplication<dim>::CellInfo& cell_info,
222  {
223  print_caller_name(__FUNCTION__);
224  }
225 
229  virtual void assemble_bdry_matrix(AppFrame::MatrixVector& bdry_matrices,
230  const typename AppFrame::DoFApplication<dim>::FaceInfo& bdry_info,
232  {
233  print_caller_name(__FUNCTION__);
234  }
235 
239  virtual void assemble_bdry_residual(AppFrame::FEVector& bdry_residual,
240  const typename AppFrame::DoFApplication<dim>::FaceInfo& bdry_info,
242  {
243  print_caller_name(__FUNCTION__);
244  }
245 
247 
249 
250 
256  const couplings_map& get_internal_cell_couplings() const
257  {
258  AssertThrow( !internal_cell_couplings.empty() , ExcInternalError() );
259  return internal_cell_couplings;
260  }
261 
267  const couplings_map& get_internal_flux_couplings() const
268  {
269  AssertThrow( !internal_flux_couplings.empty() , ExcInternalError() );
270  return internal_flux_couplings;
271  }
272 
278  const component_materialID_value_map& get_component_materialID_value() const
279  {
280  AssertThrow( !component_materialID_value.empty() , ExcInternalError() );
281  return component_materialID_value;
282  }
283 
289  const component_boundaryID_value_map& get_component_boundaryID_value() const
290  {
291  AssertThrow( !component_boundaryID_value.empty() , ExcInternalError() );
292  return component_boundaryID_value;
293  }
294 
300  const std::vector< BoundaryType >& get_boundary_types() const
301  {
302  return boundary_types;
303  }
304 
310  const std::vector< std::vector< BoundaryType > >& get_multi_boundary_types() const
311  {
312  return multi_boundary_types;
313  }
314 
320  const std::vector< OutputType >& get_output_types() const
321  {
322  return output_types;
323  }
324 
330  const std::vector< std::vector< OutputType > >& get_multi_output_types() const
331  {
332  return multi_output_types;
333  }
334 
340  const std::string& get_equation_name() const
341  {
342  return equation_name;
343  }
344 
350  const std::vector<unsigned int>& get_matrix_block_indices() const
351  {
352  return matrix_block_indices;
353  }
354 
360  const std::vector<unsigned int>& get_residual_indices() const
361  {
362  return residual_indices;
363  }
364 
370  virtual void print_equation_info() const
371  {
372  print_caller_name(__FUNCTION__);
373  }
374 
376 
377 protected:
378 
380 
381 
385  EquationBase(FuelCell::SystemManagement& system_management);
386 
390  virtual ~EquationBase();
391 
395  virtual void declare_parameters(ParameterHandler& param) const
396  {
397  print_caller_name(__FUNCTION__);
398  }
399 
403  virtual void initialize(ParameterHandler& param)
404  {
405  print_caller_name(__FUNCTION__);
406  }
407 
409 
411 
412 
417  virtual void make_assemblers_generic_constant_data()
418  {
419  print_caller_name(__FUNCTION__);
420  }
421 
426  virtual void make_assemblers_cell_constant_data(const typename AppFrame::DoFApplication<dim>::CellInfo& cell_info)
427  {
428  print_caller_name(__FUNCTION__);
429  }
430 
435  virtual void make_assemblers_bdry_constant_data(const typename AppFrame::DoFApplication<dim>::FaceInfo& bdry_info)
436  {
437  print_caller_name(__FUNCTION__);
438  }
439 
444  virtual void make_assemblers_cell_variable_data(const typename AppFrame::DoFApplication<dim>::CellInfo& cell_info,
446  {
447  print_caller_name(__FUNCTION__);
448  }
449 
454  virtual void make_assemblers_bdry_variable_data(const typename AppFrame::DoFApplication<dim>::FaceInfo& bdry_info,
456  {
457  print_caller_name(__FUNCTION__);
458  }
459 
461 
463 
464 
470  virtual void make_internal_cell_couplings()
471  {
472  print_caller_name(__FUNCTION__);
473  }
474 
480  virtual void make_internal_flux_couplings()
481  {
482  print_caller_name(__FUNCTION__);
483  }
484 
490  virtual void make_component_materialID_value()
491  {
492  print_caller_name(__FUNCTION__);
493  }
494 
500  virtual void make_component_boundaryID_value()
501  {
502  print_caller_name(__FUNCTION__);
503  }
504 
510  virtual void make_boundary_types()
511  {
512  print_caller_name(__FUNCTION__);
513  }
514 
520  virtual void make_multi_boundary_types()
521  {
522  print_caller_name(__FUNCTION__);
523  }
524 
530  virtual void make_output_types()
531  {
532  print_caller_name(__FUNCTION__);
533  }
534 
540  virtual void make_multi_output_types()
541  {
542  print_caller_name(__FUNCTION__);
543  }
544 
550  virtual void make_matrix_block_indices()
551  {
552  print_caller_name(__FUNCTION__);
553  }
554 
560  virtual void make_residual_indices()
561  {
562  print_caller_name(__FUNCTION__);
563  }
564 
566 
568 
569 
575  void standard_to_block_wise(FullMatrix<double>& target) const;
576 
582  void standard_to_block_wise(Vector<double>& target) const;
583 
597  void dealII_to_appframe(AppFrame::MatrixVector& dst,
598  const FullMatrix<double>& src,
599  const std::vector<unsigned int>& matrix_block_indices) const;
600 
614  void dealII_to_appframe(AppFrame::FEVector& dst,
615  const Vector<double>& src,
616  const std::vector<unsigned int>& residual_indices) const;
617 
619 
621 
622 
629  bool belongs_to_boundary(const unsigned int& tria_boundary_id,
630  const unsigned int& param_boundary_id) const
631  {
632  return tria_boundary_id == param_boundary_id;
633  }
634 
636 
638 
639 
646  void print_caller_name(const std::string& caller_name) const;
647 
649 
651  // DATA //
653 
655 
656 
661  unsigned int dofs_per_cell;
662 
664 
666 
667 
672  unsigned int n_q_points_cell;
673 
675 
677 
678 
683  unsigned int n_q_points_bdry;
684 
686 
688 
689 
694 
699 
701 
703 
704 
711 
713 
714 
721 
723 
724 
729  std::vector<double> JxW_cell;
730 
732 
734 
735 
742 
744 
745 
752 
754 
755 
760  std::vector<double> JxW_bdry;
761 
766  std::vector< Point<dim> > normal_vectors;
767 
772  std::vector< std::vector< Point<dim> > > tangential_vectors;
773 
775 
777 
778 
784 
791 
798 
808 
818 
824  std::vector< BoundaryType > boundary_types;
825 
831  std::vector< std::vector< BoundaryType > > multi_boundary_types;
832 
838  std::vector< OutputType > output_types;
839 
845  std::vector< std::vector< OutputType > > multi_output_types;
846 
851  std::string equation_name;
852 
858  std::vector<unsigned int> matrix_block_indices;
859 
865  std::vector<unsigned int> residual_indices;
866 
872  std::vector<bool> counter;
873 
875 
876 };
877 
878 } // Equation
879 
880 } // FuelCellShop
881 
882 #endif