OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
aefie.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_INTEQ_AEFIE_H
19#define BEM_RWG_INTEQ_AEFIE_H
20
21#include "types.hpp"
22#include "constants.hpp"
23#include "materials.hpp"
24
26
27#include "matrix/base.hpp"
29
31
36
39
41
44
45
46namespace bem::rwg
47{
48
58template <typename MatrixType = EigenDenseMatrix<Complex>>
59class Aefie: public IntegralEquationBase<MatrixType>
60{
61
63 using base::base;
64
65public:
66
77 )
78 {
79 op_La_ = op_La;
80 op_Lp_ = op_Lp;
81 op_K_ = op_K;
82 return;
83 };
84
85
92 MatrixType j_matrix(
93 const Float f,
94 const Material& material
95 )
96 {
97 MatrixType La;
98 assm_edge_.assemble(La, op_La_, material.k(f));
99 La.scale(-J * two_pi * f * material.mu());
100 return La;
101 };
102
103
110 MatrixType rho_matrix(
111 const Float f,
112 const Material& material
113 )
114 {
115 MatrixType Dt = div_matrix(f, material);
116 MatrixType Lp = phi_matrix(f, material);
117 MatrixType DtLp;
118 DtLp.set_mat_mul(Dt, Lp);
119 return DtLp;
120 };
121
122
129 MatrixType m_matrix(
130 const Float f,
131 const Material& material
132 )
133 {
134 Complex k = material.k(f);
135
136 MatrixType K;
137 assm_edge_.assemble(K, op_K_, k);
138
139 K.scale(-one);
140 K.add_ax(id_matrix(), -half);
141
142 return K;
143 };
144
145
150 MatrixType id_matrix()
151 {
153 MatrixType Ir;
154 assm_edge_.assemble(Ir, op_Ir, 0);
155 if (base::flip_normals_)
156 Ir.scale(-one);
157 return Ir;
158 };
159
160
167 MatrixType phi_matrix(
168 const Float f,
169 const Material& material
170 )
171 {
172 MatrixType Lp;
173 assm_face_.assemble(Lp, op_Lp_, material.k(f));
174 Lp.scale(one / material.eps_eff(f));
175 return Lp;
176 };
177
178
185 MatrixType div_matrix(
186 const Float f,
187 const Material& material
188 )
189 {
191 MatrixType D, Dt;
192 assm_div_.assemble(D, op_D, 0);
193 Dt.set_transpose(D);
194 return Dt;
195 };
196
197
205 MatrixType exc_matrix(
206 const Float f,
207 const Material& material,
209 )
210 {
211 std::vector<Index> obs_elems_vec (base::elem_pairs_.cols());
212 EigRowVec<Index>::Map(&obs_elems_vec[0], base::elem_pairs_.row(0).size()) = base::elem_pairs_.row(0);
213
214 std::sort(obs_elems_vec.begin(), obs_elems_vec.end());
215 obs_elems_vec.erase(std::unique(obs_elems_vec.begin(), obs_elems_vec.end()), obs_elems_vec.end());
216
219
220 Complex k = material.k(f);
221 MatrixType inc (base::obs_mesh_.num_edges(), exc.num_excitations());
222 exc_assembler.assemble(inc, exc, k);
223
224 return inc;
225 };
226
227
235 MatrixType j_projector(
236 const Float f,
237 const Material& material,
238 const PointCloud<3>& points
239 )
240 {
241 Complex k = material.k(f);
242 Complex mu = material.mu();
243
244 EdgeProjectorAssembler<3> edge_proj_assembler (points, base::src_mesh_);
245
246 MatrixType La;
247 edge_proj_assembler.assemble(La, proj_La_, k);
248 La.scale(-J * two_pi * f * mu);
249
250 return La;
251 };
252
253
261 MatrixType rho_projector(
262 const Float f,
263 const Material& material,
264 const PointCloud<3>& points
265 )
266 {
267 Complex k = material.k(f);
268 Complex eps_eff = material.eps_eff(f);
269
270 FaceProjectorAssembler<3> face_proj_assembler (points, base::src_mesh_);
271
272 MatrixType Lp;
273 face_proj_assembler.assemble(Lp, proj_Lp_, k);
274 Lp.scale(-one / eps_eff);
275
276 return Lp;
277 };
278
279
287 MatrixType m_projector(
288 const Float f,
289 const Material& material,
290 const PointCloud<3>& points
291 )
292 {
293 Complex k = material.k(f);
294
295 EdgeProjectorAssembler<3> proj_assembler (points, base::src_mesh_);
296
297 MatrixType K;
298 proj_assembler.assemble(K, proj_K_, k);
299
300 K.scale(-one);
301
302 return K;
303 };
304
305
306protected:
307
311
315
316 EdgeOperatorAssembler assm_edge_ = EdgeOperatorAssembler(base::obs_mesh_, base::src_mesh_, base::elem_pairs_);
317 FaceOperatorAssembler assm_face_ = FaceOperatorAssembler(base::obs_mesh_, base::src_mesh_, base::elem_pairs_);
318 FaceEdgeOperatorAssembler assm_div_ = FaceEdgeOperatorAssembler(base::obs_mesh_, base::src_mesh_, base::elem_pairs_);
319
320};
321
326}
327
328#endif
Class defining a general material with a constant (zero or non-zero) electrical conductivity and real...
Definition materials.hpp:43
virtual Complex k(const Float f) const
Returns the frequency-dependent complex wavenumber.
virtual Complex eps_eff(const Float f) const
Returns the effective complex permittivity taking into account the electric conductivity.
Definition materials.hpp:78
virtual Complex mu() const
Returns the permeability.
Definition materials.hpp:98
Class defining the RWG-based AEFIE.
Definition aefie.hpp:60
MatrixType rho_matrix(const Float f, const Material &material)
Returns the operator matrix associated with the electric surface charge density.
Definition aefie.hpp:110
MatrixType j_matrix(const Float f, const Material &material)
Returns the operator matrix associated with the electric surface current density.
Definition aefie.hpp:92
MatrixType id_matrix()
Returns the identity operator matrix associated with the magnetic surface current density.
Definition aefie.hpp:150
MatrixType exc_matrix(const Float f, const Material &material, ExcitationBase< 3 > &exc)
Returns the excitation matrix for a given excitation operator.
Definition aefie.hpp:205
MatrixType rho_projector(const Float f, const Material &material, const PointCloud< 3 > &points)
Returns the projector matrix associated with the electric surface charge density.
Definition aefie.hpp:261
MatrixType j_projector(const Float f, const Material &material, const PointCloud< 3 > &points)
Returns the projector matrix associated with the electric surface current density.
Definition aefie.hpp:235
void set_operators(const VectorSingleLayerOp<> &op_La, const ScalarSingleLayerOp<> &op_Lp, const VectorDoubleLayerPvOp<> &op_K)
Sets custom operators for the Aefie object.
Definition aefie.hpp:73
MatrixType m_projector(const Float f, const Material &material, const PointCloud< 3 > &points)
Returns the projector matrix associated with the magnetic surface current density.
Definition aefie.hpp:287
MatrixType m_matrix(const Float f, const Material &material)
Returns the operator matrix associated with the magnetic surface current density.
Definition aefie.hpp:129
MatrixType phi_matrix(const Float f, const Material &material)
Returns the intermediate operator matrix associated with the electric surface charge density.
Definition aefie.hpp:167
MatrixType div_matrix(const Float f, const Material &material)
Returns the divergence matrix.
Definition aefie.hpp:185
Class for computing the discrete divergence matrix for RWG functions.
Definition incidence.hpp:48
Class for generating excitation matrices for RWG-based BEM systems with RWG testing functions.
Class for generating operator matrices for RWG observation and source functions.
Class for generating operator matrices for pulse observation and RWG source functions.
Class for generating operator matrices for pulse observation and source functions.
Base class defining an RWG-based integral equation.
Definition base.hpp:44
void assemble(MatrixBase< Complex > &mat, OperatorType op, const Complex k)
Assembles the operator matrix for a given operator object and source and observation meshes.
Definition base.hpp:115
const Complex J
Imaginary unit.
Definition constants.hpp:40
Eigen::Matrix< T, 1, Eigen::Dynamic > EigRowVec
Dynamic-size row vector containing type T.
Definition types.hpp:90
double Float
Floating point number.
Definition types.hpp:47
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
Namespace for RWG-based BEM functionality.