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<>
23 {
24  alpha = 1.0 / (ep_1 * log(b / d_2) + ep_2 * log(d_1 / a));
25  beta = (ep_1 / ep_2) * log(b / d_2);
26  phi_d = alpha * ep_1 * log(b / d_2);
27 }
28 
29 template<>
30 double
31 ExactSolutionFLC_PHI<2>::value(const Point<2>& r,
32  const unsigned int component) const
33 {
34  if (r.norm() < d_1)
35  return (-alpha * ep_2 * (log(r.norm() / d_1) - beta));
36 
37  if (r.norm() > d_2)
38  return (-alpha * ep_1 * (log(r.norm() / b)));
39 
40  return phi_d;
41 }
42 
43 template<>
44 Tensor<1, 2>
45 ExactSolutionFLC_PHI<2>::gradient(const Point<2>& r,
46  const unsigned int component) const
47 {
48  if (r.norm() < d_1)
49  return -alpha * ep_2 * (1 / r.square()) * r;
50 
51  if (r.norm() > d_2)
52  return -alpha * ep_1 * (1 / r.square()) * r;
53 
54  return Point<2>();
55 }
56 
57 template<>
59 {
60  alpha = 1.0 / (ep_1 * (1.0 / b - 1.0 / d_2) + ep_2 * (1.0 / d_1 - 1.0 / a));
61  beta = 1.0 / d_1 + (ep_1 / ep_2) * (1.0 / b - 1.0 / d_2);
62  phi_d = alpha * ep_1 * (1.0 / b - 1.0 / d_2);
63 }
64 
65 template<>
66 double
67 ExactSolutionFLC_PHI<3>::value(const Point<3>& r,
68  const unsigned int component) const
69 {
70  if (r.norm() < d_1)
71  return (-alpha * ep_2 * (1.0 / r.norm() - beta));
72 
73  if (r.norm() > d_2)
74  return (-alpha * ep_1 * (1.0 / r.norm() - 1.0 / b));
75 
76  return phi_d;
77 }
78 
79 template<>
80 Tensor<1, 3>
81 ExactSolutionFLC_PHI<3>::gradient(const Point<3>& r,
82  const unsigned int component) const
83 {
84  if (r.norm() < d_1)
85  return alpha * ep_2 * r / pow(r.norm(), 3);
86 
87  if (r.norm() > d_2)
88  return alpha * ep_1 * r / pow(r.norm(), 3);
89 
90  return Point<3>();
91 }
92 
93 #pragma GCC diagnostic pop
Describes exact solution, , of the Floating conductor (flc/) numerical experiment.