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 SolverMMSVTII_H__
13 #define SolverMMSVTII_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_scalar_solver.hpp"
34 #include "static_vector_solver_ii.hpp"
35 
36 using namespace StaticScalarSolver;
37 using namespace StaticVectorSolver;
38 
45  : public SettingsMMSVTII
46  , public Solver<2, 0>
47 {
48 public:
49  SolverMMSVTII_T() = delete;
50 
66  SolverMMSVTII_T(unsigned int p,
67  unsigned int mapping_degree,
68  unsigned int r,
69  std::string fname)
70  : Solver<2, 0>(p,
71  mapping_degree,
72  3, // The right-hand side is volume free-current density.
73  fname,
74  &exact_solution,
75  false, // Is axisymmetric.
76  true, // Is vector potential.
77  SettingsMMSVTII::print_time_tables,
78  SettingsMMSVTII::project_exact_solution,
79  true)
80  , fname(fname)
81  , r(r)
82  {
84  }
85 
86  ~SolverMMSVTII_T() = default;
87 
88 private:
89  const std::string fname;
90 
91  const unsigned int r;
92 
93  virtual void make_mesh() override final;
94  virtual void fill_dirichlet_stack() override final;
95  virtual void solve() override final;
96 
97  const SphericalManifold<2> sphere;
98  ExactSolutionMMSVTII_T exact_solution;
99  DirichletBC_MMSVTII_T dirichlet_bc;
100 };
101 
108  : public SettingsMMSVTII
109  , public Solver2<2, 2>
110 {
111 public:
112  SolverMMSVTII_A() = delete;
132  SolverMMSVTII_A(unsigned int p,
133  unsigned int mapping_degree,
134  const Triangulation<2>& triangulation_T,
135  const DoFHandler<2>& dof_handler_T,
136  const Vector<double>& solution_T,
137  unsigned int r,
138  std::string fname)
139  : Solver2<2, 2>(p,
140  mapping_degree,
141  triangulation_T,
142  dof_handler_T,
143  solution_T,
144  0,
145  0.0,
146  fname,
147  nullptr,
148  SettingsMMSVTII::print_time_tables,
149  SettingsMMSVTII::project_exact_solution,
150  true)
151  , fname(fname)
152  , r(r)
153  {
155  }
156 
157  ~SolverMMSVTII_A() = default;
158 
159 private:
160  const std::string fname;
161 
162  const unsigned int r;
163 
164  DirichletBC_MMSVTII_A dirichlet_bc;
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
Describes the Dirichlet boundary condition for , in the Method of manufactured solutions,...
Describes the Dirichlet boundary condition for , in the Method of manufactured solutions,...
Describes exact solution, , of the Method of manufactured solutions, vector potential (mms-vt-ii/) nu...
Global settings for the Method of manufactured solutions, vector potential (mms-vt-ii/) numerical exp...
Definition: settings.hpp:26
Implements the solver for magnetic vector potential, , in the Method of manufactured solutions,...
Definition: solver.hpp:110
SolverMMSVTII_A(unsigned int p, unsigned int mapping_degree, const Triangulation< 2 > &triangulation_T, const DoFHandler< 2 > &dof_handler_T, const Vector< double > &solution_T, unsigned int r, std::string fname)
Definition: solver.hpp:132
Implements the solver for current vector potential, , in the Method of manufactured solutions,...
Definition: solver.hpp:47
SolverMMSVTII_T(unsigned int p, unsigned int mapping_degree, unsigned int r, std::string fname)
Definition: solver.hpp:66
Solves static scalar boundary value problem.
void run()
Runs the simulation.
Solves static vector boundary value problem.