Bembel
InductanceMatrix.hpp
1 // This file is part of Bembel, the higher order C++ boundary element library.
2 //
3 // Copyright (C) 2023 see <http://www.bembel.eu>
4 //
5 // It was written as part of a cooperation of J. Doelz, H. Harbrecht, S. Kurz,
6 // M. Multerer, S. Schoeps, and F. Wolf at Technische Universitaet Darmstadt,
7 // Universitaet Basel, and Universita della Svizzera italiana, Lugano. This
8 // source code is subject to the GNU General Public License version 3 and
9 // provided WITHOUT ANY WARRANTY, see <http://www.bembel.eu> for further
10 // information.
11 
12 #ifndef BEMBEL_SRC_AUGMENTEDEFIE_INDUCTANCEMATRIX_HPP_
13 #define BEMBEL_SRC_AUGMENTEDEFIE_INDUCTANCEMATRIX_HPP_
14 
15 namespace Bembel {
16 // forward declaration of class InductanceMatrix in order to define
17 // traits
18 class InductanceMatrix;
19 
20 template <>
22  typedef Eigen::VectorXcd EigenType;
23  typedef Eigen::VectorXcd::Scalar Scalar;
24  enum {
25  OperatorOrder = -1,
26  Form = DifferentialForm::DivConforming,
27  NumberOfFMMComponents = 2
28  };
29 };
30 
34 class InductanceMatrix : public LinearOperatorBase<InductanceMatrix> {
35  // implementation of the kernel evaluation, which may be based on the
36  // information available from the superSpace
37  public:
38  InductanceMatrix() {}
39  template <class T>
40  void evaluateIntegrand_impl(
41  const T &super_space, const SurfacePoint &p1, const SurfacePoint &p2,
43  Eigen::Dynamic, Eigen::Dynamic> *intval) const {
44  auto polynomial_degree = super_space.get_polynomial_degree();
45  auto polynomial_degree_plus_one_squared =
46  (polynomial_degree + 1) * (polynomial_degree + 1);
47 
48  // get evaluation points on unit square
49  auto s = p1.segment<2>(0);
50  auto t = p2.segment<2>(0);
51 
52  // get quadrature weights
53  auto ws = p1(2);
54  auto wt = p2(2);
55 
56  // get points on geometry and tangential derivatives
57  auto x_f = p1.segment<3>(3);
58  auto x_f_dx = p1.segment<3>(6);
59  auto x_f_dy = p1.segment<3>(9);
60  auto y_f = p2.segment<3>(3);
61  auto y_f_dx = p2.segment<3>(6);
62  auto y_f_dy = p2.segment<3>(9);
63 
64  // integrand without basis functions
65  auto kernel_evaluation = evaluateKernel(x_f, y_f) * ws * wt;
66  auto integrand_vector = kernel_evaluation;
67 
68  // vector part: mulitply shape functions with integrand and add to buffer
69  super_space.addScaledVectorBasisInteraction(intval, integrand_vector, s, t,
70  x_f_dx, x_f_dy, y_f_dx, y_f_dy);
71 
72  return;
73  }
74 
78  std::complex<double> evaluateKernel(const Eigen::Vector3d &x,
79  const Eigen::Vector3d &y) const {
80  auto r = (x - y).norm();
81  return std::exp(-std::complex<double>(0., 1.) * wavenumber_ * r) / 4. /
82  BEMBEL_PI / r;
83  }
85  // setters
87  void set_wavenumber(std::complex<double> wavenumber) {
88  wavenumber_ = wavenumber;
89  }
91  // getters
93  std::complex<double> get_wavenumber() { return wavenumber_; }
94 
95  private:
96  std::complex<double> wavenumber_;
97 };
98 
99 } // namespace Bembel
100 #endif // BEMBEL_SRC_AUGMENTEDEFIE_INDUCTANCEMATRIX_HPP_
std::complex< double > evaluateKernel(const Eigen::Vector3d &x, const Eigen::Vector3d &y) const
Fundamental solution of Helmholtz/Maxwell problem.
Eigen::Matrix< double, 12, 1 > SurfacePoint
typedef of SurfacePoint
Routines for the evalutation of pointwise errors.
Definition: AnsatzSpace.hpp:14
linear operator base class. this serves as a common interface for existing linear operators.
struct containing specifications on the linear operator has to be specialized or derived for any part...