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  if (mid == mid_2) {
35  for (unsigned int i = 0; i < values.size(); i++)
36  values[i] = 1.0 / (mu * r[i][0]);
37  } else {
38  for (unsigned int i = 0; i < values.size(); i++)
39  values[i] = 1.0 / (mu_0 * r[i][0]);
40  }
41 }
42 
43 template<>
44 void
45 PdeRhs<2>::value_list(const std::vector<Point<2>>& r,
46  types::material_id mid,
47  unsigned int cuid,
48  std::vector<double>& values) const
49 {
50  Assert(r.size() == values.size(),
51  ExcDimensionMismatch(r.size(), values.size()));
52 
53  if (mid == mid_3) {
54  for (unsigned int i = 0; i < values.size(); i++)
55  values[i] = K_0 * r[i][0];
56  } else {
57  for (unsigned int i = 0; i < values.size(); i++)
58  values[i] = 0.0;
59  }
60 }
61 
62 template<>
63 void
64 PdeRhsCvp<2>::value_list(const std::vector<Point<2>>& r,
65  types::material_id mid,
66  unsigned int cuid,
67  std::vector<Tensor<1, 2>>& values) const
68 {
69  Assert(r.size() == values.size(),
70  ExcDimensionMismatch(r.size(), values.size()));
71 
72  for (unsigned int i = 0; i < values.size(); i++) {
73  values[i][0] = 0.0;
74  values[i][1] = 0.0;
75  }
76 }
77 
78 template<>
79 void
80 Gamma<2>::value_list(const std::vector<Point<2>>& r,
81  const std::vector<Tensor<1, 2>>& n,
82  types::boundary_id bid,
83  types::material_id mid,
84  unsigned int cuid,
85  unsigned int fuid,
86  std::vector<double>& 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] = 1.0 / (mu_0 * r[i][0] * d3);
93 }
94 
95 template<>
96 void
97 RobinRhs<2>::value_list(const std::vector<Point<2>>& r,
98  const std::vector<Tensor<1, 2>>& n,
99  types::boundary_id bid,
100  types::material_id mid,
101  unsigned int cuid,
102  unsigned int fuid,
103  std::vector<double>& values) const
104 {
105 
106  Assert(r.size() == values.size(),
107  ExcDimensionMismatch(r.size(), values.size()));
108 
109  for (unsigned int i = 0; i < values.size(); i++)
110  values[i] = 0.0;
111 }
112 
113 template<>
114 void
115 FreeSurfaceCharge<2>::value_list(const std::vector<Point<2>>& r,
116  const std::vector<Tensor<1, 2>>& n,
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  for (unsigned int i = 0; i < values.size(); i++)
126  values[i] = 0.0;
127 }
128 
129 template<>
130 double
131 Weight<2>::value(const Point<2>& r, const unsigned int component) const
132 {
133  if (r.norm() < d2)
134  return 1.0;
135 
136  return 0.0;
137 }
138 
139 #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...