Line data Source code
1 : // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 : // SPDX-License-Identifier: Apache-2.0
3 :
4 : #ifndef PALACE_FEM_LUMPED_ELEMENT_HPP
5 : #define PALACE_FEM_LUMPED_ELEMENT_HPP
6 :
7 : #include <memory>
8 : #include <mfem.hpp>
9 :
10 : namespace palace
11 : {
12 :
13 : //
14 : // Base class handling geometry of lumped elements for uniform and coaxial lumped port and
15 : // surface current source boundaries.
16 : //
17 : class LumpedElementData
18 : {
19 : protected:
20 : // List of all boundary attributes making up this lumped element boundary.
21 : mfem::Array<int> attr_list;
22 :
23 : public:
24 30 : LumpedElementData(const mfem::Array<int> &attr_list) : attr_list(attr_list) {}
25 0 : virtual ~LumpedElementData() = default;
26 :
27 9 : const auto &GetAttrList() const { return attr_list; }
28 :
29 : virtual double GetGeometryLength() const = 0;
30 : virtual double GetGeometryWidth() const = 0;
31 :
32 : virtual std::unique_ptr<mfem::VectorCoefficient>
33 : GetModeCoefficient(double coeff = 1.0) const = 0;
34 : };
35 :
36 : class UniformElementData : public LumpedElementData
37 : {
38 : private:
39 : // Cartesian vector specifying signed direction of incident field.
40 : mfem::Vector direction;
41 :
42 : // Lumped element length and width.
43 : double l, w;
44 :
45 : public:
46 : UniformElementData(const std::array<double, 3> &input_dir,
47 : const mfem::Array<int> &attr_list, const mfem::ParMesh &mesh);
48 :
49 126 : double GetGeometryLength() const override { return l; }
50 128 : double GetGeometryWidth() const override { return w; }
51 :
52 : std::unique_ptr<mfem::VectorCoefficient>
53 : GetModeCoefficient(double coeff = 1.0) const override;
54 : };
55 :
56 : class CoaxialElementData : public LumpedElementData
57 : {
58 : private:
59 : // Sign of incident field, +1 for +r̂, -1 for -r̂.
60 : double direction;
61 :
62 : // Origin of the coaxial annulus.
63 : mfem::Vector origin;
64 :
65 : // Outer and inner radii of coaxial annulus.
66 : double r_outer, r_inner;
67 :
68 : public:
69 : CoaxialElementData(const std::array<double, 3> &input_dir,
70 : const mfem::Array<int> &attr_list, const mfem::ParMesh &mesh);
71 :
72 0 : double GetGeometryLength() const override { return std::log(r_outer / r_inner); }
73 0 : double GetGeometryWidth() const override { return 2.0 * M_PI; }
74 :
75 : std::unique_ptr<mfem::VectorCoefficient>
76 : GetModeCoefficient(double coeff = 1.0) const override;
77 : };
78 :
79 : } // namespace palace
80 :
81 : #endif // PALACE_FEM_LUMPED_ELEMENT_HPP
|