Bembel
SingleLayerPotential.hpp
1 // This file is part of Bembel, the higher order C++ boundary element library.
2 //
3 // Copyright (C) 2022 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 #ifndef BEMBEL_SRC_MAXWELL_SINGLELAYERPOTENTIAL_HPP_
12 #define BEMBEL_SRC_MAXWELL_SINGLELAYERPOTENTIAL_HPP_
13 
14 namespace Bembel {
15 // forward declaration of class MaxwellSingleLayerPotential in order to define
16 // traits
17 template <typename LinOp>
18 class MaxwellSingleLayerPotential;
22 template <typename LinOp>
24  typedef Eigen::VectorXcd::Scalar Scalar;
25  static constexpr int OutputSpaceDimension = 3;
26 };
27 
33 template <typename LinOp>
35  : public PotentialBase<MaxwellSingleLayerPotential<LinOp>, LinOp> {
36  // implementation of the kernel evaluation, which may be based on the
37  // information available from the superSpace
38  public:
40  Eigen::Matrix<typename PotentialReturnScalar<
42  std::complex<double>>::Scalar,
43  3, 1>
44  evaluateIntegrand_impl(const FunctionEvaluator<LinOp> &fun_ev,
45  const ElementTreeNode &element,
46  const Eigen::Vector3d &point,
47  const SurfacePoint &p) const {
48  // get evaluation points on unit square
49  auto s = p.segment<2>(0);
50 
51  // get quadrature weights
52  auto ws = p(2);
53 
54  // get points on geometry and tangential derivatives
55  auto x_f = p.segment<3>(3);
56 
57  // compute surface measures from tangential derivatives
58  auto h = element.get_h();
59 
60  // evaluate kernel
61  auto kernel = evaluateKernel(point, x_f);
62  auto kernel_gradient = evaluateKernelGrad(point, x_f);
63 
64  // assemble Galerkin solution
65  auto scalar_part = fun_ev.evaluate(element, p);
66  auto divergence_part = fun_ev.evaluateDiv(element, p);
67 
68  // integrand without basis functions, note that the surface measure
69  // disappears for the divergence
70  // auto integrand = kernel * scalar_part * ws;
71  auto integrand = (kernel * scalar_part +
72  1. / wavenumber2_ * kernel_gradient * divergence_part) *
73  ws;
74 
75  return integrand;
76  }
77 
81  std::complex<double> evaluateKernel(const Eigen::Vector3d &x,
82  const Eigen::Vector3d &y) const {
83  auto r = (x - y).norm();
84  return std::exp(-std::complex<double>(0., 1.) * wavenumber_ * r) / 4. /
85  BEMBEL_PI / r;
86  }
90  Eigen::VectorXcd evaluateKernelGrad(const Eigen::Vector3d &x,
91  const Eigen::Vector3d &y) const {
92  auto c = x - y;
93  auto r = c.norm();
94  auto r3 = r * r * r;
95  auto i = std::complex<double>(0., 1.);
96  return (std::exp(-i * wavenumber_ * r) * (-1. - i * wavenumber_ * r) / 4. /
97  BEMBEL_PI / r3) *
98  c;
99  }
101  // setters
103  void set_wavenumber(std::complex<double> wavenumber) {
104  wavenumber_ = wavenumber;
105  wavenumber2_ = wavenumber_ * wavenumber_;
106  }
108  // getters
110  std::complex<double> get_wavenumber() { return wavenumber_; }
111 
112  private:
113  std::complex<double> wavenumber_;
114  std::complex<double> wavenumber2_;
115 };
116 
117 } // namespace Bembel
118 #endif // BEMBEL_SRC_MAXWELL_SINGLELAYERPOTENTIAL_HPP_
The ElementTreeNode corresponds to an element in the element tree.
double get_h() const
getter
This class implements the specification of the integration for the single layer potential for Maxwell...
std::complex< double > evaluateKernel(const Eigen::Vector3d &x, const Eigen::Vector3d &y) const
Fundamental solution of Helmholtz problem.
Eigen::VectorXcd evaluateKernelGrad(const Eigen::Vector3d &x, const Eigen::Vector3d &y) const
Gradient of fundamental solution of Helmholtz problem.
Eigen::Matrix< double, 12, 1 > SurfacePoint
typedef of SurfacePoint
Routines for the evalutation of pointwise errors.
Definition: AnsatzSpace.hpp:14
struct containing specifications on the linear operator has to be specialized or derived for any part...
functional base class. this serves as a common interface for existing functionals.
Definition: Potential.hpp:81
Base case for specifying the return type of the potential.
Definition: Potential.hpp:36
struct containing specifications on the functional has to be specialized or derived for any particula...
Definition: Potential.hpp:28