Dear all,
after not being successful reading in ascii data using the scheme interface,
i wrote a c++ interface for it. I am now able to read in real data (such as
dielectric maps from images). However i could not manage to do the complex
amplitude modulation of a source. For a test i tried to implement a 1d
source with a parabolic phase modulation. I tried a lot of variations of the
responsible function 'one' but without any reasonable results.
It would be extremely helpful for me i anybody could help with that
particular 'return' line.

#include <meep.hpp>
using namespace meep;

double eps(const vec &p) {
  return 1.0;
}

complex<double> one(const vec &p) {

 return (1.0,(p.x()-5.0)*(p.x()-5.0)); /// THIS IS THE LINE OF INTEREST !
}

int main(int argc, char **argv) {
  initialize mpi(argc, argv); // do this even for non-MPI Meep
  double resolution = 20; // pixels per distance 20
  volume v = vol2d(10,10, resolution); // 5x10 2d cell
  structure s(v, eps, pml(1.0));
  fields f(&s);

  f.output_hdf5(Dielectric, v.surroundings());
  double freq = 0.5, fwidth = 0.1;
  continuous_src_time src(freq, fwidth);
  geometric_volume src_plane(vec(0.5,2),vec(9.5,2));
  f.add_volume_source(Ex,src,src_plane,one,1.0);

  //f.solve_cw(1e-14,100000,2);  ////what was this line? took it out, but
prog still works

  for(int i=0; i<490;i++){
  f.step();
  }
  for(int i=0; i<10;i++){
  f.step();

  f.output_hdf5(Ex, v.surroundings());
  //f.output_hdf5(D_EnergyDensity, v.surroundings());

  }
  return 0;
}







On Sat, Nov 1, 2008 at 5:19 PM, M Katzeimasack <[EMAIL PROTECTED]
> wrote:

> Hello meep users,
> i do currently have the problem that I want to give a 1d source on a 2d map
> a phase distribution that i measured experimentally. For earlier results i
> was successful in this by fitting higher order polynomials to the data, but
> as the data is fluctuating too fast now, this is not possible anymore. I
> thus need somehow to feed in the approximately 100 data points directly. I
> tried quite some time now to find something comparable on the web and to
> write something myself but it does just not want to work.
> It would be great if somebody could help with this.
> Best, Moritz
>
>
_______________________________________________
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