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