OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
nefie.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_NEFIE_H
19#define BEM_RWG_INTEQ_NEFIE_H
20
21#include "types.hpp"
22#include "constants.hpp"
23#include "materials.hpp"
24
26
27#include "matrix/base.hpp"
29
31
35
37
40
43
44
45namespace bem::rwg
46{
47
57template <typename MatrixType = EigenDenseMatrix<Complex>>
58class Nefie: public IntegralEquationBase<MatrixType>
59{
60
62 using base::base;
63
64public:
65
74 )
75 {
76 op_Tr_ = op_Tr;
77 op_Kr_ = op_Kr;
78 return;
79 };
80
81
88 MatrixType j_matrix(
89 const Float f,
90 const Material& material
91 )
92 {
93 Complex k = material.k(f);
94 Complex mu = material.mu();
95
96 MatrixType Tr;
97 assembler_.assemble(Tr, op_Tr_, k);
98
99 Tr.scale(J * two_pi * f * mu);
100
101 if (base::flip_normals_)
102 Tr.scale(-one);
103
104 return Tr;
105 };
106
107
114 MatrixType m_matrix(
115 const Float f,
116 const Material& material
117 )
118 {
119 Complex k = material.k(f);
120
121 MatrixType Kr;
122 assembler_.assemble(Kr, op_Kr_, k);
123
124 if (base::flip_normals_)
125 Kr.scale(-one);
126
127 Kr.add_ax(id_matrix(), -half);
128
129 return Kr;
130 };
131
132
137 MatrixType id_matrix()
138 {
140 MatrixType I;
141 assembler_.assemble(I, op_I, 0);
142 return I;
143 };
144
145
153 MatrixType exc_matrix(
154 const Float f,
155 const Material& material,
157 )
158 {
159 std::vector<Index> obs_elems_vec (base::elem_pairs_.cols());
160 EigRowVec<Index>::Map(&obs_elems_vec[0], base::elem_pairs_.row(0).size()) = base::elem_pairs_.row(0);
161
162 std::sort(obs_elems_vec.begin(), obs_elems_vec.end());
163 obs_elems_vec.erase(std::unique(obs_elems_vec.begin(), obs_elems_vec.end()), obs_elems_vec.end());
164
167
168 Complex k = material.k(f);
169 MatrixType inc (base::obs_mesh_.num_edges(), exc.num_excitations());
170 exc_assembler.assemble(inc, exc, k);
171
172 if (!base::flip_normals_)
173 inc.scale(-one);
174
175 return inc;
176 };
177
178
186 MatrixType j_projector(
187 const Float f,
188 const Material& material,
189 const PointCloud<3>& points
190 )
191 {
192 Complex k = material.k(f);
193 Complex mu = material.mu();
194
195 EdgeProjectorAssembler<3> proj_assembler (points, base::src_mesh_);
196
197 MatrixType T;
198 proj_assembler.assemble(T, proj_T_, k);
199
200 T.scale(-J * two_pi * f * mu);
201
202 return T;
203 };
204
205
213 MatrixType m_projector(
214 const Float f,
215 const Material& material,
216 const PointCloud<3>& points
217 )
218 {
219 Complex k = material.k(f);
220
221 EdgeProjectorAssembler<3> proj_assembler (points, base::src_mesh_);
222
223 MatrixType K;
224 proj_assembler.assemble(K, proj_K_, k);
225
226 K.scale(-one);
227
228 return K;
229 };
230
231
232protected:
233
236
239
240 EdgeOperatorAssembler assembler_ = EdgeOperatorAssembler(base::obs_mesh_, base::src_mesh_, base::elem_pairs_);
241
242};
243
248}
249
250#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 mu() const
Returns the permeability.
Definition materials.hpp:98
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.
Base class defining an RWG-based integral equation.
Definition base.hpp:44
Class defining the RWG-based NEFIE.
Definition nefie.hpp:59
MatrixType j_matrix(const Float f, const Material &material)
Returns the operator matrix associated with the electric surface current density.
Definition nefie.hpp:88
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 nefie.hpp:213
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 nefie.hpp:186
MatrixType m_matrix(const Float f, const Material &material)
Returns the operator matrix associated with the magnetic surface current density.
Definition nefie.hpp:114
MatrixType id_matrix()
Returns the identity operator matrix associated with the magnetic surface current density.
Definition nefie.hpp:137
MatrixType exc_matrix(const Float f, const Material &material, ExcitationBase< 3 > &exc)
Returns the excitation matrix for a given excitation operator.
Definition nefie.hpp:153
void set_operators(const RotVectorHypersingularOp<> &op_Tr, const RotVectorDoubleLayerPvOp<> &op_Kr)
Sets custom operators for the Nefie object.
Definition nefie.hpp:71
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.