OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
plane_wave.hpp
Go to the documentation of this file.
1// OpenBEM - Copyright (C) 2026 Shashwat Sharma
2
3// This file is part of OpenBEM.
4
5// OpenBEM is free software: you can redistribute it and/or modify it under the terms of the
6// GNU General Public License as published by the Free Software Foundation, either version 3
7// of the License, or (at your option) any later version.
8
9// You should have received a copy of the GNU General Public License along with OpenBEM.
10// If not, see <https://www.gnu.org/licenses/>.
11
12
18#ifndef BEM_RWG_EXC_PLANE_WAVE_H
19#define BEM_RWG_EXC_PLANE_WAVE_H
20
21#include <stdexcept>
22#include <memory>
23
24#include "types.hpp"
26
28
29
30namespace bem
31{
32// Forward declarations
33template <uint8_t dim> class Triangle;
34}
35
36
37namespace bem::rwg
38{
39
49template <uint8_t obs_num_dof>
50class PlaneWaveBase: public ExcitationBase<obs_num_dof>
51{
52public:
53
80 ):
81 dir_(dir.colwise().normalized()),
82 pol_(pol.colwise().normalized()),
83 pos_(pos),
84 amp_(amp),
87 ))
88 {
89 if (
90 dir_.cols() != pol_.cols() ||
91 dir_.cols() != pos_.cols() ||
92 dir_.cols() != amp.size()
93 )
94 {
95 throw std::invalid_argument(
96 "PlaneWaveBase: `dir`, `pol`, `pos`, and `amp` must have the same number of columns."
97 );
98 }
99
100 return;
101 };
102
103
108 Index num_excitations() const override { return dir_.cols(); };
109
110
111protected:
112
123 {
124 EigMatNX<Float, 3> r_diff = -pos_.col(idx).replicate(1, r_obs.cols()) + r_obs;
125 EigRowVec<Float> r_dir = dir_.col(idx).transpose() * r_diff;
126 return amp_[idx] * pol_.col(idx) * Eigen::exp(-J * k * r_dir.array()).matrix();
127 };
128
129
130 const EigMatNX<Float, 3> dir_, pol_, pos_;
131 const EigRowVec<Complex> amp_;
132 std::shared_ptr<GaussTriangleQuadrature<3>> tri_quad_;
133
134};
135
136
141{
142public:
143
144 using PlaneWaveBase<3>::PlaneWaveBase;
145
154 EigMatNX<Complex, 3> compute(const Complex k, const Triangle<3>& obs_tri) override;
155
156};
157
158
163{
164public:
165
166 using PlaneWaveBase<3>::PlaneWaveBase;
167
176 EigMatNX<Complex, 3> compute(const Complex k, const Triangle<3>& obs_tri) override;
177
178};
179
184}
185
186#ifndef BEM_LINKED
188#endif
189
190#endif
Class for Gaussian quadrature over a triangle.
Definition gauss.hpp:44
Base class for generating excitation coefficients for RWG-based BEM systems.
Definition base.hpp:45
Class for computing plane wave excitation vector coefficients when tested with rotated RWG functions.
EigMatNX< Complex, 3 > compute(const Complex k, const Triangle< 3 > &obs_tri) override
Computes the plane wave excitation coefficients when the field is tested with rotated RWG functions.
Class for computing plane wave excitation vector coefficients for RWG-based BEM systems.
PlaneWaveBase(ConstEigRef< EigMatNX< Float, 3 > > dir, ConstEigRef< EigMatNX< Float, 3 > > pol, ConstEigRef< EigMatNX< Float, 3 > > pos, ConstEigRef< EigRowVec< Complex > > amp, const uint8_t quadrature_order=4)
Constructs a PlaneWaveBase object with given plane wave parameters.
Index num_excitations() const override
Returns the number of excitations (right-hand sides) to be generated.
EigMatNX< Complex, 3 > eval(const Complex k, ConstEigRef< EigMatNX< Float, 3 > > r_obs, const Index idx=0)
Evaluates the plane wave vector field value at given observation points.
Class for computing plane wave excitation vector coefficients when tested with RWG functions.
EigMatNX< Complex, 3 > compute(const Complex k, const Triangle< 3 > &obs_tri) override
Computes the plane wave excitation coefficients when the field is tested with RWG functions.
const Complex J
Imaginary unit.
Definition constants.hpp:40
const Eigen::Ref< const EigObj > ConstEigRef
Read-only reference to an Eigen object.
Definition types.hpp:98
std::complex< Float > Complex
Complex floating point number.
Definition types.hpp:51
Eigen::Matrix< T, N, 1 > EigColVecN
Fixed-size column vector of size N containing type T.
Definition types.hpp:86
std::size_t Index
Unsigned integer type for indices and container sizes.
Definition types.hpp:54
Namespace for RWG-based BEM functionality.
Primary namespace for the OpenBEM library.
Definition constants.hpp:31