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 BatchFLC : public SettingsFLC
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;
41 
42  dir = (DIMENSION__ == 2) ? "Data/ring/" : "Data/shell/";
43 
44  std::cout << "Program: flc\n"
45  << "Dimensions: " << DIMENSION__ << "\n"
46  << "Writing to: " << dir << "\n";
47 
48  MainOutputTable table(DIMENSION__);
49 
50  for (unsigned int p = 1; p < 4; p++) {
51  table.clear();
52 #if DIMENSION__ == 2
53  for (unsigned int r = 2; r < 6; r++)
54 #endif
55 #if DIMENSION__ == 3
56  for (unsigned int r = 3; r < 7; r++)
57 #endif
58  {
59  table.add_value("r", r);
60  table.add_value("p", p);
61 
62  SolverFLC<DIMENSION__> problem(
63  p,
64  2,
65  r,
66  dir + "solution_p" + std::to_string(p) + "_r" + std::to_string(r));
67  table.add_value("ndofs", problem.get_n_dofs());
68  table.add_value("ncells", problem.get_n_cells());
69  table.add_value("L2", problem.get_L2_norm());
70  table.add_value("H1", problem.get_H1_norm());
71  }
72  table.save(dir + "table_PHI_p" + std::to_string(p));
73  }
74  }
75 };
76 
77 int
78 main()
79 {
80  try {
81  BatchFLC batch;
82  batch.run();
83  } catch (std::exception& exc) {
84  std::cerr << std::endl
85  << std::endl
86  << "----------------------------------------------------"
87  << std::endl;
88  std::cerr << "Exception on processing: " << std::endl
89  << exc.what() << std::endl
90  << "Aborting!" << std::endl
91  << "----------------------------------------------------"
92  << std::endl;
93  return 1;
94  } catch (...) {
95  std::cerr << std::endl
96  << std::endl
97  << "----------------------------------------------------"
98  << std::endl;
99  std::cerr << "Unknown exception!" << std::endl
100  << "Aborting!" << std::endl
101  << "----------------------------------------------------"
102  << std::endl;
103  return 1;
104  }
105 
106  return 0;
107 }
This is a wrap-around class. It contains the main loop of the program that implements the Floating co...
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 Floating conductor (flc/) numerical experiment.
Definition: settings.hpp:25
Implements the solver of the Floating conductor (flc/) 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.