Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Using NGSolve to solve Maxwell's equations in time-harmonic form

More
6 years 5 days ago #492 by surfer
Hello. I try to find shielding effectiveness of shielding enclosure using ngsolve.
For finite element analysis in the frequency domain, the governing wave equation can be written as: curl(1/mu*curl(E)) + k*k*E=f.
I created FES as: fes = HCurl(mesh, order=4, nograds = True, complex=True),
defined materials and constants,
defined bilinear form: a = BilinearForm(fes)
a += SymbolicBFI(1/mu*curl(u)*curl(v) + k*k*u*v).

But I don't now how to define boundary conditions and how to set the incident electric field as a plane wave.

Can anyone give me some example how to solve Maxwell's equations in time-harmonic form in NGSolve?
More
6 years 4 days ago #495 by joachim
Hi,

here is an jupyter-notebook example for solving Helmholtz with first order absorbing bc.
We choose a Gaussian beam as incoming boundary condition.

It's very similar for Maxwell:
For the complex-valued Robin boundary condition you add the term

a += SymbolicBFI( -1j * omega * u.Trace() * v.Trace(), BND)

The trace-operator u.Trace() gives you the tangential component at the boundary.

Best, Joachim
More
5 years 11 months ago - 5 years 11 months ago #501 by surfer
Joachim, thank you very much for your answer.

I try to find the total electric field in region of space. The region consists of two domains: air and metal plate. For material of plate I choose the PEC (perfect electric conductor with electrical conductivity equal to 1e30). And I don't need to culculate the field inside the plate.
There are no current sources in region. The excitation is a plane wave.

I add the complex-valued Robin boundary condition to my scrypt file, but i can't get the right result.

I try to implement something like that in the paper.

Here is my python file. What am I doing wrong?


Thank you in advance, Dmitry
Last edit: 5 years 11 months ago by surfer.
More
5 years 11 months ago #502 by joachim
you have to debug your script step by step:

visualize the incoming wave, the CoefficientFunction Einc as well as the interpolation E - is this what you expect ? (answer is on)

also don't use the nograds flag which works only for magnetostatics.

Joachim
More
5 years 11 months ago #506 by surfer
Thank you for reply, Joachim.

Yes, you are right. The incoming wave is not that I expect. I correct this. But the problem still exists.
I understand, that I do not have enough knowledge about ngsolve. That's why I deside to use more simple 2D example.
There is file scattering.py in py_tutorials folder. I tried to modify it for maxwell equations. But despite the fact that this is a simple example I did not succeed.
Now I can't find there is the problem. Two files are in attachments.
More
5 years 11 months ago #509 by surfer
I found mistake in coefficient. Now it works.
But I am not sure about PML. Is it necessary to use it in my problem? The results are diferent whith it and without.
Time to create page: 0.164 seconds