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
BatchCBND
:
public
SettingsCBND
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
#if DIMENSION__ == 2
43
dir = (IS_BC_EXACT__ == 1) ?
"Data/ring-exact/"
:
"Data/ring/"
;
44
#endif
45
46
#if DIMENSION__ == 3
47
dir = (IS_BC_EXACT__ == 1) ?
"Data/shell-exact/"
:
"Data/shell/"
;
48
#endif
49
50
std::cout <<
"Program: cbnd\n"
51
<<
"Dimensions: "
<< DIMENSION__ <<
"\n"
52
<<
"Condition: "
<< IS_BC_EXACT__ <<
"\n"
53
<<
"Writing to: "
<< dir <<
"\n"
;
54
55
MainOutputTable
table_PHI(DIMENSION__);
56
57
for
(
unsigned
int
p = 1; p < 4; p++) {
58
table_PHI.clear();
59
60
#if DIMENSION__ == 2
61
for
(
unsigned
int
r = 15; r < 19; r++)
62
#endif
63
#
if
DIMENSION__ == 3
64
for
(
unsigned
int
r = 9; r < 13; r++)
65
#endif
66
{
// Calculating potential
67
table_PHI.add_value(
"r"
, r);
68
table_PHI.add_value(
"p"
, p);
69
70
SolverCBND<DIMENSION__>
problem(p,
71
1,
// 2,
72
r,
73
dir +
"solution_PHI_p"
+
74
std::to_string(p) +
"_r"
+
75
std::to_string(r));
76
table_PHI.add_value(
"ndofs"
, problem.
get_n_dofs
());
77
table_PHI.add_value(
"ncells"
, problem.n_cells);
78
table_PHI.add_value(
"L2"
, problem.
get_L2_norm
());
79
table_PHI.add_value(
"H1"
, problem.
get_H1_norm
());
80
81
problem.
clear
();
82
}
83
// Saving convergence tables
84
std::cout <<
"Table PHI\n"
;
85
table_PHI.
save
(dir +
"table_PHI_p"
+ std::to_string(p));
86
}
87
}
88
};
89
90
int
91
main()
92
{
93
try
{
94
BatchCBND
batch;
95
batch.run();
96
}
catch
(std::exception& exc) {
97
std::cerr << std::endl
98
<< std::endl
99
<<
"----------------------------------------------------"
100
<< std::endl;
101
std::cerr <<
"Exception on processing: "
<< std::endl
102
<< exc.what() << std::endl
103
<<
"Aborting!"
<< std::endl
104
<<
"----------------------------------------------------"
105
<< std::endl;
106
return
1;
107
}
catch
(...) {
108
std::cerr << std::endl
109
<< std::endl
110
<<
"----------------------------------------------------"
111
<< std::endl;
112
std::cerr <<
"Unknown exception!"
<< std::endl
113
<<
"Aborting!"
<< std::endl
114
<<
"----------------------------------------------------"
115
<< std::endl;
116
return
1;
117
}
118
119
return
0;
120
}
BatchCBND
This is a wrap-around class. It contains the main loop of the program that implements the Effect of c...
Definition:
main.cpp:30
Misc::MainOutputTable
The convergence table used in multiple numerical experiments.
Definition:
misc.hpp:25
Misc::MainOutputTable::save
void save(std::string fname)
Saves the data in text and tex formats, and prints the data on screen.
Definition:
misc.cpp:47
SettingsCBND
Global settings for the Effect of curved boundaries (cbnd/) numerical experiment.
Definition:
settings.hpp:25
SolverCBND
Implements the solver of the Effect of curved boundaries (cbnd/) numerical experiment.
Definition:
solver.hpp:40
StaticScalarSolver::Solver::get_L2_norm
double get_L2_norm() const
Returns error norm.
Definition:
static_scalar_solver.hpp:550
StaticScalarSolver::Solver::clear
void clear()
Releases computer memory associated with the system matrix and right-hand side.
Definition:
static_scalar_solver.hpp:481
StaticScalarSolver::Solver::get_H1_norm
double get_H1_norm() const
Returns error norm.
Definition:
static_scalar_solver.hpp:555
StaticScalarSolver::Solver::get_n_dofs
unsigned int get_n_dofs() const
Returns the total amount of the degrees of freedom.
Definition:
static_scalar_solver.hpp:537
static
cbnd
src
main.cpp
Generated by
1.9.1