Logbook  (07-04-2025)
Static problems
main.cpp
1 /******************************************************************************
2  * Copyright (C) Siarhei Uzunbajakau, 2023.
3  *
4  * This program is free software. You can use, modify, and redistribute it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation, either version 3 or (at your option) any later version.
7  * This program is distributed without any warranty.
8  *
9  * Refer to COPYING.LESSER for more details.
10  ******************************************************************************/
11 
12 #define BOOST_ALLOW_DEPRECATED_HEADERS
13 
14 #include "deal.II/base/multithread_info.h"
15 
16 #include <iostream>
17 #include <string>
18 
19 #include "misc.hpp"
20 #include "solver.hpp"
21 
22 using namespace Misc;
23 
29 class BatchSCH : public SettingsSCH
30 {
31 public:
32  void run()
33  {
34  if (nr_threads_max > 0)
35  MultithreadInfo::set_thread_limit(nr_threads_max);
36 
37  Assert(DIMENSION__ > 1, ExcInternalError());
38  Assert(DIMENSION__ < 4, ExcInternalError());
39 
40  std::string dir = (DIMENSION__ == 2) ? "Data/circle/" : "Data/sphere/";
41 
42  std::cout << "Program: sch\n"
43  << "Dimensions: " << DIMENSION__ << "\n"
44  << "Writing to: " << dir << "\n";
45 
46  MainOutputTable table_PHI(DIMENSION__);
47 
48  for (unsigned int p = 1; p < 4; p++) {
49  table_PHI.clear();
50 #if DIMENSION__ == 2
51  for (unsigned int r = 5; r < 9; r++)
52 #endif
53 #if DIMENSION__ == 3
54  for (unsigned int r = 5; r < 9; r++)
55 #endif
56  {
57  table_PHI.add_value("r", r);
58  table_PHI.add_value("p", p);
59 
61  std::cout << "Time table PHI \n";
62 
63  SolverSCH<DIMENSION__> problem(
64  p,
65  2,
66  r,
67  dir + "solution_p" + std::to_string(p) + "_r" + std::to_string(r));
68  table_PHI.add_value("ndofs", problem.get_n_dofs());
69  table_PHI.add_value("ncells", problem.get_n_cells());
70  table_PHI.add_value("L2", problem.get_L2_norm());
71  table_PHI.add_value("H1", problem.get_H1_norm());
72  }
73  table_PHI.save(dir + "table_PHI_p" + std::to_string(p));
74  }
75  }
76 };
77 
78 int
79 main()
80 {
81  try {
82  BatchSCH batch;
83  batch.run();
84  } catch (std::exception& exc) {
85  std::cerr << std::endl
86  << std::endl
87  << "----------------------------------------------------"
88  << std::endl;
89  std::cerr << "Exception on processing: " << std::endl
90  << exc.what() << std::endl
91  << "Aborting!" << std::endl
92  << "----------------------------------------------------"
93  << std::endl;
94  return 1;
95  } catch (...) {
96  std::cerr << std::endl
97  << std::endl
98  << "----------------------------------------------------"
99  << std::endl;
100  std::cerr << "Unknown exception!" << std::endl
101  << "Aborting!" << std::endl
102  << "----------------------------------------------------"
103  << std::endl;
104  return 1;
105  }
106 
107  return 0;
108 }
This is a wrap-around class. It contains the main loop of the program that implements the Surface cha...
Definition: main.cpp:30
The convergence table used in multiple numerical experiments.
Definition: misc.hpp:25
void save(std::string fname)
Saves the data in text and tex formats, and prints the data on screen.
Definition: misc.cpp:47
Global settings for the Surface charge (sch/) numerical experiment.
Definition: settings.hpp:25
const bool print_time_tables
If set to true, the program will print time tables on the screen.
Definition: settings.hpp:89
Implements the Surface charge (sch/) numerical experiment.
Definition: solver.hpp:40
double get_L2_norm() const
Returns error norm.
double get_H1_norm() const
Returns error norm.
unsigned int get_n_dofs() const
Returns the total amount of the degrees of freedom.
unsigned int get_n_cells() const
Returns the number of active cells in the mesh.