# "Ambiguity polymorfic" error in Maxwell equation with PML

**URL:** <https://community.freefem.org/t/ambiguity-polymorfic-error-in-maxwell-equation-with-pml/2619>\
**Category:** General Discussion\
**Created:** [July 21, 2023, 3:20pm UTC](https://community.freefem.org/t/ambiguity-polymorfic-error-in-maxwell-equation-with-pml/2619 "2023-07-21T15:20:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaMattoso](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ramattoso/32/499_2.png) [@RaMattoso](https://community.freefem.org/u/RaMattoso)\
**Post date:** [July 21, 2023, 3:20pm UTC](https://community.freefem.org/t/ambiguity-polymorfic-error-in-maxwell-equation-with-pml/2619/1 "2023-07-21T15:20:41Z")

</div>

Dear fellows,

I’m trying to code an electromagnetism problem using Maxwell equation in variational form (Scaterring problem) and Perfectly Matched Layer - PML (as boundary condition). Because PML is present, I have to solve the problem by components, i.e,

![pmlequation](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/3/328e0770b8b374b6380c4e682c369eebed909fb4.png)

is implementated as

```auto
varf maxwell(def(u), def(eta)) = int3d(Th)((dy(kpml312)*(dx(uy)-dy(u))+kpml312*(dyx(uy)-dyy(u))
                                       +dz(kpml213)*(dx(uz)-dz(u))+kpml213*(dzx(uz)-dzz(u)) - k^2*kpmlinv123*u)*eta
                                       +(dz(kpml123)*(dy(uz)-dz(uy))+kpml123*(dzy(uz)-dzz(uy))
                                       +dx(kpml312)*(dy(u)-dx(uy))+kpml312*(dxy(u)-dxx(uy)) - k^2*kpmlinv213*uy)*etay
                                        +(dx(kpml213)*(dz(u)-dx(uz))+kpml213*(dxz(u)-dxx(uz))
                                       +dy(kpml123)*(dz(uy)-dy(uz))+kpml123*(dyz(uy)-dzz(uz)) - k^2*kpmlinv312*uz)*etaz);

```

Looks like the rotational was correctly open in components, but at this point, I’m not sure anymore.  
The error I’m receiving is

```auto
 Warning ambiguity Polymorphic Find 2
         ( <10LinearCombI7MGauche4C_F0E> : <10LinearCombI7MGauche4C_F0E> )
         ( <10LinearCombI7MGauche4C_F0E> : <10LinearCombI7MGauche4C_F0E> )
 We have ambiguity 2
 error operator ( <10LinearCombI7MGauche4C_F0E>
         ( <10LinearCombI7MGauche4C_F0E> : <10LinearCombI7MGauche4C_F0E> )
         ( <10LinearCombI7MGauche4C_F0E> : <10LinearCombI7MGauche4C_F0E> )
 We have ambiguity 2

 Warning ambiguity Polymorphic Find 2
         ( <10LinearCombI7MGauche4C_F0E> : <10LinearCombI7MGauche4C_F0E> )
         ( <10LinearCombI7MGauche4C_F0E> : <10LinearCombI7MGauche4C_F0E> )
 We have ambiguity 2

 Error line number 83, in file main.edp, before token )

```

The problem seems to be in the part below

```auto
kpml213*(dzx(uz)-dzz(u))

```

If you guys have any suggestion of how I could solve this issue or even another form of implement PML in 3D Maxwell problems I will really appreciate!

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [July 22, 2023, 1:03am UTC](https://community.freefem.org/t/ambiguity-polymorfic-error-in-maxwell-equation-with-pml/2619/3 "2023-07-22T01:03:32Z")

</div>

Can you upload the complete file? This looks like a FF coding issue that I’ve never  
seen but curious.  
Thanks.

---

<div class="post-metadata">

**Author:** ![jsmacd](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jsmacd](https://community.freefem.org/u/jsmacd)\
**Post date:** [May 7, 2025, 12:04am UTC](https://community.freefem.org/t/ambiguity-polymorfic-error-in-maxwell-equation-with-pml/2619/4 "2025-05-07T00:04:15Z")

</div>

I was getting this error with my code recently, I had:

`convergenceRates[i] = log(LL2[i]/LL2[i+1])/(log(2));`

and to fix this, I had to write

`convergenceRates[i] = log(LL2[i]/LL2[i+1])/(log(2.0));`
