Logbook  (23-11-2026)
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 SolverMWR_H__
13 #define SolverMWR_H__
14 
15 #define BOOST_ALLOW_DEPRECATED_HEADERS
16 
17 #include <deal.II/base/function.h>
18 #include <deal.II/grid/grid_generator.h>
19 #include <deal.II/grid/grid_in.h>
20 #include <deal.II/grid/manifold_lib.h>
21 
22 #include <deal.II/numerics/fe_field_function.h>
23 
24 #include "exact_solution.hpp"
25 #include "settings.hpp"
26 #include "static_scalar_solver.hpp"
27 
28 #define TMR(__name) TimerOutput::Scope timer_section(timer, __name)
29 
30 using namespace StaticScalarSolver;
31 
36 class SolverMWR
37  : public SettingsMWR
38  , public Solver<2>
39 {
40 public:
41  SolverMWR() = delete;
42 
58  SolverMWR(unsigned int p,
59  unsigned int mapping_degree,
60  unsigned int r,
61  std::string fname)
62  : Solver<2>(p,
63  mapping_degree,
64  1,
65  fname,
66  &exact_solution,
67  false,
68  true,
69  SettingsMWR::print_time_tables,
70  SettingsMWR::project_exact_solution,
71  true)
72  , r(r)
73  , fname(fname)
74  , fe_slice(1)
75  {
76  TimerOutput::OutputFrequency tf = (SettingsMWR::print_time_tables)
77  ? TimerOutput::summary
78  : TimerOutput::never;
79 
80  TimerOutput timer(std::cout, tf, TimerOutput::cpu_and_wall_times_grouped);
81 
82  {
83  TMR("Solver run");
85  }
86  {
87  TMR("Data slice");
88  data_slice(fname);
89  }
90  }
91 
92  ~SolverMWR() = default;
93 
94 private:
95  const unsigned int r;
96  const std::string fname;
97 
98  const ExactSolutionMWR_A exact_solution;
99  const dealii::Functions::ZeroFunction<2> dirichlet;
100 
101  // The amount of global mesh refinements that need to be done to the
102  // one-dimensional mesh used for the plot of potential vs. x coordinate.
103  const unsigned int nr_slice_global_refs = 10;
104 
105  // These four data members are needed for making the plot of potential
106  // vs. \f$x\f$ coordinate.
107  Triangulation<1, 2> triangulation_slice;
108  FE_Q<1, 2> fe_slice;
109  DoFHandler<1, 2> dof_handler_slice;
110  Vector<double> solution_slice;
111 
112  SphericalManifold<2> sphere;
113 
114  virtual void make_mesh() override final;
115  virtual void fill_dirichlet_stack() override final;
116  virtual void solve() override final;
117 
118  void mark_materials();
119 
120  // This function makes the plot of potential vs. \f$x\f$ coordinate.
121  void data_slice(std::string fname);
122 };
123 
124 #endif
Describes exact solution, , of the Magnetic wire (mwr/) numerical experiment.
Global settings for the Magnetic wire (mwr/) numerical experiment.
Definition: settings.hpp:26
const bool print_time_tables
If set to true, the program will print time tables on the screen.
Definition: settings.hpp:109
Implements the Magnetic wire (mwr/) numerical experiment.
Definition: solver.hpp:39
SolverMWR(unsigned int p, unsigned int mapping_degree, unsigned int r, std::string fname)
Definition: solver.hpp:58
Solves static scalar boundary value problem.
void run()
Runs the simulation.