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  values[i] = ep_0;
36 }
37 
38 template<>
39 void
40 TheCoefficient<3>::value_list(const std::vector<Point<3>>& r,
41  types::material_id mid,
42  unsigned int cuid,
43  std::vector<double>& values) const
44 {
45  Assert(r.size() == values.size(),
46  ExcDimensionMismatch(r.size(), values.size()));
47 
48  for (unsigned int i = 0; i < values.size(); i++)
49  values[i] = ep_0;
50 }
51 
52 template<>
53 void
54 PdeRhs<2>::value_list(const std::vector<Point<2>>& r,
55  types::material_id mid,
56  unsigned int cuid,
57  std::vector<double>& values) const
58 {
59  Assert(r.size() == values.size(),
60  ExcDimensionMismatch(r.size(), values.size()));
61 
62  for (unsigned int i = 0; i < values.size(); i++) {
63  if (mid == mid_2) {
64  values[i] = rho_0;
65  } else {
66  values[i] = 0.0;
67  }
68  }
69 }
70 
71 template<>
72 void
73 PdeRhs<3>::value_list(const std::vector<Point<3>>& r,
74  types::material_id mid,
75  unsigned int cuid,
76  std::vector<double>& values) const
77 {
78  Assert(r.size() == values.size(),
79  ExcDimensionMismatch(r.size(), values.size()));
80  for (unsigned int i = 0; i < values.size(); i++) {
81  if (mid == mid_2) {
82  values[i] = rho_0;
83  } else {
84  values[i] = 0.0;
85  }
86  }
87 }
88 
89 template<>
90 void
91 PdeRhsCvp<2>::value_list(const std::vector<Point<2>>& r,
92  types::material_id mid,
93  unsigned int cuid,
94  std::vector<Tensor<1, 2>>& values) const
95 {
96  Assert(r.size() == values.size(),
97  ExcDimensionMismatch(r.size(), values.size()));
98 
99  for (unsigned int i = 0; i < values.size(); i++) {
100  values[i][0] = 0.0;
101  values[i][1] = 0.0;
102  }
103 }
104 
105 template<>
106 void
107 PdeRhsCvp<3>::value_list(const std::vector<Point<3>>& r,
108  types::material_id mid,
109  unsigned int cuid,
110  std::vector<Tensor<1, 3>>& values) const
111 {
112  Assert(r.size() == values.size(),
113  ExcDimensionMismatch(r.size(), values.size()));
114 
115  for (unsigned int i = 0; i < values.size(); i++) {
116  values[i][0] = 0.0;
117  values[i][1] = 0.0;
118  values[i][2] = 0.0;
119  }
120 }
121 
122 template<>
123 void
124 Gamma<2>::value_list(const std::vector<Point<2>>& r,
125  const std::vector<Tensor<1, 2>>& n,
126  types::boundary_id bid,
127  types::material_id mid,
128  unsigned int cuid,
129  unsigned int fuid,
130  std::vector<double>& values) const
131 {
132  Assert(r.size() == values.size(),
133  ExcDimensionMismatch(r.size(), values.size()));
134 
135  for (unsigned int i = 0; i < values.size(); i++)
136  values[i] = 0.0;
137 }
138 
139 template<>
140 void
141 Gamma<3>::value_list(const std::vector<Point<3>>& r,
142  const std::vector<Tensor<1, 3>>& n,
143  types::boundary_id bid,
144  types::material_id mid,
145  unsigned int cuid,
146  unsigned int fuid,
147  std::vector<double>& values) const
148 {
149  Assert(r.size() == values.size(),
150  ExcDimensionMismatch(r.size(), values.size()));
151 
152  for (unsigned int i = 0; i < values.size(); i++)
153  values[i] = 0.0;
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 component) const
227 {
228  return 1.0;
229 }
230 
231 template<>
232 double
233 Weight<3>::value(const Point<3>& r, const unsigned int component) const
234 {
235  return 1.0;
236 }
237 
238 #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...