Thanks Steven and colleagues for Meep!

I wrote a message to the list on 2015-04-20 about compiling Meep 1.3 on
a Debian 8 (testing) system.  Here is a revised version for Debian 8.5.
Again, I built HDF5 from sources, which are now up to version
1.10.0-patch1.  This also documents how I tested Meep with the first
three tutorial examples.

As before, I was able to compile the single threaded version ("serial",
I didn't try MPI) of Meep with two problems:

1 - "make check" failed for near2far.  I will email the                 
    log file to m...@ab-initio.mit.edu as requested.

2 - Meep's configure script did not find the HDF5 libraries.  I fixed
    this by compiling HDF5 from source, with a configure option
    suggested in a recent list message by Pavel Ivanov.

This description is detailed in the hope that it will help people who
are stuck somewhere.  There are many decisions to make about compiling
and/or installing from packages the various things Meep itself relies
on, and other tools required to use Meep.

  - Robin



This is a dual hex-core Xeon X5670 machine with Debian 8.5 which I
installed some months ago.

Low-key preliminaries:

   The system has X Windows and I am sshing to it from a Windows
   machine and using Xming for the Windows display of X windows
   programs.  To run Synaptic (package manager) like this without
   any fuss, I needed to (from non-root account and then "su -")
   add "PermitRootLogin yes" to /etc/ssh/sshd_config and restart
   the sshd server with: "/etc/init.d/ssh restart".  Then I could
   use PuTTY to log into the machine as root, and the command
   "synaptic" would bring up the GUI package manager.  (PuTTY:
   Connection > SSH > X11 > Enable X11 forwarding.)

Apart from running Synaptic, which I did as root, I did all the
following, including untargzipping the tarballs, as a mortal user, with
sudo to run "make install" commands as root.  I have not attempted to to
compile for MPI -so this is a single-threaded Meep.  This is based on
the instructions at:

  http://ab-initio.mit.edu/wiki/index.php/Meep_Installation

which was last updated on 2016-11-27, and which has only very slight
changes since I referred to it last time, with latest updates on 2015-02-13.

I used Synaptic Reload and "Mark All Upgrades" to update the system.

    (Note for newbies and myself since I tend to forget this: If
     the Installing Software dialog box seems to be stuck forever,
     click the little right-pointing arrow to the left of "Details".
     This will probably reveal some script which is waiting for the
     user to press Enter, 'q' etc.)

I had already installed the build-essential 11.7 package, which sets up
the GCC compiler and lots of other things for compiling programs in C
and C++.  (BTW, Synaptic makes Meep 1.2.1-2+b1 available.)

Since harminv's use of BLAS and LAPACK requires a Fortran compiler, I
installed (with Synaptic):

  gfortran-4.9             4.9.2-10
  libgfortran-4.9-dev      4.9.2-10


Here are some packages which were already installed, or which I
installed now:

gcc

  Some gcc packages were already installed, not counting some 4.8
  packages:

  gcc             4:4.9.2-2

  gcc-4.9         4.9.2-10
  gcc-4.9-base    4.9.2-10



BLAS
   libblas-common 1.2.20110419-10 was already installed.
   libblas3       1.2.20110419-10 was already installed.
   libblas.dev    1.2.20110419-10 I installed.


LAPACK  (search Synaptic for "liblapack".)
   liblapack3      3.5.0-4 was already installed.
   liblapack-dev   3.5.0-4 I installed.


Harminv

   Via Synaptic I could have installed 1.3.1-10, but since 1.4 is
   needed, I compiled it.  (It requires BLAS and LAPACK).

      http://ab-initio.mit.edu/wiki/index.php/Harminv_installation

         (The last change to this page was in 2005.)

   From the link at:

      http://ab-initio.mit.edu/wiki/index.php/Harminv

         (The last change to this page was in 2015-03-31.)

   I downloaded:

      http://ab-initio.mit.edu/harminv/harminv-1.4.tar.gz

   and untargzipped it to:

      /xx/meep-build/harminv/harminv-1.4/

   From there:

      ./configure

   seemed to run OK to the point of an error:

       cannot compile a simple Fortran program

   By right clicking the gfortran-4.9 item in Synaptic and selecting
   Properties > Installed files, I ascertained that the compiler was:

       /usr/bin/gfortran-4.9

   Following the instructions on the Harminv installation page, I gave
   this command instead:

      ./configure F77=/usr/bin/gfortran-4.9

   This produced the Makefile and no errors.  Then I could give the next
   command:

      make

   Next, for the installation command to run as root I want to be able
   to give this command from a non-root shell:

      sudo make install

    (See my 2015-04-20 email for how I has set up my mortal account
     a sudoer.)


GNU Guile

  Searching Synaptic for "guile" indicated that no packages with names
  including "guile" had been installed.  The minimum version for Meep
  is 1.6.  I installed:

     guile-2.0      2.0.11+1-9
     guile-2.0-libs 2.0.11+1-9
     guile-2.0-dev  2.0.11+1-9  (This brought in many other packages.)


libctl

  I installed these packages.

   libctl-dev   3.2.2-2
   libctl-doc   3.2.2-2
   libctl5      3.2.2-2



HDF5  (This is where the trouble begins . . .   I did this next set of
installations, but I suggest that you don't.  See my notes below
starting at AAA for how to compile HDF5 for uniprocessor AKA "serial"
systems, that is not MPI meep.)

  I installed:

    h5utils             1.12.1-2.1+b2

  which brought in:

    hdf5-tools          1.8.13+docs-15+deb8ul
    libhdf5-8           1.8.13+docs-15+deb8ul

  Since we want the -dev packages too, I installed:

    libhdf5-dev         1.8.13+docs-15+deb8ul

  which brought in:

    hdf5-helpers        1.8.13+docs-15+deb8ul
    libhdf5-cpp-8       1.8.13+docs-15+deb8ul
    libjpeg-dev         1:1.3.1-12
    libjpeg62-turbo-dev 1:1.3.1-12

  I have no real idea what these packages are, other than that the
  H5utils are vital for using Meep:

     http://ab-initio.mit.edu/wiki/index.php/H5utils

  I later recognized that Meep uses a shared library for the many
  HDF5 functions it typically has, and which most people want.
  This set of packages turned out to be incompatible with the Meep
  configure system.  I discuss this, and the fix for it, below.


From http://ab-initio.mit.edu/wiki/index.php/Meep_download I downloaded
meep-1.3.tar.gz and untargzipped it to:

  /xx/meep-build/meep-1.3/


and from there:

  ./configure F77=/usr/bin/gfortran-4.9

There were no errors.  Then:

  make
  sudo make install

This all went without errors, which is quite remarkable considering how
many packages are required.  Then I ran the self-tests:

  make check

The known_results test took less than 3 minutes.  (7 minutes last time,
but the machine's memory system was running slower then.)  One test -
near2far - failed.  This concerns the new feature added in 1.3:  "New
near-to-far-field functionality: given a bounding surface, automatically
computes the Fourier-transformed field in any desired grid of
'far-field' points arbitrarily far away."  As instructed, I am about
to email the test results to m...@ab-initio.mit.edu.  I will send the
file meep-1.3/tests/near2far.log.

I also dumped the help material in Meep's configure file:

  ./configure --help > configure-help.txt


However, all was not well . . .  I should be able to run the interactive
commands at the start of the tutorial:

  http://ab-initio.mit.edu/wiki/index.php/Meep_Tutorial

- - - -

(set! geometry-lattice (make lattice (size 16 8 no-size)))

(set! geometry (list
                  (make block (center 0 0) (size infinity 1 infinity)
                        (material (make dielectric (epsilon 12))))))

(set! sources (list
                 (make source
                   (src (make continuous-src (frequency 0.15)))
                   (component Ez)
                   (center -7 0))))

(set! pml-layers (list (make pml (thickness 1.0))))

(set! resolution 10)

(run-until 200
             (at-beginning output-epsilon)
             (at-end output-efield-z))

- - - -

(Control D to exit Meep.)

and have it produce a .h5 file.  However, now, it generated a message:

  creating output file "./eps-000000.00.h5"...
  meep: not compiled with HDF5, required for HDF5 output

This is the same as what happened in April 2015.  My solution to it then
was to compile HDF5 from source.  I did this again, because it worked
for me, and because my attempt to understand what Filip Dominec did to
fix the same problem in his context (automating compilation of
everything MPI and with a Python front-end for Meep) got me nowhere.


With Synaptic I uninstalled (complete removal) the following packages
listed above as the ones you probably shouldn't install:

    h5utils             1.12.1-2.1+b2
    hdf5-tools          1.8.13+docs-15+deb8ul
    libhdf5-8           1.8.13+docs-15+deb8ul
    libhdf5-dev         1.8.13+docs-15+deb8ul
    hdf5-helpers        1.8.13+docs-15+deb8ul
    libhdf5-cpp-8       1.8.13+docs-15+deb8ul
    libjpeg-dev         1:1.3.1-12
    libjpeg62-turbo-dev 1:1.3.1-12

AAA

The source is at:

  http://www.hdfgroup.org/HDF5/release/obtainsrc.html

for HDF5-1.10.0-patch1:


https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.0-patch1/src/hdf5-1.10.0-patch1.tar.gz

This is much later than the version I compiled in April 2015:
HDF5-1.8.14.  I untargzipped this to:

   /astro/meep-build/HDF5/hdf5-1.10.0-patch1/

and from there dumped the help material in HDF5's configure file:

  ./configure --help > configure-help.txt

The only other guidance I could find on using the configure file was:


https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.0-patch1/src/unpacked/release_docs/INSTALL

but I didn't need any extra guidance.


From the just-mentioned directory, I gave these commands to compile
HDF5. (This is based on what I did in April 2015):

  ./configure  --prefix=/usr/local  > configure-output-HDF5.txt
  make
  sudo make install > install-HDF5.txt

(Compilation generated hundreds of warnings.)

Now the HDF5 shared libraries and a settings file are in /usr/local/lib
as reported in install-HDF5.txt.


I have not yet tried compiling h5utils from source - maybe it will be
good enough to install the package via Synaptic again.  For now, I tried
the Meep configure command again to see if it was happy about HDF5:

  ./configure F77=/usr/bin/gfortran-4.9 > configure-output-3.txt

It only produced the first three warnings mentioned above - the warning:
"Couldn't find the HDF5 library!!" did not appear.

I compiled, installed and tested Meep:

  make
  sudo make install

Now, as explained in my April 2015 message to the list, what should be
done at this point is this next command:

  sudo ldconfig

Then continue with the tests:

  make check

This runs OK, with the same near2far failure as listed previously.

The interactive commands from the first part of the tutorial (for the
straight waveguide, as previously listed) produced two .h5 files as
expected.  The final lines from meep were:

    creating output file "./eps-000000.00.h5"...
    creating output file "./ez-000200.00.h5"...
    run 0 finished at t = 200.0 (4000 timesteps)

The next step in the tutorial involves programs from H5utils.

Rather than compile h5utils, I tried re-installing with Synaptic:

  h5utils      1.12.1-2.1+b2

which requires:

  hdf5-tools   1.8.13+docs-15+deb8ul
  libhdf5-8    1.8.13+docs-15+deb8ul

I was wary about potentially interdependent programs being a mix of
installed packages and compilations from source.  There were no obvious
problems.

After exiting Meep with control-D, I was able to complete the next two
steps of the tutorial:

   h5topng -S3 eps-000000.00.h5
   h5topng -S3 -Zc dkbluered -a yarg -A eps-000000.00.h5 ez-000200.00.h5

ez-000200.00.png looked a little different to the image in the tutorial:

http://ab-initio.mit.edu/wiki/index.php/Image:Tutorial-wvg-straight-ez-000200.00.png

It looks the same in principle, but as if the snapshot was taken when
the source was at a different phase of its sinewave cycle.  It is binary
identical to the ez-000200.00.png I produced in April 2015, about which
I wrote: "identical to a file I produced with an earlier version of Meep
in 2011."  This is pretty good going, considering that the versions of
Meep, HDF5 and I guess h5utils have all changed since 2011, and that
this version of Meep predates by more than a year the version of HDF5 I
am using.


   NOTE! There is no file for this in the examples directory of the
         Meep source code, and the file there "bend-flux.ctl", which
         is commented as being for the "transmission around a 90-degree
         waveguide bend in 2d" actually matches the third example,
         which has the title: "Transmission spectrum around a waveguide
         bend".

I copied the text from the tutorial page for the second example "A 90°
bend" and saved this as "90-degree-bend.ctl":

- - - - -

(set! geometry-lattice (make lattice (size 16 16 no-size)))
(set! geometry (list
                (make block (center -2 -3.5) (size 12 1 infinity)
                      (material (make dielectric (epsilon 12))))
                (make block (center 3.5 2) (size 1 12 infinity)
                      (material (make dielectric (epsilon 12))))))
(set! pml-layers (list (make pml (thickness 1.0))))
(set! resolution 10)
(set! sources (list
               (make source
                 (src (make continuous-src
                        (wavelength (* 2 (sqrt 12))) (width 20)))
                 (component Ez)
                 (center -7 -3.5) (size 0 1))))
(run-until 200
           (at-beginning output-epsilon)
           (to-appended "ez" (at-every 0.6 output-efield-z)))

- - - - -

I ran this:

    meep 90-degree-bend.ctl

and then gave the rest of the command lines listed in the tutorial, with
the name of the .ctl file added to the file names, since I generated
them from a .ctl file while in the tutorial they are generated from an
interactive session:

    h5ls 90-degree-bend-ez.h5

The tutorial page indicates that this should respond with:

    ez                       Dataset {161, 161, 330/Inf}

but I got:

    ez                       Dataset {160, 160, 333/Inf}

Adapting the next line of the tutorial:

    h5topng -t 0:329 -R -Zc dkbluered -a yarg -A eps-000000.00.h5 ez.h5

to the different number of images, now 333 for some reason:

    h5topng -t 0:332 -R -Zc dkbluered -a yarg -A   \
    90-degree-bend-eps-000000.00.h5                \
    90-degree-bend-ez.h5

This produced 333 .png files.  The final line of the tutorial uses a
program from the package imagemagick, which was already installed.
Again, adapting the tutorial line to my own filenames:

  90-degree-bend-ez.tnnn.png

I gave the command:

  convert 90-degree-bend-ez.t*.png 90-degree-bend-ez.gif

This produced a .gif (read only for everyone except the owner) file
which resembles that of the tutorial:

  http://ab-initio.mit.edu/wiki/images/7/7a/Tutorial-wvg-ez.gif

except that instead of the bend pointing downwards, it points upwards.
This is the same as my April 2015 experience.

After installing ffmpeg I was also able to create a .mp4 video file
(better quality than .mpg):

  convert 90-degree-bend-ez.t*.png 90-degree-bend-ez.mp4

This was read write the owner and not even readable by others.  Once I
fixed this I could play it with VLC Player on my Windows machine, and
slow it down with the '-' key or Playback > Speed.

Everything seems to be working, so far.


I ran the file which matches the 90 degree bend section of the tutorial
 meep-1.3/examples/bend-flux.ctl :

  meep bend-flux.ctl

This generated errors similar to those from HDF5 (1.8.11) reported to
this list by Léna Soun on 2016-06-01.  My errors start with:

- - - - -

HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) thread 0:
  #000: H5F.c line 579 in H5Fopen(): unable to open file
    major: File accessibilty
    minor: Unable to open file

- - - - -

This is because this .ctl file is not meant to be run like this
initially.  From the tutorial, the first run is:

  meep no-bend?=true bend-flux.ctl | tee bend0.out

and the second is:

  meep bend-flux.ctl | tee bend.out

These produced the desired text files, but I don't know enough about
Octave to try to reproduce the graph from them.  However, the numbers in
the second column of the .dat files seemed, when divided as described,
to match the "transmission" curve.





_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to