Logbook  (07-04-2025)
Static problems
static_scalar_input.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 #define BOOST_ALLOW_DEPRECATED_HEADERS
13 
14 #include "static_scalar_input.hpp"
15 #include <math.h>
16 
17 using namespace StaticScalarSolver;
18 using namespace std;
19 
20 #pragma GCC diagnostic push
21 #pragma GCC diagnostic ignored "-Wunused-parameter"
22 
23 template<>
24 void
25 TheCoefficient<2>::value_list(const std::vector<Point<2>>& r,
26  types::material_id mid,
27  unsigned int cuid,
28  std::vector<double>& values) const
29 {
30  Assert(r.size() == values.size(),
31  ExcDimensionMismatch(r.size(), values.size()));
32 
33  for (unsigned int i = 0; i < values.size(); i++)
34  values[i] = ep_0;
35 }
36 
37 template<>
38 void
39 TheCoefficient<3>::value_list(const std::vector<Point<3>>& r,
40  types::material_id mid,
41  unsigned int cuid,
42  std::vector<double>& values) const
43 {
44  Assert(r.size() == values.size(),
45  ExcDimensionMismatch(r.size(), values.size()));
46 
47  for (unsigned int i = 0; i < values.size(); i++)
48  values[i] = ep_0;
49 }
50 
51 template<>
52 void
53 PdeRhs<2>::value_list(const std::vector<Point<2>>& r,
54  types::material_id mid,
55  unsigned int cuid,
56  std::vector<double>& values) const
57 {
58  Assert(r.size() == values.size(),
59  ExcDimensionMismatch(r.size(), values.size()));
60 
61  for (unsigned int i = 0; i < values.size(); i++)
62  values[i] = 0.0;
63 }
64 
65 template<>
66 void
67 PdeRhs<3>::value_list(const std::vector<Point<3>>& r,
68  types::material_id mid,
69  unsigned int cuid,
70  std::vector<double>& values) const
71 {
72  Assert(r.size() == values.size(),
73  ExcDimensionMismatch(r.size(), values.size()));
74 
75  for (unsigned int i = 0; i < values.size(); i++)
76  values[i] = 0.0;
77 }
78 
79 template<>
80 void
81 PdeRhsCvp<2>::value_list(const std::vector<Point<2>>& r,
82  types::material_id mid,
83  unsigned int cuid,
84  std::vector<Tensor<1, 2>>& values) const
85 {
86  Assert(r.size() == values.size(),
87  ExcDimensionMismatch(r.size(), values.size()));
88 
89  for (unsigned int i = 0; i < values.size(); i++) {
90  values[i][0] = 0.0;
91  values[i][1] = 0.0;
92  }
93 }
94 
95 template<>
96 void
97 PdeRhsCvp<3>::value_list(const std::vector<Point<3>>& r,
98  types::material_id mid,
99  unsigned int cuid,
100  std::vector<Tensor<1, 3>>& values) const
101 {
102  Assert(r.size() == values.size(),
103  ExcDimensionMismatch(r.size(), values.size()));
104 
105  for (unsigned int i = 0; i < values.size(); i++) {
106  values[i][0] = 0.0;
107  values[i][1] = 0.0;
108  values[i][2] = 0.0;
109  }
110 }
111 
112 template<>
113 void
114 Gamma<2>::value_list(const std::vector<Point<2>>& r,
115  const std::vector<Tensor<1, 2>>& n,
116  types::boundary_id bin,
117  types::material_id mid,
118  unsigned int cuid,
119  unsigned int fuid,
120  std::vector<double>& values) const
121 {
122  Assert(r.size() == values.size(),
123  ExcDimensionMismatch(r.size(), values.size()));
124 
125  if (bid_infty == 2) {
126  for (unsigned int i = 0; i < values.size(); i++)
127  values[i] = ep_0 / r[i].norm();
128  } else {
129  for (unsigned int i = 0; i < values.size(); i++)
130  values[i] = 0.0;
131  }
132 }
133 
134 template<>
135 void
136 Gamma<3>::value_list(const std::vector<Point<3>>& r,
137  const std::vector<Tensor<1, 3>>& n,
138  types::boundary_id bid,
139  types::material_id mid,
140  unsigned int cuid,
141  unsigned int fuid,
142  std::vector<double>& values) const
143 {
144  Assert(r.size() == values.size(),
145  ExcDimensionMismatch(r.size(), values.size()));
146 
147  if (bid_infty == 2) {
148  for (unsigned int i = 0; i < values.size(); i++)
149  values[i] = ep_0 / r[i].norm();
150  } else {
151  for (unsigned int i = 0; i < values.size(); i++)
152  values[i] = 0.0;
153  }
154 }
155 
156 template<>
157 void
158 RobinRhs<2>::value_list(const std::vector<Point<2>>& r,
159  const std::vector<Tensor<1, 2>>& n,
160  types::boundary_id bid,
161  types::material_id mid,
162  unsigned int cuid,
163  unsigned int fuid,
164  std::vector<double>& values) const
165 {
166 
167  Assert(r.size() == values.size(),
168  ExcDimensionMismatch(r.size(), values.size()));
169 
170  for (unsigned int i = 0; i < values.size(); i++)
171  values[i] = 0.0;
172 }
173 
174 template<>
175 void
176 RobinRhs<3>::value_list(const std::vector<Point<3>>& r,
177  const std::vector<Tensor<1, 3>>& n,
178  types::boundary_id bid,
179  types::material_id mid,
180  unsigned int cuid,
181  unsigned int fuid,
182  std::vector<double>& values) const
183 {
184 
185  Assert(r.size() == values.size(),
186  ExcDimensionMismatch(r.size(), values.size()));
187 
188  for (unsigned int i = 0; i < values.size(); i++)
189  values[i] = 0.0;
190 }
191 
192 template<>
193 void
194 FreeSurfaceCharge<2>::value_list(const std::vector<Point<2>>& r,
195  const std::vector<Tensor<1, 2>>& n,
196  types::material_id mid,
197  unsigned int cuid,
198  unsigned int fuid,
199  std::vector<double>& values) const
200 {
201  Assert(r.size() == values.size(),
202  ExcDimensionMismatch(r.size(), values.size()));
203 
204  for (unsigned int i = 0; i < values.size(); i++)
205  values[i] = 0.0;
206 }
207 
208 template<>
209 void
210 FreeSurfaceCharge<3>::value_list(const std::vector<Point<3>>& r,
211  const std::vector<Tensor<1, 3>>& n,
212  types::material_id mid,
213  unsigned int cuid,
214  unsigned int fuid,
215  std::vector<double>& values) const
216 {
217  Assert(r.size() == values.size(),
218  ExcDimensionMismatch(r.size(), values.size()));
219 
220  for (unsigned int i = 0; i < values.size(); i++)
221  values[i] = 0.0;
222 }
223 
224 template<>
225 double
226 Weight<2>::value(const Point<2>& r, const unsigned int) const
227 {
228  if ((r[0] < 2 * x0) && (r[0] > -2 * x0) && (r[1] < 2 * x0) &&
229  (r[1] > -2 * x0))
230  return 1.0;
231  else
232  return 0.0;
233 }
234 
235 template<>
236 double
237 Weight<3>::value(const Point<3>& r, const unsigned int) const
238 {
239  if (r.norm() <= R_mid)
240  return 1.0;
241  else
242  return 0.0;
243 }
244 
245 #pragma GCC diagnostic pop
void value_list(const std::vector< Point< dim >> &r, const std::vector< Tensor< 1, dim >> &n, types::material_id mid, unsigned int cuid, unsigned int fuid, std::vector< double > &values) const
Computes the right-hand side of the second continuity condition ( , , , or ).
void value_list(const std::vector< Point< dim >> &r, const std::vector< Tensor< 1, dim >> &n, types::boundary_id bid, types::material_id mid, unsigned int cuid, unsigned int fuid, std::vector< double > &values) const
Computes the coefficient at quadrature points.
void value_list(const std::vector< Point< dim >> &r, types::material_id mid, unsigned int cuid, std::vector< Tensor< 1, dim >> &values) const
Computes the two-dimensional free-current density on the right-hand side of the partial differential...
void value_list(const std::vector< Point< dim >> &r, types::material_id mid, unsigned int cuid, std::vector< double > &values) const
Computes the right-hand side of the div-grad partial differential equation at quadrature points.
void value_list(const std::vector< Point< dim >> &r, const std::vector< Tensor< 1, dim >> &n, types::boundary_id bid, types::material_id mid, unsigned int cuid, unsigned int fuid, std::vector< double > &values) const
Computes the right-hand side of the Robin boundary condition ( or ).
void value_list(const std::vector< Point< dim >> &r, types::material_id mid, unsigned int cuid, std::vector< double > &values) const
Computes the values of the coefficient at quadrature points.
virtual double value(const Point< dim > &r, const unsigned int component=0) const override final
Returns the value of weight at point r. All error norms, , , and , at point r will be multiplied by t...