履歴 ログイン

A 90° bend

#include <meep.hpp>
using namespace meep;

const double eps1 = 12.0;
const double eps2 = 1.0;
const double pml_thickness = 1.0;
const double x_center = 8.0;
const double y_center = 8.0;
const double resolution = 10;
const complex<double> freq = 0.5 / sqrt(12.0);
const double fwidth = 20;

double eps(const vec &p)
{
  if (p.x() < x_center + 4 && p.y() > y_center - 4)
    if (p.y() < y_center - 3 || p.x() > x_center + 3) 
      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(pml_thickness));
  fields f(&s);
  
  f.output_hdf5(Dielectric, v.surroundings());

  continuous_src_time src(freq, fwidth);
  geometric_volume src_line(vec(x_center - 7.0, y_center - 4.0),
			    vec(x_center - 7.0, y_center - 3.0));
  f.add_volume_source(Ez, src, src_line);
  
  h5file *ez_data = f.open_h5file("ez");
  double curr_time = f.time();
  while (f.time() < 200) {
    while (f.time() < curr_time + 0.6)
      f.step();
    f.output_hdf5(Ez, v.surroundings(), ez_data, true);
    curr_time = f.time();
  }
  delete ez_data;
  
  return 0;
}

アニメーションの作成

$ mkdir figs
$ cd figs
$ h5topng -t 0:329 -R -Zc dkbluered -a yarg -A ../eps-000000.00.h5 -d ez.r ../ez.h5
$ convert -loop 0 ez.t*.png ../ez.gif

ez.gif

戻る

最終更新時間:2009年06月26日 16時21分18秒