question on pml

Hi guys,

I am trying to solve a 2D rectangular waveguide problem, domain is infinite in x-direction.
I am imposing homogeneous dirichlet bc on y-direction, and want to use pml in x-direction. I don’t know how to set up pml just in one direction

Is it easy to do? I am totally new to pml, didn’t find related demos on pml yet…

Best regards,

Hi Guosheng,

Did you take a look at the pde_tutorial/pml-directory and Perfectly Matched Layers — NGS-Py 6.2.2302 documentation ?

There are several predefined PMLs that you can set in the mesh, e.g. pml.HalfSpace or pml.Radial. The pml.HalfSpace should do the trick in your case. Please have a look at the demos and the explanation.


Hi Guosheng,
maybe have a short look at Perfectly Matched Layers — NGS-Py 6.2.2302 documentation
You would need a cartesian pml. Just set the mins and maxs so that the x values are inside the domain (where the pml should start) and the y values are outside (so that you don’t have a pml in y direction).

PS: I think the pde_tutorial/pml folder is pretty much outdated, this can be done easier by applying the complex mesh transformation to the mesh itself

Hi Christopher,

I have played with pml for Helmholtz, and it works great.
But I got some trouble turning to Maxwell.

I tried to use the same setup for the problem in pde_tutorial/pml/, by only changing finite element to Hcurl and bilinear form to curl*curl
It gave me the error:
PML not supported for diffop curl

Also, I noticed the old way:
a += BFI(‘PML_laplace’,coef=1)
stop working for pml, and the error is:
RuntimeError: please set global variable constant_table_for_FEM

Any idea how to fix this?

Thanks in advance,

The pml support boolean was missing for 2D, we added that about two weeks ago, so if you check out the most recent version it should work. Note that the visualization inside the PML domain is currently broken, so using version v.6.2.1709 you should get waves running into the pml but nothing there. I’ll let you know when the pml visualization is fixed.

Opps… the most recent version in git repository is v.6.2.1707, most recent updated is July 18, 2017

How do I get v.6.2.1709?

Hi Guosheng,

Perhaps you are still using the sourceforge repository?
We moved to github now. Try syncing from the repository of NGSolve · GitHub and you should have the most recent version available.


We moved the development from sourceforge to GitHub.

Sorry we should really place some hint on sourceforge…

Hi Christoph,

Indeed. Now I am in the latest version!
I will check the pml after installation