Brahmanand Jogai <jogaib@...> writes:
>
> I am trying to compile meep 1.2 for 64-bit Fedora version 17.
>
> It compiles, but "make check" fails with the PML part. The other tests seemed
> to pass. I am concerned about this error, since I am working on a 3D photonic
> crystal waveguide where the PML layer is important.
>
> I would appreciate any suggestions. Attached below is the test-suite.log
> file.
>
> --
> B. Jogai
>
> ====================================
> meep 1.2: tests/test-suite.log
> ====================================
>
> # TOTAL: 18
> # PASS: 17
> # SKIP: 0
> # XFAIL: 0
> # FAIL: 1
> # XPASS: 0
> # ERROR: 0
>
> .. contents:: :depth: 2
>
> FAIL: pml
> =========
>
> Running PML tests...
> Checking resolution convergence of 1d PML...
> refl1d:, 10, 2.33627e-07
> refl1d:, 20, 7.12962e-10
> refl1d:, 30, 2.63914e-11
> refl1d:, 40, 2.56472e-12
> refl1d:, 50, 4.18772e-13
> refl1d:, 60, 9.47246e-14
> refl1d:, 70, 2.67206e-14
> refl1d:, 80, 8.82313e-15
> passed 1d PML check.
> Checking resolution convergence of 1d PML...
> ...with conductivity 10...
> refl1d:, 10, 1.4397e-07
> refl1d:, 20, 4.91496e-10
> refl1d:, 30, 1.86466e-11
> refl1d:, 40, 1.84813e-12
> refl1d:, 50, 3.08618e-13
> refl1d:, 60, 7.15917e-14
> refl1d:, 70, 2.08266e-14
> refl1d:, 80, 7.14905e-15
> passed 1d PML check.
> Checking resolution convergence of 2d TM PML...
> refl2d:, 10, 4.64795e-08
> refl2d:, 16, 7.32927e-10
> refl2d:, 22, 5.07258e-11
> refl2d:, 28, 6.93418e-12
> passed 2d TM PML check.
> Checking resolution convergence of 2d TE PML...
> ...with conductivity 1...
> refl2d:, 10, 3.44784e-08
> refl2d:, 16, 6.69015e-10
> refl2d:, 22, 4.94277e-11
> refl2d:, 28, 7.02398e-12
> passed 2d TE PML check.
> Checking resolution convergence of 2d TE PML...
> ...with dispersion
> refl2d:, 10, 2.98824e-08
> refl2d:, 16, 7.77707e-10
> refl2d:, 22, 5.94018e-11
> refl2d:, 28, 8.70977e-12
> passed 2d TE PML check.
> Checking resolution convergence of 2d TM PML...
> ...with offdiag 0.5...
> refl2d:, 10, 3.23832e-08
> refl2d:, 16, 3.2712e-10
> refl2d:, 22, 2.65229e-11
> refl2d:, 28, 5.56608e-12
> passed 2d TM PML check.
> Checking resolution convergence of 2d TE PML...
> ...with offdiag 0.5...
> refl2d:, 10, 2.90326e-08
> refl2d:, 16, 9.9335e-11
> refl2d:, 22, 2.02097e-12
> refl2d:, 28, 4.18807e-13
> passed 2d TE PML check.
> Checking thickness convergence of 1d PML...
> refl1d:, 2, 0.235034
> meep: pml doesn't scale properly with length.
>
I found a workaround for the above problem. It seems that the assignment
prev_ft = ft;
in pml.cpp causes the g++ optimizer to break the binary due to a bug in the
compiler.
It appears that pref_ft and ft are just temporary variables for storing values
between iterations. Only ft needs to be initialized and have function scope. I
made ft static and declare prev_ft within the for scope. The resulting change
causes "make check" to pass all of its tests with
gcc version 4.7.0 20120507 (Red Hat 4.7.0-5) (GCC)
In addition, I am running Meep 1.2 on my 3D PCL waveguide with no PML or other
types of problems so far.
For anyone interested, below is a patch for Fedora 17 x86_64.
--
B. Jogai
-----------------------------------cut line---------------------------
diff -urN meep-1.2.orig/tests/pml.cpp meep-1.2/tests/pml.cpp
--- meep-1.2.orig/tests/pml.cpp 2012-07-19 21:39:54.000000000 -0400
+++ meep-1.2/tests/pml.cpp 2012-09-10 12:34:28.049604904 -0400
@@ -253,13 +253,15 @@
int pml1d_scaling(double eps(const vec &)) {
double res = 20, freq = 1.0, dpml = 0;
- complex<double> prev_ft = 0.0, ft = 0.0;
+ // complex<double> prev_ft = 0.0, ft = 0.0;
+ static complex<double> ft;
+ ft = 0.;
double refl_const = 0.0, prev_refl_const = 0.0;
master_printf("Checking thickness convergence of 1d PML...\n");
for (int i=0; i < (sizeof(realnum)==sizeof(float) ? 5 : 7); i++) {
dpml = pow(2.0,(double)i);
double sz = 2*dpml + 10.0 + dpml;
- prev_ft = ft;
+ complex<double> prev_ft = ft;
{
grid_volume gv = vol1d(sz,res);
structure s(gv, eps, (pml(2*dpml,Z,Low, Rasymp, stretch)
@@ -288,13 +290,15 @@
int pmlcyl_scaling(double eps(const vec &), int m) {
double res = 10, freq = 1.0, dpml = 0;
- complex<double> prev_ft = 0.0, ft = 0.0;
+ // complex<double> prev_ft = 0.0, ft = 0.0;
+ static complex<double> ft;
+ ft = 0.;
double refl_const = 0.0, prev_refl_const = 0.0;
master_printf("Checking thickness convergence of cylindrical PML for
m=%d...\n", m);
for (int i=0; i < 3; i++) {
dpml = pow(2.0,(double)i);
double sr = 5.0 + dpml, sz = dpml + 5.0 + dpml;
- prev_ft = ft;
+ complex<double> prev_ft = ft;
{
grid_volume gv = volcyl(sr,sz,res);
gv.center_origin();
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss