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] = 1.0 / (mu_0 * r.at(i)[0]);
36 }
37 
38 template<>
39 void
40 PdeRhs<2>::value_list(const std::vector<Point<2>>& 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] = 0.0;
50 }
51 
52 template<>
53 void
54 PdeRhsCvp<2>::value_list(const std::vector<Point<2>>& r,
55  types::material_id mid,
56  unsigned int cuid,
57  std::vector<Tensor<1, 2>>& 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  values.at(i)[0] = 0.0;
64  values.at(i)[1] = 0.0;
65  }
66 }
67 
68 template<>
69 void
70 Gamma<2>::value_list(const std::vector<Point<2>>& r,
71  const std::vector<Tensor<1, 2>>& n,
72  types::boundary_id bid,
73  types::material_id mid,
74  unsigned int cuid,
75  unsigned int fuid,
76  std::vector<double>& values) const
77 {
78  Assert(r.size() == values.size(),
79  ExcDimensionMismatch(r.size(), values.size()));
80 
81  for (unsigned int i = 0; i < values.size(); i++)
82  values[i] = 0.0;
83 }
84 
85 template<>
86 void
87 RobinRhs<2>::value_list(const std::vector<Point<2>>& r,
88  const std::vector<Tensor<1, 2>>& n,
89  types::boundary_id bid,
90  types::material_id mid,
91  unsigned int cuid,
92  unsigned int fuid,
93  std::vector<double>& values) const
94 {
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;
101 }
102 
103 template<>
104 void
105 FreeSurfaceCharge<2>::value_list(const std::vector<Point<2>>& r,
106  const std::vector<Tensor<1, 2>>& n,
107  types::material_id mid,
108  unsigned int cuid,
109  unsigned int fuid,
110  std::vector<double>& values) const
111 {
112  Assert(r.size() == values.size(),
113  ExcDimensionMismatch(r.size(), values.size()));
114 
115  if ((cuid == 1) && (fuid == 1)) {
116  for (unsigned int i = 0; i < values.size(); i++) {
117  values[i] = K_0 * r.at(i)[0];
118  }
119  } else {
120  for (unsigned int i = 0; i < values.size(); i++)
121  values[i] = 0.0;
122  }
123 }
124 
125 template<>
126 double
127 Weight<2>::value(const Point<2>& r, const unsigned int component) const
128 {
129  return 1.0;
130 }
131 
132 #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...