履歴 ログイン

A straight waveguide

#include <meep.hpp>
using namespace meep;

const double eps1 = 12.0;
const double eps2 = 1.0;
const double dpml = 1.0;
const double wg_width = 1.0;
const double x_center = 8.0;
const double y_center = 4.0;
const double resolution = 10;
const complex<double> freq = 0.15;
const double fwidth = 0;

double eps(const vec &p)
{
  if (p.y() > y_center - 0.5*wg_width && p.y() < y_center + 0.5*wg_width)
    return eps1;
  return eps2;
}

int main(int argc, char **argv)
{
  initialize mpi(argc, argv);
  const volume v = vol2d(2*x_center, 2*y_center, resolution);
  structure s(v, eps, pml(dpml));
  s.set_epsilon(eps, true); // averaging
  fields f(&s);
  
  f.output_hdf5(Dielectric, v.surroundings());

  continuous_src_time src(freq, fwidth);
  f.add_point_source(Ez, src, vec(x_center - 7.0, y_center + 0.0));
  while (f.time() < 200) {
    f.step();
  }
  
  f.output_hdf5(Ez, v.surroundings());

  return 0;
}

pngファイルの作成は

$ h5topng -S3 -Zc dkbluered -a yarg -A eps-000000.00.h5 -d ez.r ez-000200.00.r.h5
$ h5topng -S3 -Zc dkbluered -a yarg -A eps-000000.00.h5 -d ez.i ez-000200.00.i.h5

上記のプログラムの場合,場のデータが虚部,実部の順番で保存されるので,"-d ez.r"を付けないと虚部を用いたグラフになってしまう.Meepのホームページの図とは一致するが,libctlを用いた場合の結果と異なってしまう.

実部
ez-000200.00.r.png
虚部
ez-000200.00.i.png

戻る

最終更新時間:2011年05月13日 15時30分23秒