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 BatchPLS : public SettingsPLS
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/square/" : "Data/cube/";
41 
42  std::cout << "Program: pls\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 = 7; r < 11; 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 
60  SolverPLS<DIMENSION__> problem(
61  p,
62  r,
63  dir + "solution_p" + std::to_string(p) + "_r" + std::to_string(r));
64  table_PHI.add_value("ndofs", problem.get_n_dofs());
65  table_PHI.add_value("ncells", problem.get_n_cells());
66  table_PHI.add_value("L2", problem.get_L2_norm());
67  table_PHI.add_value("H1", problem.get_H1_norm());
68  }
69  table_PHI.save(dir + "table_PHI_p" + std::to_string(p));
70  }
71  }
72 };
73 
74 int
75 main()
76 {
77  try {
78  BatchPLS batch;
79  batch.run();
80  } catch (std::exception& exc) {
81  std::cerr << std::endl
82  << std::endl
83  << "----------------------------------------------------"
84  << std::endl;
85  std::cerr << "Exception on processing: " << std::endl
86  << exc.what() << std::endl
87  << "Aborting!" << std::endl
88  << "----------------------------------------------------"
89  << std::endl;
90  return 1;
91  } catch (...) {
92  std::cerr << std::endl
93  << std::endl
94  << "----------------------------------------------------"
95  << std::endl;
96  std::cerr << "Unknown exception!" << std::endl
97  << "Aborting!" << std::endl
98  << "----------------------------------------------------"
99  << std::endl;
100  return 1;
101  }
102  return 0;
103 }
This is a wrap-around class. It contains the main loop of the program that implements the Planes of s...
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 Planes of symmetry (pls/) numerical experiment.
Definition: settings.hpp:26
Implements the Planes of symmetry (pls/) numerical experiment.
Definition: solver.hpp:39
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.