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 SolverSSOLIII_H__
13 #define SolverSSOLIII_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 <fstream>
29 #include <string>
30 
31 #include "exact_solution.hpp"
32 #include "settings.hpp"
33 #include "static_vector_solver_i.hpp"
34 #include "static_vector_solver_ii.hpp"
35 
36 using namespace StaticVectorSolver;
37 
44  : public SettingsSSOLIII
45  , public Solver1<3, 0>
46 {
47 public:
48  SolverSSOLIII_T() = delete;
49 
63  SolverSSOLIII_T(unsigned int p,
64  unsigned int mapping_degree,
65  unsigned int r,
66  std::string fname)
67  : Solver1<3, 0>(p,
68  mapping_degree,
69  2,
70  0.0,
71  fname,
72  nullptr,
73  SettingsSSOLIII::print_time_tables,
74  false,
75  true)
76  , r(r)
77  , fname(fname)
78  {
80  }
81 
82  ~SolverSSOLIII_T() = default;
83 
84 private:
85  const unsigned int r;
86  const std::string fname;
87 
88  virtual void make_mesh() override final;
89  virtual void fill_dirichlet_stack() override final;
90  virtual void solve() override final;
91 
92  const SphericalManifold<3> sphere;
93  const Functions::ZeroFunction<3> dirichlet_bc{ 3 };
94 };
95 
102  : public SettingsSSOLIII
103  , public Solver2<3, 2>
104 {
105 public:
106  SolverSSOLIII_A() = delete;
107 
127  SolverSSOLIII_A(unsigned int p,
128  unsigned int mapping_degree,
129  unsigned int r,
130  const Triangulation<3>& triangulation_T,
131  const DoFHandler<3>& dof_handler_T,
132  const Vector<double>& solution_T,
133  std::string fname)
134  : Solver2<3, 2>(p,
135  mapping_degree,
136  triangulation_T,
137  dof_handler_T,
138  solution_T,
139  2,
140  0.0,
141  fname,
142  nullptr,
143  SettingsSSOLIII::print_time_tables,
144  false,
145  true)
146  , r(r)
147  , fname(fname)
148  {
149  for (auto cell : Solver2<3, 2>::triangulation_T.active_cell_iterators()) {
150  for (unsigned int f = 0; f < GeometryInfo<3>::faces_per_cell; f++) {
151  if (cell->face(f)->at_boundary() && (cell->face(f)->boundary_id() == 1))
152  cell->face(f)->set_boundary_id(2);
153  }
154  }
155 
157  }
158 
159  ~SolverSSOLIII_A() = default;
160 
161 private:
162  const unsigned int r;
163  const std::string fname;
164 
165  // Solver2 reuses triangulations of other solvers.
166  // No make_mesh() this time around.
167  virtual void fill_dirichlet_stack() override final;
168  virtual void solve() override final;
169 };
170 
171 #endif
Global settings for the Spherical coil with magnetic core (ssol-iii/) numerical experiment.
Definition: settings.hpp:26
Solves for the magnetic vector potential, , in the Spherical coil with magnetic core (ssol-iii/) nume...
Definition: solver.hpp:104
SolverSSOLIII_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:127
Solves for the current vector potential, , in the Spherical coil with magnetic core (ssol-iii/) numer...
Definition: solver.hpp:46
SolverSSOLIII_T(unsigned int p, unsigned int mapping_degree, unsigned int r, std::string fname)
Definition: solver.hpp:63
Solves static vector boundary value problem.
void run()
Runs the simulation.
Solves static vector boundary value problem.
void run()
Runs the simulation.