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 ExactSolutionsSSOLII_H__
13 #define ExactSolutionsSSOLII_H__
14 
15 #include "constants.hpp"
16 #include "settings.hpp"
17 #include <deal.II/base/function.h>
18 #include <deal.II/lac/vector.h>
19 
20 #include <cmath>
21 
22 using namespace dealii;
23 
24 inline Tensor<1, 3>
25 volume_free_current_density(double x,
26  double y,
27  double z,
28  double K_0,
29  double a,
30  double b)
31 {
32  Tensor<1, 3> J;
33  double r;
34 
35  r = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));
36 
37  if ((r > a) && (r < b)) {
38  J[0] = -K_0 * y;
39  J[1] = K_0 * x;
40  J[2] = 0.0;
41  } else {
42  J[0] = 0.0;
43  J[1] = 0.0;
44  J[2] = 0.0;
45  }
46 
47  return J;
48 }
49 
50 inline Tensor<1, 3>
51 magnetic_field(double x,
52  double y,
53  double z,
54  double K_0,
55  double mu_0,
56  double a,
57  double b)
58 {
59  double cos_theta;
60  double sin_theta;
61 
62  double cos_phi;
63  double sin_phi;
64 
65  Tensor<1, 3> r_hat;
66  Tensor<1, 3> theta_hat;
67 
68  Tensor<1, 3> F1;
69  Tensor<1, 3> F2;
70  Tensor<1, 3> B;
71 
72  double r;
73 
74  r = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));
75 
76  cos_theta = z / r;
77  sin_theta = sqrt(pow(x, 2) + pow(y, 2)) / r;
78 
79  cos_phi = x / sqrt(pow(x, 2) + pow(y, 2));
80  sin_phi = y / sqrt(pow(x, 2) + pow(y, 2));
81 
82  r_hat[0] = x / r;
83  r_hat[1] = y / r;
84  r_hat[2] = z / r;
85 
86  theta_hat[0] = cos_theta * cos_phi;
87  theta_hat[1] = cos_theta * sin_phi;
88  theta_hat[2] = -sin_theta;
89 
90  F1 = (2.0 / 3.0) * mu_0 * K_0 * (cos_theta * r_hat - sin_theta * theta_hat);
91  F2 = (2.0 / 3.0) * mu_0 * K_0 *
92  (cos_theta * r_hat + 0.5 * sin_theta * theta_hat) / pow(r, 3);
93 
94  if (r < a) {
95  B = 0.5 * (pow(b, 2) - pow(a, 2)) * F1;
96  } else if (r > b) {
97  B = 0.2 * (pow(b, 5) - pow(a, 5)) * F2;
98  } else {
99  B = 0.5 * (pow(b, 2) - pow(r, 2)) * F1 + 0.2 * (pow(r, 5) - pow(a, 5)) * F2;
100  }
101 
102  return B;
103 }
104 
110  : public Function<3>
111  , public SettingsSSOLII
112 {
113 public:
115 
116  virtual void vector_value_list(
117  const std::vector<Point<3>>& r,
118  std::vector<Vector<double>>& values) const override final;
119 };
120 
126  : public Function<3>
127  , public SettingsSSOLII
128 {
129 public:
131 
132  virtual void vector_value_list(
133  const std::vector<Point<3>>& r,
134  std::vector<Vector<double>>& values) const override final;
135 };
136 
137 #endif
Describes the exact solution, , of the Thick spherical coil (ssol-ii/) numerical experiment.
Describes the exact solution, , of the Thick spherical coil (ssol-ii/) numerical experiment.
Global settings for the Thick spherical coil (ssol-ii/) numerical experiment.
Definition: settings.hpp:25