Hi all!

First off, thanks for putting Netgen/NGSolve together! It works really well and is quite easy to use!

That said, I’m having trouble implementing the adjoint optimization method described in Optica Publishing Group for the vector wave equation in electromagnetism (HCurl space) because it needs the curl of the test function calculated at a specific internal boundary of the domain — last term in the RHS of the equation below — (22) in the paper:

[tex]\int_{\mathcal D}\left(\nabla\times V\cdot\nabla\times W - k_0^{2}n^{2}V\cdot W\right)\mathrm dx = \\varphi_\ell^{\ast}(E_m)\int_\Gamma\left(h_\ell\times\hat n\cdot W + \hat n\times j_\ell\cdot\nabla\times W\right)\mathrm ds[/tex]

I understand that w.Trace() will give me only the tangential component of the test function, so I cannot get the curl I need. On the other hand, it should be possible to get the curl calculated at the elements adjacent to the boundary in question (it might just not be continuous).

I was able to implement the curl at the boundary in FEniCS/dolfin by specifying on what side of the boundary I wanted it calculated (they use a notation like w.curl(“+”) and w.curl(“-”) to specify the side with respect to the normal).

Would something like this be at all possible in NGSolve? I could definitely help implementing it if given some directions as well.