Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
time_harmonic_maxwell_boundary_conditions.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_time_harmonic_maxwell_boundary_conditions_h
5#define lethe_time_harmonic_maxwell_boundary_conditions_h
6
8#include <core/utilities.h>
9
10#include <deal.II/base/function.h>
11#include <deal.II/base/parameter_handler.h>
12#include <deal.II/base/parsed_function.h>
13
14#include <map>
15#include <memory>
16#include <vector>
17
18using namespace dealii;
19
20namespace BoundaryConditions
21{
22 /// Boundary condition types of the time-harmonic Maxwell equations
33
34 /// Deprecated strings of the time-harmonic Maxwell boundary condition "type"
35 /// parameter, which remain accepted in parameter files
44
45 /**
46 * @brief This class manages the functions associated with both imposed electric
47 * and magnetic fields boundary conditions of the Time Harmonic Maxwell
48 * equations
49 */
50 template <int dim>
52 {
53 public:
54 // Electric field components
55 Functions::ParsedFunction<dim> e_x_real;
56 Functions::ParsedFunction<dim> e_y_real;
57 Functions::ParsedFunction<dim> e_z_real;
58 Functions::ParsedFunction<dim> e_x_imag;
59 Functions::ParsedFunction<dim> e_y_imag;
60 Functions::ParsedFunction<dim> e_z_imag;
61
62 /// Magnetic field components
63 Functions::ParsedFunction<dim> h_x_real;
64 Functions::ParsedFunction<dim> h_y_real;
65 Functions::ParsedFunction<dim> h_z_real;
66 Functions::ParsedFunction<dim> h_x_imag;
67 Functions::ParsedFunction<dim> h_y_imag;
68 Functions::ParsedFunction<dim> h_z_imag;
69 };
70
71 /**
72 * @brief This class manages the boundary conditions for Time Harmonic Maxwell solver.
73 * It introduces the boundary functions and declares the boundary conditions
74 * coherently.
75 */
76 template <int dim>
78 : public BoundaryConditions<TimeHarmonicMaxwellBoundaryType>
79 {
80 public:
81 /// Functions for (e_x_real, e_y_real, e_z_real, e_x_imag, e_y_imag,
82 /// e_z_imag, h_x_real, h_y_real, h_z_real, h_x_imag, h_y_imag, h_z_imag)
83 std::map<types::boundary_id,
84 std::shared_ptr<TimeHarmonicMaxwellBoundaryFunctions<dim>>>
86
87 /// The following functions are associated with both imperfect conductor
88 /// and imposed electromagnetic excitation or absorption boundary conditions
89 /// of the Time Harmonic Maxwell equations, but are parsed individually
90 /// because they will not be applied to the vector solution and will
91 /// therefore be handled manually in the solver.
92
93 // Impedance
94 std::map<types::boundary_id,
95 std::shared_ptr<Functions::ParsedFunction<dim>>>
97 std::map<types::boundary_id,
98 std::shared_ptr<Functions::ParsedFunction<dim>>>
100
101 /// Excitation
102 std::map<types::boundary_id,
103 std::shared_ptr<Functions::ParsedFunction<dim>>>
105 std::map<types::boundary_id,
106 std::shared_ptr<Functions::ParsedFunction<dim>>>
108 std::map<types::boundary_id,
109 std::shared_ptr<Functions::ParsedFunction<dim>>>
111 std::map<types::boundary_id,
112 std::shared_ptr<Functions::ParsedFunction<dim>>>
114 std::map<types::boundary_id,
115 std::shared_ptr<Functions::ParsedFunction<dim>>>
117 std::map<types::boundary_id,
118 std::shared_ptr<Functions::ParsedFunction<dim>>>
120
121 /**
122 * @brief Declare the default parameters for one time-harmonic Maxwell boundary condition.
123 *
124 * @param[in, out] prm The parameter handler object.
125 * @param[in] default_boundary_id The default mesh boundary id.
126 */
127 void
128 declare_default_entry(ParameterHandler &prm,
129 types::boundary_id default_boundary_id);
130
131 /**
132 * @brief Declare the Time Harmonic Maxwell boundary conditions
133 *
134 * @param[in, out] prm The parameter handler object.
135 * @param[in] number_of_boundary_conditions The number of boundary
136 * conditions to declare.
137 */
138 void
139 declare_parameters(ParameterHandler &prm,
140 unsigned int number_of_boundary_conditions);
141
142 /**
143 * @brief Parse the information for one time-harmonic Maxwell boundary condition.
144 *
145 * @param[in] prm The parameter handler object.
146 */
147 void
148 parse_boundary(ParameterHandler &prm);
149
150 /**
151 * @brief Parse the Time Harmonic Maxwell boundary conditions
152 *
153 * @param[in] prm The parameter handler containing the boundary
154 * conditions.
155 */
156 void
157 parse_parameters(ParameterHandler &prm);
158 };
159} // namespace BoundaryConditions
160
161
162/**
163 * @brief This class implements a boundary condition type for the Time Harmonic Maxwell equation
164 * where the electric field components are defined using individual functions
165 */
166template <int dim>
167class TimeHarmonicMaxwellElectricFieldDefined : public Function<dim>
168{
169 Functions::ParsedFunction<dim> *e_x_real;
170 Functions::ParsedFunction<dim> *e_y_real;
171 Functions::ParsedFunction<dim> *e_z_real;
172 Functions::ParsedFunction<dim> *e_x_imag;
173 Functions::ParsedFunction<dim> *e_y_imag;
174 Functions::ParsedFunction<dim> *e_z_imag;
175
176public:
177 /**
178 * @brief Initialize the electric-field boundary function with real and
179 * imaginary component functions.
180 *
181 * @param[in] p_e_x_real The parsed function for the real x-component.
182 * @param[in] p_e_y_real The parsed function for the real y-component.
183 * @param[in] p_e_z_real The parsed function for the real z-component.
184 * @param[in] p_e_x_imag The parsed function for the imaginary x-component.
185 * @param[in] p_e_y_imag The parsed function for the imaginary y-component.
186 * @param[in] p_e_z_imag The parsed function for the imaginary z-component.
187 */
189 Functions::ParsedFunction<dim> *p_e_x_real,
190 Functions::ParsedFunction<dim> *p_e_y_real,
191 Functions::ParsedFunction<dim> *p_e_z_real,
192 Functions::ParsedFunction<dim> *p_e_x_imag,
193 Functions::ParsedFunction<dim> *p_e_y_imag,
194 Functions::ParsedFunction<dim> *p_e_z_imag)
195 : Function<dim>(4 * dim)
196 , e_x_real(p_e_x_real)
197 , e_y_real(p_e_y_real)
198 , e_z_real(p_e_z_real)
199 , e_x_imag(p_e_x_imag)
200 , e_y_imag(p_e_y_imag)
201 , e_z_imag(p_e_z_imag)
202 {}
203
204 /**
205 * @brief Calculates the value of an imposed electric field equations.
206 *
207 * @param[in] point A point at which the function will be evaluated.
208 * @param[in] component The vector component of the boundary condition (0-> E
209 * x real, 1-> E y real, 2-> E z real, 3-> E x imag, 4-> E y imag, 5-> E z
210 * imag)
211 */
212 double
213 value(const Point<dim> &point, const unsigned int component) const override;
214};
215
216/**
217 * @brief This class implements a boundary condition type for the Time Harmonic Maxwell equation
218 * where the magnetic field components are defined using individual functions
219 */
220template <int dim>
221class TimeHarmonicMaxwellMagneticFieldDefined : public Function<dim>
222{
223 Functions::ParsedFunction<dim> *h_x_real;
224 Functions::ParsedFunction<dim> *h_y_real;
225 Functions::ParsedFunction<dim> *h_z_real;
226 Functions::ParsedFunction<dim> *h_x_imag;
227 Functions::ParsedFunction<dim> *h_y_imag;
228 Functions::ParsedFunction<dim> *h_z_imag;
229
230public:
231 /**
232 * @brief Initialize the magnetic-field boundary function with real and
233 * imaginary component functions.
234 *
235 * @param[in] p_h_x_real The parsed function for the real x-component.
236 * @param[in] p_h_y_real The parsed function for the real y-component.
237 * @param[in] p_h_z_real The parsed function for the real z-component.
238 * @param[in] p_h_x_imag The parsed function for the imaginary x-component.
239 * @param[in] p_h_y_imag The parsed function for the imaginary y-component.
240 * @param[in] p_h_z_imag The parsed function for the imaginary z-component.
241 */
243 Functions::ParsedFunction<dim> *p_h_x_real,
244 Functions::ParsedFunction<dim> *p_h_y_real,
245 Functions::ParsedFunction<dim> *p_h_z_real,
246 Functions::ParsedFunction<dim> *p_h_x_imag,
247 Functions::ParsedFunction<dim> *p_h_y_imag,
248 Functions::ParsedFunction<dim> *p_h_z_imag)
249 : Function<dim>(4 * dim)
250 , h_x_real(p_h_x_real)
251 , h_y_real(p_h_y_real)
252 , h_z_real(p_h_z_real)
253 , h_x_imag(p_h_x_imag)
254 , h_y_imag(p_h_y_imag)
255 , h_z_imag(p_h_z_imag)
256 {}
257
258 /**
259 * @brief Calculates the value of an imposed magnetic field equations.
260 *
261 * @param[in] point A point at which the function will be evaluated.
262 * @param[in] component The vector component of the boundary condition (6-> H
263 * x real, 7-> H y real, 8-> H z real, 9-> H x imag, 10-> H y imag, 11-> H z
264 * imag)
265 */
266 double
267 value(const Point<dim> &point, const unsigned int component) const override;
268};
269
270#endif
This class manages the boundary conditions for Time Harmonic Maxwell solver. It introduces the bounda...
std::map< types::boundary_id, std::shared_ptr< Functions::ParsedFunction< dim > > > surface_admittance_imag
void declare_default_entry(ParameterHandler &prm, types::boundary_id default_boundary_id)
Declare the default parameters for one time-harmonic Maxwell boundary condition.
std::map< types::boundary_id, std::shared_ptr< Functions::ParsedFunction< dim > > > excitation_y_imag
std::map< types::boundary_id, std::shared_ptr< Functions::ParsedFunction< dim > > > excitation_z_imag
std::map< types::boundary_id, std::shared_ptr< Functions::ParsedFunction< dim > > > excitation_z_real
std::map< types::boundary_id, std::shared_ptr< Functions::ParsedFunction< dim > > > excitation_y_real
void declare_parameters(ParameterHandler &prm, unsigned int number_of_boundary_conditions)
Declare the Time Harmonic Maxwell boundary conditions.
std::map< types::boundary_id, std::shared_ptr< Functions::ParsedFunction< dim > > > excitation_x_real
Excitation.
std::map< types::boundary_id, std::shared_ptr< Functions::ParsedFunction< dim > > > excitation_x_imag
void parse_parameters(ParameterHandler &prm)
Parse the Time Harmonic Maxwell boundary conditions.
std::map< types::boundary_id, std::shared_ptr< TimeHarmonicMaxwellBoundaryFunctions< dim > > > imposed_electromagnetic_fields
void parse_boundary(ParameterHandler &prm)
Parse the information for one time-harmonic Maxwell boundary condition.
std::map< types::boundary_id, std::shared_ptr< Functions::ParsedFunction< dim > > > surface_admittance_real
This class manages the functions associated with both imposed electric and magnetic fields boundary c...
Functions::ParsedFunction< dim > h_x_real
Magnetic field components.
TimeHarmonicMaxwellElectricFieldDefined(Functions::ParsedFunction< dim > *p_e_x_real, Functions::ParsedFunction< dim > *p_e_y_real, Functions::ParsedFunction< dim > *p_e_z_real, Functions::ParsedFunction< dim > *p_e_x_imag, Functions::ParsedFunction< dim > *p_e_y_imag, Functions::ParsedFunction< dim > *p_e_z_imag)
Initialize the electric-field boundary function with real and imaginary component functions.
double value(const Point< dim > &point, const unsigned int component) const override
Calculates the value of an imposed electric field equations.
double value(const Point< dim > &point, const unsigned int component) const override
Calculates the value of an imposed magnetic field equations.
TimeHarmonicMaxwellMagneticFieldDefined(Functions::ParsedFunction< dim > *p_h_x_real, Functions::ParsedFunction< dim > *p_h_y_real, Functions::ParsedFunction< dim > *p_h_z_real, Functions::ParsedFunction< dim > *p_h_x_imag, Functions::ParsedFunction< dim > *p_h_y_imag, Functions::ParsedFunction< dim > *p_h_z_imag)
Initialize the magnetic-field boundary function with real and imaginary component functions.
std::vector< std::pair< std::string, EnumType > > DeprecatedEnumNames
Deprecated strings of an enum parameter, each paired with the enumerator it stands for....
Definition utilities.h:765
TimeHarmonicMaxwellBoundaryType
Boundary condition types of the time-harmonic Maxwell equations.
const DeprecatedEnumNames< TimeHarmonicMaxwellBoundaryType > deprecated_time_harmonic_maxwell_boundary_type_names