Hi,

I'm quite new to meep and I've been using it to try to model the
behaviour of a waveguide. To test the simulation I have been trying to
show that the waveguide has a cut off frequency. So, I have been
calculating % energy transmission between a volume containing the
source and the waveguide. Something seems to be going wrong as the
transmission %s for any odd frequencies (In GHz not meep units) are
the same, as are the %s for any even frequencies separated by 4GHz.
Could you please give me some pointers as to where I may be going
wrong. My C++ file is below.

Thanks,
Rachel Thompson

#include <stdlib.h>
#include <meep/vec.hpp>
#include <meep.hpp>
#include <iostream>
#include <fstream>
using namespace meep;

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

const double pml_t=1.0;

int main(int argc, char** argv) {
     initialize mpi(argc, argv);
     const double amillim = 6.0;
     double ratio=0.0, comprat=0.0, intfe=0.0;
     ofstream myfile;
     myfile.open("energyplot.txt");
     volume v=vol3d(12.63,6.29,60.68,amillim);
     volume vc=vol3d(13.0,13.0,13.0,amillim);
     v.shift_origin(X,-1.11);
     v.shift_origin(Y,-26.13);
     v.shift_origin(Z,63.0);
     structure s(v,eps,pml(1.0));
     structure sc(vc,eps,pml(0.0));
     fields f(&sc);
     fields fw(&s);
     const double freq =264.0;
     gaussian_src_time src(freq, 1.0, 0.0, 2);
     f.add_point_source(Ex,src,vec(6.0,2.0,2.0));
     f.output_hdf5(Dielectric,v.surroundings());
     f.output_hdf5(Dielectric,vc.surroundings());
     myfile<<"Current Frequency in Meep Units: "<<freq<<"\n";
     myfile<<"Time       Current     Initial /n";
     while (f.time() < f.last_source_time()) f.step();
     double curr_time = f.time();
     intfe=f.electric_energy_in_box(vc.interior());
     while (f.time() < curr_time + 18.0) {
         double fyi=f.electric_energy_in_box(vc.interior());
         ratio=(((f.electric_energy_in_box(v.interior()))/fyi)*100);
         comprat=((f.electric_energy_in_box(v.interior()))/intfe)*100;
         myfile<<f.time()<<"       "<<ratio<<"        "<<comprat<<"\n";
         f.step();
     }
     myfile.close();
     return (EXIT_SUCCESS);
}


----- End forwarded message -----


_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to