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<>
22  : Function<2>()
23 {
24  Assert(R < x0, ExcInternalError());
25  Assert(R > 0, ExcInternalError());
26  Assert(x0 > 0, ExcInternalError());
27  Assert(a > 0, ExcInternalError());
28  Assert(a < 1.5 * (R + x0), ExcInternalError());
29 
30  d = sqrt(pow(x0, 2) - pow(R, 2));
31  lambda = 1.0 / log(x0 / R + sqrt(pow(x0 / R, 2) - 1));
32 }
33 
34 template<>
35 double
36 ExactSolutionABC_PHI<2>::value(const Point<2>& r, unsigned int component) const
37 {
38  double xp = pow(r[0] + d, 2) + pow(r[1], 2);
39  double xm = pow(r[0] - d, 2) + pow(r[1], 2);
40 
41  return (0.5 * lambda * log(xp / xm));
42 }
43 
44 template<>
45 Tensor<1, 2>
46 ExactSolutionABC_PHI<2>::gradient(const Point<2>& r,
47  unsigned int component) const
48 {
49  Tensor<1, 2> p;
50 
51  double xp = pow(r[0] + d, 2) + pow(r[1], 2);
52  double xm = pow(r[0] - d, 2) + pow(r[1], 2);
53 
54  p[0] = (r[0] + d) / xp - (r[0] - d) / xm;
55 
56  p[1] = r[1] / xp - r[1] / xm;
57 
58  return lambda * p;
59 }
60 
61 template<>
63  : Function<3>()
64 {
65  Assert(R < x0, ExcInternalError());
66  Assert(R > 0, ExcInternalError());
67  Assert(x0 > 0, ExcInternalError());
68  Assert(a > 0, ExcInternalError());
69  Assert(a < 1.5 * (R + x0), ExcInternalError());
70 }
71 
72 template<>
73 double
74 ExactSolutionABC_PHI<3>::value(const Point<3>& r, unsigned int componet) const
75 {
76  return a / r.norm();
77 }
78 
79 template<>
80 Tensor<1, 3>
81 ExactSolutionABC_PHI<3>::gradient(const Point<3>& r,
82  unsigned int component) const
83 {
84  return -r * a / pow(r.norm(), 3);
85 }
86 
87 #pragma GCC diagnostic pop
Describes exact solution, , of the Asymptotic boundary condition (abc/) numerical experiment.