Logbook  (07-04-2025)
Static problems
exact_solution.cpp
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 #include "exact_solution.hpp"
13 #include <cmath>
14 
15 #pragma GCC diagnostic push
16 #pragma GCC diagnostic ignored "-Wunused-parameter"
17 
18 using namespace dealii;
19 using namespace std;
20 
21 template<>
22 double
23 ExactSolutionRHOAXI_PHI<true>::value(const Point<2>& p,
24  const unsigned int component) const
25 {
26  Point<2> r;
27  r[0] = p[0];
28  r[1] = 0.0;
29 
30  if (r.norm() <= a) {
31  return rho * pow(a, 2) * (1.0 + 2.0 * log(b / a) - pow(r.norm() / a, 2)) /
32  (4.0 * ep_0);
33  } else {
34  return rho * pow(a, 2) * log(b / r.norm()) / (2.0 * ep_0);
35  }
36 
37  return 0.0;
38 }
39 
40 template<>
41 Tensor<1, 2>
43  const unsigned int component) const
44 {
45  Point<2> r;
46  r[0] = p[0];
47  r[1] = 0.0;
48 
49  if (r.norm() <= a) {
50  return -rho * r / (2 * ep_0);
51  } else {
52  return -rho * pow(a, 2) * r / (2.0 * ep_0 * r.norm_square());
53  }
54 
55  return Point<2>();
56 }
57 
58 template<>
59 double
61  const unsigned int component) const
62 {
63  Point<2> r;
64  r[0] = p[0];
65  r[1] = p[1];
66 
67  if (r.norm() <= a) {
68  return rho *
69  (pow(a, 2) + 2.0 * pow(a, 3) * (1.0 / a - 1.0 / b) -
70  r.norm_square()) /
71  (6.0 * ep_0);
72  } else {
73  return rho * pow(a, 3) * (1.0 / r.norm() - 1.0 / b) / (3.0 * ep_0);
74  }
75 
76  return 0.0;
77 }
78 
79 template<>
80 Tensor<1, 2>
82  const unsigned int component) const
83 {
84  Point<2> r;
85  r[0] = p[0];
86  r[1] = p[1];
87 
88  if (r.norm() < a) {
89  return -rho * r / (3.0 * ep_0);
90  } else {
91  return -rho * pow(a, 3) * r / (3.0 * ep_0 * pow(r.norm(), 3));
92  }
93 
94  return Point<2>();
95 }
96 
97 #pragma GCC diagnostic pop
Describes exact solutions, , of the Axisymmetric - volume charge (rho-axi/) numerical experiment.