OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
nmfie.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_NMFIE_H
19#define BEM_RWG_INTEQ_NMFIE_H
20
21#include "types.hpp"
22#include "constants.hpp"
23#include "materials.hpp"
24
26
27#include "matrix/base.hpp"
29
31
35
38
40
43
44
45namespace bem::rwg
46{
47
57template <typename MatrixType = EigenDenseMatrix<Complex>>
58class Nmfie: 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
95 MatrixType Kr;
96 assembler_.assemble(Kr, op_Kr_, k);
97
98 if (!base::flip_normals_)
99 Kr.scale(-one);
100
101 Kr.add_ax(id_matrix(), half);
102
103 return Kr;
104 }
105
106
113 MatrixType m_matrix(
114 const Float f,
115 const Material& material
116 )
117 {
118 Complex k = material.k(f);
119 Complex eps = material.eps();
120 Complex sigma = material.sigma();
121
122 MatrixType Tr;
123 assembler_.assemble(Tr, op_Tr_, k);
124
125 Tr.scale(J * two_pi * f * eps + sigma);
126
127 if (base::flip_normals_)
128 Tr.scale(-one);
129
130 return Tr;
131 }
132
133
138 MatrixType id_matrix()
139 {
141 MatrixType I;
142 assembler_.assemble(I, op_I, 0);
143 return I;
144 };
145
146
154 MatrixType exc_matrix(
155 const Float f,
156 const Material& material,
158 )
159 {
160 std::vector<Index> obs_elems_vec (base::elem_pairs_.cols());
161 EigRowVec<Index>::Map(&obs_elems_vec[0], base::elem_pairs_.row(0).size()) = base::elem_pairs_.row(0);
162
163 std::sort(obs_elems_vec.begin(), obs_elems_vec.end());
164 obs_elems_vec.erase(std::unique(obs_elems_vec.begin(), obs_elems_vec.end()), obs_elems_vec.end());
165
168
169 Complex k = material.k(f);
170 MatrixType inc (base::obs_mesh_.num_edges(), exc.num_excitations());
171 exc_assembler.assemble(inc, exc, k);
172
173 if (!base::flip_normals_)
174 inc.scale(-one);
175
176 return inc;
177 };
178
179
187 MatrixType j_projector(
188 const Float f,
189 const Material& material,
190 const PointCloud<3>& points
191 )
192 {
193 Complex k = material.k(f);
194
195 EdgeProjectorAssembler<3> proj_assembler (points, base::src_mesh_);
196
197 MatrixType K;
198 proj_assembler.assemble(K, proj_K_, k);
199
200 return K;
201 };
202
203
211 MatrixType m_projector(
212 const Float f,
213 const Material& material,
214 const PointCloud<3>& points
215 )
216 {
217 Complex k = material.k(f);
218 Complex eps = material.eps();
219 Complex sigma = material.sigma();
220
221 EdgeProjectorAssembler<3> proj_assembler (points, base::src_mesh_);
222
223 MatrixType T;
224 proj_assembler.assemble(T, proj_T_, k);
225
226 T.scale(-(J * two_pi * f * eps + sigma));
227
228 return T;
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 eps() const
Returns the permittivity.
Definition materials.hpp:64
virtual Complex k(const Float f) const
Returns the frequency-dependent complex wavenumber.
virtual Float sigma() const
Returns the electrical conductivity.
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 NMFIE.
Definition nmfie.hpp:59
MatrixType exc_matrix(const Float f, const Material &material, ExcitationBase< 3 > &exc)
Returns the excitation matrix for a given excitation operator.
Definition nmfie.hpp:154
MatrixType m_matrix(const Float f, const Material &material)
Computes the operator matrix associated with the magnetic surface current density.
Definition nmfie.hpp:113
MatrixType id_matrix()
Returns the identity operator matrix associated with the electric surface current density.
Definition nmfie.hpp:138
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 nmfie.hpp:211
MatrixType j_matrix(const Float f, const Material &material)
Computes the operator matrix associated with the electric surface current density.
Definition nmfie.hpp:88
void set_operators(const RotVectorHypersingularOp<> &op_Tr, const RotVectorDoubleLayerPvOp<> &op_Kr)
Sets custom operators for the Nmfie object.
Definition nmfie.hpp:71
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 nmfie.hpp:187
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.