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 
14 #pragma GCC diagnostic push
15 #pragma GCC diagnostic ignored "-Wunused-parameter"
16 
17 using namespace dealii;
18 using namespace std;
19 
20 template<>
21 double
22 ExactSolutionSCH_PHI<2>::value(const Point<2>& r,
23  const unsigned int component) const
24 {
25  if (r.norm() > a) {
26  return (log(b) - log(sqrt(r.square()))) / (log(b) - log(a));
27  }
28 
29  return 1.0;
30 }
31 
32 template<>
33 Tensor<1, 2>
34 ExactSolutionSCH_PHI<2>::gradient(const Point<2>& r,
35  const unsigned int component) const
36 {
37  if (r.norm() > a) {
38  return -1.0 / (log(b) - log(a)) * r / r.square();
39  }
40 
41  return Point<2>();
42 }
43 
44 template<>
45 double
46 ExactSolutionSCH_PHI<3>::value(const Point<3>& r,
47  const unsigned int component) const
48 {
49  if (r.norm() > a) {
50  return (a * b / (b - a)) * (1 / sqrt(r.square()) - 1 / b);
51  }
52 
53  return 1.0;
54 }
55 
56 template<>
57 Tensor<1, 3>
58 ExactSolutionSCH_PHI<3>::gradient(const Point<3>& r,
59  const unsigned int component) const
60 {
61  if (r.norm() > a) {
62  return -a * b / (b - a) * r / pow(sqrt(r.square()), 3);
63  }
64 
65  return Point<3>();
66 }
67 
68 #pragma GCC diagnostic pop
Describes exact solution, , of the Surface charge (sch/) numerical experiment.