RWG basis functions#
Draft Written from harmolab/rwg/rwg1.py, harmolab/rwg/rwg2.py and harmolab/rwg/rwg5.py at commit 7c348a7; module paths updated at commit 72fb8c6. Awaiting review.
The Rao–Wilton–Glisson (RWG) functions [1] are the building blocks in which the solver writes the unknown surface current. Every other stage (the impedance matrix, the excitation vector, the currents and the fields) is expressed in them.
The idea#
A triangulated metal surface carries a current that we do not know. Instead of looking for the current at every point, we look for one number per interior edge: how much current crosses that edge.
Each interior edge \(n\) is shared by two triangles. The basis function \(\mathbf f_n\) lives only on that pair: it flows out of one triangle, \(T_n^+\), across the shared edge, and into the other one, \(T_n^-\). Everywhere else it is zero.
Two consequences make this choice work well:
the current crossing edge \(n\) is the same seen from either triangle, so the expansion has no jump of normal current between triangles, hence no spurious line charge along the edges;
what leaves \(T_n^+\) arrives in \(T_n^-\): each function carries two equal and opposite charges, spread uniformly over its two triangles.
Definition#
Let \(\ell_n\) be the length of edge \(n\), \(A_n^\pm\) the areas of \(T_n^\pm\) and \(\mathbf v_n^\pm\) the vertex of \(T_n^\pm\) that is not on edge \(n\) (its free vertex). Following Rao et al.[1]:
with \(\boldsymbol\rho_n^+ = \mathbf r - \mathbf v_n^+\) and \(\boldsymbol\rho_n^- = \mathbf v_n^- - \mathbf r\). Both point in the direction of the current, from \(T_n^+\) towards \(T_n^-\): away from \(\mathbf v_n^+\), towards \(\mathbf v_n^-\).
The surface current is approximated by a weighted sum over the \(N\) interior edges:
Finding the \(N\) coefficients \(I_n\) is what the Method of Moments does (see Method of Moments and the impedance matrix).
Properties#
Unit normal component across edge \(n\). On edge \(n\), the component of \(\boldsymbol\rho_n^+\) normal to the edge is the height \(h_n^+\) of \(T_n^+\) drawn from \(\mathbf v_n^+\), and \(2A_n^+ = \ell_n h_n^+\). The normal component of \(\mathbf f_n\) is therefore exactly 1 on both sides of the edge. The current is continuous across the edge, and \(I_n\) is the normal component of \(\mathbf J\) there (in A/m). The total current crossing the edge is \(I_n \ell_n\) (in A).
No normal component on the other four edges. On an edge of \(T_n^+\) that contains \(\mathbf v_n^+\), \(\boldsymbol\rho_n^+\) is parallel to the edge. No current leaves the pair through its outer boundary.
Constant divergence.
With the continuity equation \(\nabla_s\cdot\mathbf J = -j\omega\,\rho_s\) (time convention \(e^{j\omega t}\), the one used throughout the solver), the charge carried by \(T_n^+\) is \(-I_n\ell_n/(j\omega)\) and the charge carried by \(T_n^-\) is \(+I_n\ell_n/(j\omega)\). Their sum is zero.
Figure 4 One RWG function on a real mesh. (a) A 100 mm × 60 mm plate meshed by gmsh and processed by the
solver: 42 triangles, 55 interior edges, hence 55 basis functions. The pair \(T_n^+\) (blue) and
\(T_n^-\) (amber) of the edge closest to the centre is highlighted. (b) \(\mathbf f_n\) from
Eq. (9) (black arrows): it spreads out from \(\mathbf v_n^+\), crosses edge \(n\) and converges
to \(\mathbf v_n^-\). The coloured arrows are the vectors \(\boldsymbol\rho_n^{c\pm}\) computed by the
solver at the centroids (squares). Click the figure to open it at full size.
Generated by documentation/figure_notebooks/theory_rwg_basis_function.ipynb on solver commit 7c348a7. The notebook also checks the three properties above on this mesh: normal component 1 on edge \(n\), at most 3×10⁻¹⁶ on the outer edges, divergence equal to ±ℓₙ/Aₙ± to 10 digits.#
Symbols#
Symbol |
Meaning |
Unit |
In the code |
|---|---|---|---|
\(N\) |
number of basis functions = number of interior edges (after junction filtering) |
– |
|
\(\ell_n\) |
length of edge \(n\) |
m |
|
\(T_n^+,\ T_n^-\) |
the two triangles sharing edge \(n\) |
– |
|
\(A_n^\pm\) |
areas of \(T_n^\pm\) |
m² |
|
\(\mathbf r_n^{c\pm}\) |
centroids of \(T_n^\pm\) |
m |
|
\(\mathbf v_n^\pm\) |
free vertices of \(T_n^\pm\) (not on edge \(n\)) |
m |
found in |
\(\boldsymbol\rho_n^{c+},\ \boldsymbol\rho_n^{c-}\) |
\(\boldsymbol\rho_n^\pm\) evaluated at the centroids |
m |
|
\(I_n\) |
coefficient of \(\mathbf f_n\): normal current density across edge \(n\) |
A/m |
|
In this solver#
Theory vs. implementation
Everything above is the general RWG theory. This section describes what the code actually does, including its own conventions and choices.
Building the basis#
Triangles.get_edges() (harmolab.rwg.rwg1) lists every edge of every triangle and groups the
triangles that share it.
One basis function per pair of triangles sharing an edge. An edge shared by \(k\) triangles produces one function for each of the \(k(k-1)/2\) pairs. This is how junctions between several surfaces are represented.
Orientation. In each pair, \(T_n^+\) is the triangle that comes first in the triangle list (smaller index). The choice is arbitrary: reversing it only changes the sign of \(I_n\).
Boundary edges (one triangle) carry no basis function. The normal current is zero there, which is the correct condition on the free edge of a metal sheet.
Junction filter.
filter_complexes_jonctions()then looks at edges shared by exactly three triangles (three pairs). It removes the pairs whose two triangles carry the same label in the fourth row of the triangle array (t[3], the surface tag written byharmolab.utils.mesh.gmsh_function.extract_msh_to_mat). Edges shared by four triangles or more are left as they are.
The lengths and areas come from Edges.compute_edges_length() and
Triangles.calculate_triangles_area_and_center(). radiation_algorithm() calls them in this order:
get_edges → filter_complexes_jonctions → compute_edges_length.
The ρ vectors at the centroids#
harmolab.rwg.rwg2.Vecteurs_Rho stores, for every edge, \(\boldsymbol\rho\) at the centroids:
vecteur_rho_plus = triangles_center[:, triangles_plus] - free_vertex_plus # ρ_n^{c+} = r_n^{c+} − v_n^+
vecteur_rho_minus = free_vertex_minus - triangles_center[:, triangles_minus] # ρ_n^{c−} = v_n^− − r_n^{c−}
These centroid values are used wherever a one-point rule per triangle is enough:
Where |
What it computes with ρ at the centroids |
|---|---|
|
the current density at the centroid of each triangle, \(\mathbf J(\mathbf r^c) = \sum_n I_n\,\ell_n\,\boldsymbol\rho_n^{c\pm}/(2A_n^\pm)\), i.e. Eq. (10) evaluated at the centroids |
|
the plane-wave right-hand side \(V_m = \tfrac{\ell_m}{2}\big[\mathbf E^{\mathrm{inc}}(\mathbf r_m^{c+})\cdot\boldsymbol\rho_m^{c+} + \mathbf E^{\mathrm{inc}}(\mathbf r_m^{c-})\cdot\boldsymbol\rho_m^{c-}\big]\), the centroid rule applied to \(\int \mathbf f_m\cdot\mathbf E^{\mathrm{inc}}\,dS\) |
|
the enhanced gap source, from the projection of \(\boldsymbol\rho_m^{c\pm}\) on the excitation axis, corrected by the shift of the centroid when only part of a triangle is in the gap (see Excitations and input impedance) |
The impedance matrix does not use the centroid values. harmolab.utils.impedance.impmet evaluates
\(\mathbf r - \mathbf v_n^\pm\) at every Gauss–Dunavant node of every triangle, with the sign of
\(T_n^-\) carried by the product of edge signs (see Numerical integration and singularities).
For the fields, harmolab.utils.fields.dipole_parameters.compute_dipole_center_moment replaces each basis
function by a small dipole at the middle of its two centroids, with moment
\(\mathbf m_n = \ell_n I_n\,(\mathbf r_n^{c-} - \mathbf r_n^{c+})\) (see Radiated fields, directivity and gain).
The preprocessing (edge list, search for \(T_n^\pm\), ρ vectors at the centroids) follows the MATLAB
scripts of Makarov [2][3], from which rwg1.py and rwg2.py were
translated.
Assumptions and limits#
Infinitely thin conductors. RWG functions on a triangulated surface model a current sheet of zero thickness. A thick conductor must be meshed as a closed surface.
The mesh must be conforming. Two triangles are connected only if they share both vertices of an edge, by index. A vertex lying in the middle of a neighbour’s edge (a hanging node), or two surfaces meshed separately with duplicated nodes along their common line, give no basis function there: the current cannot cross, as if the metal were cut.
Lowest order. Inside a triangle the expansion Eq. (10) is linear and its divergence Eq. (11) is constant, so the charge is piecewise constant. Accuracy comes from mesh density. The solver’s helper
mesh_and_gap_parametersuses λ/20 by default (see Geometry and meshing).Junction filter. The removal rule above applies only to edges shared by exactly three triangles, and depends on the surface labels written in
t[3].Sign of \(I_n\) depends on the arbitrary \(T_n^\pm\) choice. Compare edge currents only between runs on the same mesh.
Where to look in the code#
harmolab.rwg.rwg1.Triangles(get_edges,calculate_triangles_area_and_center),harmolab.rwg.rwg1.Edges,harmolab.rwg.rwg1.filter_complexes_jonctions()Tests that build RWG data on synthetic meshes:
test/test_mesh_io.py,test/test_scattering_algorithm.py,harmolab/utils/quadrature/tests/
Continue#
How the RWG functions turn the EFIE into the linear system \(Z\,I = V\)
harmolab.rwgTriangles, Edges, Vecteurs_Rho: signatures, docstrings and links to the source.
What is tested, what is experimental, and the known issues.