Curl at boundaries in HCurl space

More
4 years 6 months ago #2609 by heitzmann
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 www.osapublishing.org/oe/fulltext.cfm?ur...7-23-33586&id=422813 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.
More
4 years 6 months ago #2610 by christopher
Hi,
this should be possible using skeleton integrators on that boundary.
The gridfunctions provide a gf.Other() to evaluate on the other side. See for example the DG documentation for this:

ngsolve.org/docu/latest/i-tutorials/unit-2.8-DG/DG.html

Best
Christopher
More
4 years 6 months ago #2612 by heitzmann
Thanks for the quick reply, Christopher!

I tried the skeleton argument and got a different error:
Code:
FacetLinearFormIntegrator::CalcFacetVector<complex> not implemented!in Assemble LinearForm

Just to be sure I'm not making any mistakes, this is what I'm trying:
Code:
b = ngsolve.LinearForm(fes) b += complex_constant * w.Deriv() * ngsolve.ds("gamma", skeleton=True) # Same error: # b += complex_constant * w.Other().Deriv() * ngsolve.ds("gamma", skeleton=True)

So, from the error I'm guessing this should be possible, it's just not implemented yet, right?
More
4 years 6 months ago #2615 by christopher
Yes you are right, complex facet integrators were missing. I've added calcfacetvector and calcelementmatrix methods. Please test. They are on the current master and will be in upcoming nigthly. See
github.com/NGSolve/ngsolve/commit/0fa316...542bea834c33da9a2ebd

Best
Christopher
More
4 years 6 months ago #2617 by heitzmann
Looks like it is working. Thanks for the quick implementation! I have to say, being able to use complex FE and quickly define PMLs makes everything MUCH easier than my previous implementation in FEniCS!
Time to create page: 0.112 seconds