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 
31 {
32 public:
33  void run()
34  {
35  if (nr_threads_max > 0)
36  MultithreadInfo::set_thread_limit(nr_threads_max);
37 
38  std::string dir =
39  (CYLINDER__ == 1) ? "Data/cylinder-axi/" : "Data/sphere-axi/";
40 
41  unsigned int mapping_degree = (CYLINDER__ == 1) ? 1 : 2;
42 
43  std::cout << "Program: sch-axi\n"
44  << "Mapping degree = " << mapping_degree << "\n"
45  << "Condition: Cylinder = " << CYLINDER__ << "\n"
46  << "Writing to: " << dir << "\n";
47 
48  MainOutputTable table_PHI(2);
49 
50  for (unsigned int p = 1; p < 4; p++) {
51  table_PHI.clear();
52  for (unsigned int r = 7; r < 11; r++) {
53  table_PHI.add_value("r", r);
54  table_PHI.add_value("p", p);
55 
56  SolverSCHAXI<static_cast<bool>(CYLINDER__)> problem(
57  p,
58  mapping_degree,
59  r,
60  dir + "solution_p" + std::to_string(p) + "_r" + std::to_string(r));
61  table_PHI.add_value("ndofs", problem.get_n_dofs());
62  table_PHI.add_value("ncells", problem.get_n_cells());
63  table_PHI.add_value("L2", problem.get_L2_norm());
64  table_PHI.add_value("H1", problem.get_H1_norm());
65  }
66  table_PHI.save(dir + "table_PHI_p" + std::to_string(p));
67  }
68  }
69 };
70 
71 int
72 main()
73 {
74  try {
75  BatchSCHAXI batch;
76  batch.run();
77  } catch (std::exception& exc) {
78  std::cerr << std::endl
79  << std::endl
80  << "----------------------------------------------------"
81  << std::endl;
82  std::cerr << "Exception on processing: " << std::endl
83  << exc.what() << std::endl
84  << "Aborting!" << std::endl
85  << "----------------------------------------------------"
86  << std::endl;
87  return 1;
88  } catch (...) {
89  std::cerr << std::endl
90  << std::endl
91  << "----------------------------------------------------"
92  << std::endl;
93  std::cerr << "Unknown exception!" << std::endl
94  << "Aborting!" << std::endl
95  << "----------------------------------------------------"
96  << std::endl;
97  return 1;
98  }
99 
100  return 0;
101 }
This is a wrap-around class. It contains the main loop of the program that implements the Axisymmetri...
Definition: main.cpp:31
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 Axisymmetric - surface charge (sch-axi/) numerical experiment.
Definition: settings.hpp:26
Implements the Axisymmetric - surface charge (sch-axi/) numerical experiment.
Definition: solver.hpp:41