Radiation boundary conditions
Boy this was a struggle! The radiation boundary condition wasn’t as easy to implement as initially thought but we managed! The most confusing part for me was the fact that there is a difference between the written scattered field and incident field in how you compute the answer.
The radiation boundary condition is a variation of the boundary condition of the third kind just like the Port boundary condition. In fact if you look at the mathematical solution they are awefully similar. The basic for of this boundary condition is something like: ∂φ/∂n + γ φ = q. In this notation the q term often contains the source terms and for the first and second order radiation boundaries I thought this was supposed to contain the incident field. But given that this term was zero for ports I could have known that I needed to set it to 0.
In the book that I consult the γ-term contained corrections for curved boundaries. I thought I could remove these for flat boundaries but in fact, the curvature term κ(r) should have been the distance from the virtual source point. With this implemented I could finally get the appropriate results!
In this update I have also had to solve limitations regarding boundary definitions. Shapely doesn’t manage curved boundaries in geometries, only polygons with flat sides. Because shapely is used to manage boolean operations I can’t manually keep track of which partial curved boundaries exist. This means that boundaries MUST be a-priori discretized even before GMSH is able to see them. As a consequence each curved boundary gets a whole series of tags.
As you can see in the gallery, this quickly becomes a mess.
As a solution to this problem I solved another implementation mistake which is that boundary condition objects don’t apply to a single boundary tag but a collection of them. Also, all boundary vertices are then stitched before being assembled during matrix assembly. This greatly simplifies the implementation of curved boundary conditions. The way you get the required tags is by using LineString objects to select multiple tags at once. The macro functions that generate curved boundaries will also return a LineString object that can be used to select this exterior.