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 
20 template<>
22  : Function<3>(3)
23 {
24 }
25 
26 template<>
27 void
29  const std::vector<Point<3>>& r,
30  std::vector<Vector<double>>& values) const
31 {
32  Assert(values.size() == r.size(),
33  ExcDimensionMismatch(values.size(), r.size()));
34 
35  auto v = values.begin();
36  for (auto p : r) {
37  (*v)(0) = -sin(k * p[1]) / k;
38  (*v)(1) = sin(k * p[0]) / k;
39  (*v)(2) = 0.0;
40  v++;
41  }
42 }
43 
44 template<>
46  : Function<2>(2)
47 {
48 }
49 
50 template<>
51 void
53  const std::vector<Point<2>>& r,
54  std::vector<Vector<double>>& values) const
55 {
56  Assert(values.size() == r.size(),
57  ExcDimensionMismatch(values.size(), r.size()));
58 
59  auto v = values.begin();
60  for (auto p : r) {
61  (*v)(0) = -sin(k * p[1]) / k;
62  (*v)(1) = sin(k * p[0]) / k;
63 
64  v++;
65  }
66 }
67 
68 template<>
70  : Function<3>(3)
71 {
72 }
73 
74 template<>
75 void
77  const std::vector<Point<3>>& r,
78  std::vector<Vector<double>>& values) const
79 {
80  Assert(values.size() == r.size(),
81  ExcDimensionMismatch(values.size(), r.size()));
82 
83  auto v = values.begin();
84  for (auto p : r) {
85  (*v)(0) = 0.0;
86  (*v)(1) = 0.0;
87  (*v)(2) = cos(k * p[0]) + cos(k * p[1]);
88  v++;
89  }
90 }
91 
92 // Is not used. This prevents messages from linker.
93 template<>
94 double
95 ExactSolutionMMSV_B<3>::value(const Point<3>& r,
96  const unsigned int component) const
97 {
98  return 0.0;
99 }
100 
101 template<>
103 {
104 }
105 
106 // Is not used. This prevents messages from linker.
107 template<>
108 void
110  const std::vector<Point<2>>& r,
111  std::vector<Vector<double>>& values) const
112 {
113 }
114 
115 template<>
116 double
117 ExactSolutionMMSV_B<2>::value(const Point<2>& r,
118  const unsigned int component) const
119 {
120  return cos(k * r[0]) + cos(k * r[1]);
121 }
Describes exact solutions, , of the Method of manufactured solutions, vector potential (mms-v/) numer...
Describes exact solutions, , of the Method of manufactured solutions, vector potential (mms-v/) numer...