- Thank you received: 0
Using NGSolve to solve Maxwell's equations in time-harmonic form
6 years 6 months 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?
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?
6 years 6 months ago #495
by joachim
Replied by joachim on topic Using NGSolve to solve Maxwell's equations in time-harmonic form
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
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
Attachments:
6 years 6 months ago - 6 years 6 months ago #501
by surfer
Replied by surfer on topic Using NGSolve to solve Maxwell's equations in time-harmonic form
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
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: 6 years 6 months ago by surfer.
6 years 6 months ago #502
by joachim
Replied by joachim on topic Using NGSolve to solve Maxwell's equations in time-harmonic form
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
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
6 years 6 months ago #506
by surfer
Replied by surfer on topic Using NGSolve to solve Maxwell's equations in time-harmonic form
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.
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.
Attachments:
6 years 6 months ago #509
by surfer
Replied by surfer on topic Using NGSolve to solve Maxwell's equations in time-harmonic form
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.
But I am not sure about PML. Is it necessary to use it in my problem? The results are diferent whith it and without.
Attachments:
Time to create page: 0.105 seconds