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