OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
system_management.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: system_management.h
11 // - Description: This class manages systems of equations
12 // - Developers: Valentin N. Zingan, University of Alberta
13 // Marc Secanell Gallart, University of Alberta
14 // Madhur Bhaiya, University of Alberta
15 // - Id: $Id: system_management.h 1449 2013-08-30 21:18:58Z madhur $
16 //
17 // ----------------------------------------------------------------------------
18 
19 #ifndef _FCST_FUELCELL_SYSTEM_MANAGEMENT_H_
20 #define _FCST_FUELCELL_SYSTEM_MANAGEMENT_H_
21 
23 
24 using namespace dealii;
25 using namespace AppFrame;
26 
39 typedef std::map< std::string , std::map<std::string, DoFTools::Coupling> > couplings_map;
40 
64 {
65  nothing = 0,
66 
77 
83 
85 };
86 
87 namespace FuelCell
88 {
89 
128 class SystemManagement : public Subscriptor
129 {
130 public:
131 
133 
134 
142 
153  Table<2, DoFTools::Coupling>& cell_couplings,
154  Table<2, DoFTools::Coupling>& flux_couplings);
155 
159  ~SystemManagement();
160 
171  Table<2, DoFTools::Coupling>& rcell_couplings,
172  Table<2, DoFTools::Coupling>& rflux_couplings)
173  {
174  block_info = &rblock_info;
175  cell_couplings = &rcell_couplings;
176  flux_couplings = &rflux_couplings;
177  }
178 
182  void declare_parameters(ParameterHandler& param) const;
183 
187  void initialize(ParameterHandler& param);
188 
190 
192 
193 
200  const bool solution_in_userlist(const std::string& name) const;
201 
208  const unsigned int solution_name_to_index(const std::string& name) const;
209 
216  const unsigned int equation_name_to_index(const std::string& name) const;
217 
233  const unsigned int matrix_block_index(const std::string& equation_name,
234  const std::string& solution_name) const;
235 
243  void make_cell_couplings(const std::vector<couplings_map>& src);
244 
252  void make_flux_couplings(const std::vector<couplings_map>& src);
253 
255 
257 
258 
263  const std::vector<std::string>& get_all_solution_names() const
264  {
265  return all_solution_names;
266  }
267 
272  const std::vector<std::string>& get_all_equation_names() const
273  {
274  return all_equation_names;
275  }
276 
281  const std::vector<std::string>& get_solution_names() const
282  {
283  return solution_names;
284  }
285 
290  const std::vector<std::string>& get_equation_names() const
291  {
292  return equation_names;
293  }
294 
299  const unsigned int& get_number_of_solution_names() const
300  {
301  return n_solution_names;
302  }
303 
315  void print_system_info() const;
316 
318 
320 
321 
327  DeclException2(VariableNotFoundInFCSTVariables,
328  std::string,
329  std::string,
330  << "A " << arg1 << " with name \"" << arg2 << "\" is not stored in available FCST solution variables");
331 
337  DeclException2(EquationNotFoundInFCSTEquations,
338  std::string,
339  std::string,
340  << "An " << arg1 << " with name \"" << arg2 << "\" is not stored in available FCST equations");
341 
347  DeclException2(VariableNotFoundInUserVariables,
348  std::string,
349  std::string,
350  << "A " << arg1 << " with name \"" << arg2 << "\" is not stored in user defined solution variables");
351 
357  DeclException2(EquationNotFoundInUserEquations,
358  std::string,
359  std::string,
360  << "An " << arg1 << " with name \"" << arg2 << "\" is not stored in user defined equations");
361 
370  DeclException5(SystemMatrixBlockDoesNotExist,
371  std::string,
372  unsigned int,
373  unsigned int,
374  std::string,
375  std::string,
376  << "A " << arg1 << " (" << arg2 << "," << arg3 << ") " << "does not exist, because the variable \"" << arg4 << "\" is not coupled with the equation \"" << arg5 << "\"");
377 
379 
381  // DATA //
383 
385 
386 
393 
399  Table<2, DoFTools::Coupling>* cell_couplings;
400 
406  Table<2, DoFTools::Coupling>* flux_couplings;
407 
409 
410 protected:
411 
413 
414 
420  void set_all_solution_names();
421 
427  void set_all_equation_names();
428 
434  void check_solution_names() const;
435 
441  void check_equation_names() const;
442 
444 
446  // DATA //
448 
450 
451 
455  std::vector<std::string> all_solution_names;
456 
460  std::vector<std::string> all_equation_names;
461 
465  std::vector<std::string> solution_names;
466 
470  std::vector<std::string> equation_names;
471 
477  unsigned int n_solution_names;
478 
480 
481 };
482 
483 } // FuelCell
484 
485 #endif