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
BatchRHO
:
public
SettingsRHO
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: rho\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
for
(
unsigned
int
r = 5; r < 9; r++) {
51
table_PHI.add_value(
"r"
, r);
52
table_PHI.add_value(
"p"
, p);
53
54
if
(
SettingsRHO::print_time_tables
)
55
std::cout <<
"Time table PHI \n"
;
56
57
SolverRHO<DIMENSION__>
problem(p,
58
2,
59
r,
60
dir +
"solution_p"
+ std::to_string(p) +
61
"_r"
+ std::to_string(r));
62
table_PHI.add_value(
"ndofs"
, problem.
get_n_dofs
());
63
table_PHI.add_value(
"ncells"
, problem.
get_n_cells
());
64
table_PHI.add_value(
"L2"
, problem.
get_L2_norm
());
65
table_PHI.add_value(
"H1"
, problem.
get_H1_norm
());
66
}
67
table_PHI.
save
(dir +
"table_PHI_p"
+ std::to_string(p));
68
}
69
}
70
};
71
72
int
73
main()
74
{
75
try
{
76
BatchRHO
batch;
77
batch.run();
78
}
catch
(std::exception& exc) {
79
std::cerr << std::endl
80
<< std::endl
81
<<
"----------------------------------------------------"
82
<< std::endl;
83
std::cerr <<
"Exception on processing: "
<< std::endl
84
<< exc.what() << std::endl
85
<<
"Aborting!"
<< std::endl
86
<<
"----------------------------------------------------"
87
<< std::endl;
88
return
1;
89
}
catch
(...) {
90
std::cerr << std::endl
91
<< std::endl
92
<<
"----------------------------------------------------"
93
<< std::endl;
94
std::cerr <<
"Unknown exception!"
<< std::endl
95
<<
"Aborting!"
<< std::endl
96
<<
"----------------------------------------------------"
97
<< std::endl;
98
return
1;
99
}
100
101
return
0;
102
}
BatchRHO
This is a wrap-around class. It contains the main loop of the program that implements the Volume char...
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
SettingsRHO
Global settings for the Volume charge (rho/) numerical experiment.
Definition:
settings.hpp:25
SettingsRHO::print_time_tables
const bool print_time_tables
If set to true, the program will print time tables on the screen.
Definition:
settings.hpp:95
SolverRHO
Implements the Volume charge (rho/) 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::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
StaticScalarSolver::Solver::get_n_cells
unsigned int get_n_cells() const
Returns the number of active cells in the mesh.
Definition:
static_scalar_solver.hpp:505
static
rho
src
main.cpp
Generated by
1.9.1