12 #define BOOST_ALLOW_DEPRECATED_HEADERS
18 SolverSSOLI::make_mesh()
23 std::ifstream ifs(
"../../gmsh/data/sphere_r" + std::to_string(r) +
".msh");
30 SolverSSOLI::fill_dirichlet_stack()
44 control.enable_history_data();
46 GrowingVectorMemory<Vector<double>> memory;
47 SolverCG<Vector<double>> cg(control, memory);
49 PreconditionSSOR<SparseMatrix<double>> preconditioner;
60 const std::vector<double> history_data = control.get_history_data();
62 std::ofstream ofs(fname +
"_cg_convergence.csv");
65 for (
auto item : history_data) {
66 ofs << i <<
", " << item <<
"\n";
74 SolverSSOLI::mark_materials()
79 for (
unsigned int f = 0; f < GeometryInfo<3>::faces_per_cell; ++f) {
81 double dif_norm = 0.0;
82 double dif_norm_a = 0.0;
84 for (
unsigned int v = 0; v < GeometryInfo<3>::vertices_per_face; v++) {
85 dif_norm_a += std::abs(cell->face(f)->vertex(v).norm() -
a);
86 dif_norm += std::abs(cell->face(f)->vertex(0).norm() -
87 cell->face(f)->vertex(v).norm());
90 if ((dif_norm <
eps) && (cell->center().norm() >
rd1))
91 cell->face(f)->set_all_manifold_ids(1);
94 if (std::abs(cell->center().norm()) <
a) {
95 cell->face(f)->set_user_index(1);
96 cell->set_user_index(1);
const double a
The radius of the coil.
const bool log_cg_convergence
If set to true, saves the residual at each iteration of the CG solver. The names of the files fit the...
const double eps
Two values in double format are considered to be equal if the absolute value of their difference is l...
const double rd1
The radius of the sphere that encloses the cube in the middle of the mesh.
AffineConstraints< double > constraints
The constraints associated with the Dirichlet boundary conditions.
Vector< double > solution
The solution vector, that is, degrees of freedom yielded by the simulation.
SparseMatrix< double > system_matrix
The system matrix.
Vector< double > system_rhs
The system right-hand side vector.
Triangulation< dim > triangulation
The mesh.
std::map< types::boundary_id, const Function< dim > * > dirichlet_stack
A map that contains pairs of boundary IDs and the corresponding Dirichlet boundary conditions....