Logbook  (07-04-2025)
Static problems
solver.hpp
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 #ifndef SolverSSOLII_H__
13 #define SolverSSOLII_H__
14 
15 #include <deal.II/base/function.h>
16 #include <deal.II/base/tensor_function.h>
17 #include <deal.II/base/vectorization.h>
18 
19 #include <deal.II/lac/precondition.h>
20 #include <deal.II/lac/solver_cg.h>
21 #include <deal.II/lac/solver_control.h>
22 #include <deal.II/lac/sparse_direct.h>
23 
24 #include <deal.II/grid/grid_in.h>
25 #include <deal.II/grid/grid_tools.h>
26 #include <deal.II/grid/manifold_lib.h>
27 
28 #include <string>
29 
30 #include "exact_solution.hpp"
31 #include "settings.hpp"
32 #include "static_vector_solver_i.hpp"
33 #include "static_vector_solver_ii.hpp"
34 
35 using namespace StaticVectorSolver;
36 
42  : public SettingsSSOLII
43  , public Solver1<3, 0>
44 {
45 public:
46  SolverSSOLII_T() = delete;
47 
61  SolverSSOLII_T(unsigned int p,
62  unsigned int mapping_degree,
63  unsigned int r,
64  std::string fname)
65  : Solver1<3, 0>(p,
66  mapping_degree,
67  2,
68  0.0,
69  fname,
70  nullptr,
71  SettingsSSOLII::print_time_tables,
72  false,
73  true)
74  , r(r)
75  , fname(fname)
76  {
78  }
79 
80  ~SolverSSOLII_T() = default;
81 
82 private:
83  const unsigned int r;
84  const std::string fname;
85 
86  virtual void make_mesh() override final;
87  virtual void fill_dirichlet_stack() override final;
88  virtual void solve() override final;
89 
90  const SphericalManifold<3> sphere;
91  const Functions::ZeroFunction<3> dirichlet_bc{ 3 };
92 };
93 
99  : public SettingsSSOLII
100  , public Solver2<3, 2>
101 {
102 public:
103  SolverSSOLII_A() = delete;
104 
124  SolverSSOLII_A(unsigned int p,
125  unsigned int mapping_degree,
126  unsigned int r,
127  const Triangulation<3>& triangulation_T,
128  const DoFHandler<3>& dof_handler_T,
129  const Vector<double>& solution_T,
130  std::string fname)
131  : Solver2<3, 2>(p,
132  mapping_degree,
133  triangulation_T,
134  dof_handler_T,
135  solution_T,
136  2,
137  0.0,
138  fname,
139  nullptr,
140  SettingsSSOLII::print_time_tables,
141  false,
142  true)
143  , r(r)
144  , fname(fname)
145  {
146  for (auto cell : Solver2<3, 2>::triangulation_T.active_cell_iterators()) {
147  for (unsigned int f = 0; f < GeometryInfo<3>::faces_per_cell; f++) {
148  if (cell->face(f)->at_boundary() && (cell->face(f)->boundary_id() == 1))
149  cell->face(f)->set_boundary_id(2);
150  }
151  }
152 
154  }
155 
156  ~SolverSSOLII_A() = default;
157 
158 private:
159  const unsigned int r;
160  const std::string fname;
161 
162  // Solver2 reuses triangulations of other solvers.
163  // No make_mesh() this time around.
164  virtual void fill_dirichlet_stack() override final;
165  virtual void solve() override final;
166 };
167 
168 #endif
Global settings for the Thick spherical coil (ssol-ii/) numerical experiment.
Definition: settings.hpp:25
Solves for the magnetic vector potential, , in the Thick spherical coil (ssol-ii/) numerical experime...
Definition: solver.hpp:101
SolverSSOLII_A(unsigned int p, unsigned int mapping_degree, unsigned int r, const Triangulation< 3 > &triangulation_T, const DoFHandler< 3 > &dof_handler_T, const Vector< double > &solution_T, std::string fname)
Definition: solver.hpp:124
Solves for the current vector potential, , in the Thick spherical coil (ssol-ii/) numerical experimen...
Definition: solver.hpp:44
SolverSSOLII_T(unsigned int p, unsigned int mapping_degree, unsigned int r, std::string fname)
Definition: solver.hpp:61
Solves static vector boundary value problem.
void run()
Runs the simulation.
Solves static vector boundary value problem.
void run()
Runs the simulation.