Logbook  (07-04-2025)
Static problems
exact_solution.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 ExactSolutionSSOLIIAXI_H__
13 #define ExactSolutionSSOLIIAXI_H__
14 
15 #include <deal.II/base/function.h>
16 #include <deal.II/base/tensor.h>
17 
18 #include <deal.II/lac/vector.h>
19 
20 #include <cmath>
21 
22 #include "constants.hpp"
23 #include "settings.hpp"
24 
25 using namespace dealii;
26 
27 inline Tensor<1, 3>
28 magnetic_field(double x,
29  double y,
30  double z,
31  double K_0,
32  double mu_0,
33  double a,
34  double b)
35 {
36  double cos_theta;
37  double sin_theta;
38 
39  double cos_phi;
40  double sin_phi;
41 
42  Tensor<1, 3> r_hat;
43  Tensor<1, 3> theta_hat;
44 
45  Tensor<1, 3> F1;
46  Tensor<1, 3> F2;
47  Tensor<1, 3> B;
48 
49  double r;
50 
51  r = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));
52 
53  cos_theta = z / r;
54  sin_theta = sqrt(pow(x, 2) + pow(y, 2)) / r;
55 
56  cos_phi = x / sqrt(pow(x, 2) + pow(y, 2));
57  sin_phi = y / sqrt(pow(x, 2) + pow(y, 2));
58 
59  r_hat[0] = x / r;
60  r_hat[1] = y / r;
61  r_hat[2] = z / r;
62 
63  theta_hat[0] = cos_theta * cos_phi;
64  theta_hat[1] = cos_theta * sin_phi;
65  theta_hat[2] = -sin_theta;
66 
67  F1 = (2.0 / 3.0) * mu_0 * K_0 * (cos_theta * r_hat - sin_theta * theta_hat);
68  F2 = (2.0 / 3.0) * mu_0 * K_0 *
69  (cos_theta * r_hat + 0.5 * sin_theta * theta_hat) / pow(r, 3);
70 
71  if (r < a) {
72  B = 0.5 * (pow(b, 2) - pow(a, 2)) * F1;
73  } else if (r > b) {
74  B = 0.2 * (pow(b, 5) - pow(a, 5)) * F2;
75  } else {
76  B = 0.5 * (pow(b, 2) - pow(r, 2)) * F1 + 0.2 * (pow(r, 5) - pow(a, 5)) * F2;
77  }
78 
79  return B;
80 }
81 
88  : public Function<2>
89  , public SettingsSSOLIIAXI
90 {
91 public:
93 
94  virtual double value(const Point<2>& p,
95  const unsigned int component = 0) const override final;
96 
97  virtual Tensor<1, 2> gradient(
98  const Point<2>& p,
99  const unsigned int component = 0) const override final;
100 };
101 
108  : public Function<2>
109  , public SettingsSSOLIIAXI
110 {
111 public:
113  : Function<2>(2)
114  , B_0(2.0 * mu_0 * K_0 / 3.0)
115  {
116  }
117 
118  virtual void vector_value_list(
119  const std::vector<Point<2>>& r,
120  std::vector<Vector<double>>& values) const final;
121 
122 private:
123  const double B_0;
124 };
125 
132  : public Function<2>
133  , public SettingsSSOLIIAXI
134 {
135 public:
137  : Function<2>(2)
138  {
139  }
140 
141  virtual void vector_value_list(
142  const std::vector<Point<2>>& r,
143  std::vector<Vector<double>>& values) const final;
144 
145 private:
147 };
148 
149 #endif
Describes exact solution, , of the Axisymmetric - thick spherical coil (ssol-ii-axi) numerical experi...
Describes exact solutions, , of the Axisymmetric - thick spherical coil (ssol-ii-axi) numerical exper...
Describes exact solution, , of the Axisymmetric - thick spherical coil (ssol-ii-axi) numerical experi...
Global settings for the Axisymmetric - thick spherical coil (ssol-ii-axi) numerical experiment.
Definition: settings.hpp:26