Logbook  (07-04-2025)
Static problems
solver.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 #include "solver.hpp"
13 
14 template<>
15 void
17 {
18  GridIn<2> gridin;
19  gridin.attach_triangulation(Solver<2>::triangulation);
20 
21  std::ifstream ifs("../../gmsh/data/cylinder_r" + std::to_string(r) + ".msh");
22  gridin.read_msh(ifs);
23 
24  double cell_r;
25  for (auto cell : Solver<2>::triangulation.active_cell_iterators()) {
26  cell_r = cell->center()[0];
27 
28  if (cell_r < d_1) {
29  cell->set_material_id(mid_1);
30  } else if (cell_r < d_2) {
31  cell->set_material_id(mid_3);
32  } else if (cell_r < b) {
33  cell->set_material_id(mid_2);
34  }
35  }
36 }
37 
38 template<>
39 void
41 {
42  GridIn<2> gridin;
43  gridin.attach_triangulation(Solver<2>::triangulation);
44 
45  std::ifstream ifs("../../gmsh/data/sphere_r" + std::to_string(r) + ".msh");
46  gridin.read_msh(ifs);
47 
48  Solver<2>::triangulation.reset_all_manifolds();
49 
50  double cell_r;
51  for (auto cell : Solver<2>::triangulation.active_cell_iterators()) {
52  cell_r = cell->center().norm();
53 
54  if (cell_r < d_1) {
55  cell->set_material_id(mid_1);
56  } else if (cell_r < d_2) {
57  cell->set_material_id(mid_3);
58  } else if (cell_r < b) {
59  cell->set_material_id(mid_2);
60  }
61  }
62 
63  Solver<2>::triangulation.set_all_manifold_ids(1);
64  Solver<2>::triangulation.set_manifold(1, sphere);
65 }
Implements the solver of the Axisymmetric - floating conductor (flc-axi/) numerical experiment.
Definition: solver.hpp:41
Triangulation< dim > triangulation
The mesh.