Logbook  (07-04-2025)
Static problems
exact_solution.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 "exact_solution.hpp"
13 
14 #pragma GCC diagnostic push
15 #pragma GCC diagnostic ignored "-Wunused-parameter"
16 
17 using namespace dealii;
18 
19 double
20 ExactSolutionMMSVTII_T::value(const Point<2>& r,
21  const unsigned int component) const
22 {
23  return current_vector_potential(r[0], r[1], mu_0, k);
24 }
25 
26 Tensor<1, 2>
27 ExactSolutionMMSVTII_T::gradient(const Point<2>& r,
28  const unsigned int component) const
29 {
30  double Bm = magnetic_field(r[0], r[1], k);
31  double mu = permeability(r[0], r[1], mu_0);
32 
33  Point<2> grad_Tm;
34  grad_Tm[0] = -2.0 * r[0] * mu_0 / pow(mu, 2) * Bm - (k / mu) * sin(k * r[0]);
35  grad_Tm[1] = -2.0 * r[1] * mu_0 / pow(mu, 2) * Bm - (k / mu) * sin(k * r[1]);
36 
37  return grad_Tm;
38 }
39 
40 void
41 ExactSolutionMMSVTII_Jf::vector_value_list(
42  const std::vector<Point<2>>& r,
43  std::vector<Vector<double>>& values) const
44 {
45  Assert(values.size() == r.size(),
46  ExcDimensionMismatch(values.size(), r.size()));
47 
48  Tensor<1, 2> Jf;
49 
50  for (unsigned int i = 0; i < values.size(); i++) {
51  Jf = volume_free_current_density(r[i][0], r[i][1], mu_0, k);
52 
53  values[i][0] = Jf[0];
54  values[i][1] = Jf[1];
55  }
56 }
57 
58 void
59 ExactSolutionMMSVTII_B::value_list(const std::vector<Point<2>>& r,
60  std::vector<double>& values,
61  const unsigned int component) const
62 {
63  Assert(values.size() == r.size(),
64  ExcDimensionMismatch(values.size(), r.size()));
65 
66  for (unsigned int i = 0; i < values.size(); i++)
67  values[i] = magnetic_field(r[i][0], r[i][1], k);
68 }
69 
70 void
71 DirichletBC_MMSVTII_T::value_list(const std::vector<Point<2>>& r,
72  std::vector<double>& values,
73  const unsigned int component) const
74 {
75  Assert(values.size() == r.size(),
76  ExcDimensionMismatch(values.size(), r.size()));
77 
78  for (unsigned int i = 0; i < values.size(); i++)
79  values[i] = current_vector_potential(r[i][0], r[i][1], mu_0, k);
80 }
81 
82 void
83 DirichletBC_MMSVTII_A::vector_value_list(
84  const std::vector<Point<2>>& r,
85  std::vector<Vector<double>>& values) const
86 {
87  Assert(values.size() == r.size(),
88  ExcDimensionMismatch(values.size(), r.size()));
89 
90  Tensor<1, 2> A;
91 
92  for (unsigned int i = 0; i < values.size(); i++) {
93  A = magnetic_vector_potential(r[i][0], r[i][1], k);
94 
95  values[i][0] = A[0];
96  values[i][1] = A[1];
97  }
98 }