Logbook  (07-04-2025)
Static problems
static_vector_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 <cmath>
13 #include <deal.II/base/types.h>
14 #define BOOST_ALLOW_DEPRECATED_HEADERS
15 
16 #include "static_vector_input.hpp"
17 #include <math.h>
18 
19 using namespace StaticVectorSolver;
20 using namespace std;
21 
22 #pragma GCC diagnostic push
23 #pragma GCC diagnostic ignored "-Wunused-parameter"
24 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
25 
26 template<>
27 void
28 TheCoefficient<3>::value_list(const std::vector<Point<3>>& r,
29  types::material_id mid,
30  unsigned int cuid,
31  std::vector<double>& values) const
32 {
33  Assert(r.size() == values.size(),
34  ExcDimensionMismatch(r.size(), values.size()));
35 
36  auto v = values.begin();
37  for (auto p : r) {
38  *v = mu_0;
39  v++;
40  }
41 }
42 
43 template<>
44 void
45 PdeRhs<3>::value_list(const std::vector<Point<3>>& r,
46  types::material_id mid,
47  unsigned int cuid,
48  std::vector<Tensor<1, 3>>& values) const
49 {
50  Assert(r.size() == values.size(),
51  ExcDimensionMismatch(r.size(), values.size()));
52 
53  for (unsigned int i = 0; i < r.size(); i++) {
54  values[i][0] = 0.0;
55  values[i][1] = 0.0;
56  values[i][2] = 0.0;
57  }
58 }
59 
60 template<>
61 void
62 Gamma<3>::value_list(const std::vector<Point<3>>& r,
63  const std::vector<Tensor<1, 3>>& n,
64  types::boundary_id bid,
65  types::material_id mid,
66  unsigned int cuid,
67  unsigned int fuid,
68  std::vector<double>& values) const
69 {
70  Assert(r.size() == values.size(),
71  ExcDimensionMismatch(r.size(), values.size()));
72 
73  for (unsigned int i = 0; i < r.size(); i++)
74  values[i] = 1.0 / (mu_0 * r[i].norm());
75 }
76 
77 template<>
78 void
79 RobinRhs<3>::value_list(const std::vector<Point<3>>& r,
80  const std::vector<Tensor<1, 3>>& n,
81  types::boundary_id bid,
82  types::material_id mid,
83  unsigned int cuid,
84  unsigned int fuid,
85  std::vector<Tensor<1, 3>>& values) const
86 {
87  Assert(r.size() == values.size(),
88  ExcDimensionMismatch(r.size(), values.size()));
89 
90  for (unsigned int i = 0; i < r.size(); i++) {
91  values[i][0] = 0.0;
92  values[i][1] = 0.0;
93  values[i][2] = 0.0;
94  }
95 }
96 
97 template<>
98 void
99 FreeSurfaceCurrent<3>::value_list(const std::vector<Point<3>>& r,
100  const std::vector<Tensor<1, 3>>& n,
101  types::material_id mid,
102  unsigned int cuid,
103  unsigned int fuid,
104  std::vector<Tensor<1, 3>>& values) const
105 {
106  Assert(r.size() == values.size(),
107  ExcDimensionMismatch(r.size(), values.size()));
108 
109  if ((cuid == 1) && (fuid == 1)) {
110  for (unsigned int i = 0; i < r.size(); i++) {
111  values[i][0] = -K_0 * r[i][1];
112  values[i][1] = K_0 * r[i][0];
113  values[i][2] = 0.0;
114  }
115  } else {
116  for (unsigned int i = 0; i < values.size(); i++) {
117  values[i][0] = 0.0;
118  values[i][1] = 0.0;
119  values[i][2] = 0.0;
120  }
121  }
122 }
123 
124 template<>
125 double
126 Weight<3>::value(const Point<3>& r, const unsigned int component) const
127 {
128  if (r.norm() > d2)
129  return 0.0;
130 
131  return 1.0;
132 }
133 #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< Tensor< 1, dim >> &values) const
Computes values of the surface free-current density, , on the right-hand side of the continuity condi...
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 values of the parameter of the Robin boundary condition 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 vector field on the right-hand side of the partial differential equation.
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< Tensor< 1, dim >> &values) const
Computes values of the vector field on the right-hand side of the Robin boundary condition at quadra...
void value_list(const std::vector< Point< dim >> &r, types::material_id mid, unsigned int cuid, std::vector< double > &values) const
Computes values of permeability, , 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...