Hi Steven,

I want to calculate the extraction efficiency of spontaneous emission from a uniform high-index dielectric slab.
The parameters are the same as Fan's paper (PRL, 78, 3294).
The refraction index is 3.5 and the thickness is 0.5a. A point dipole source polarized in the x-y plane s inserted at the center of the dielectric slab.

I wrote the code below. However, I cannot get right results. Could you give me some advice? Many thanks!

BR
Jun

//////////////////////////////////////////////////////////////////////////////////////////////////////
// Replay Fan's work
// PRL Vol78, 3294, 1997

#include "meep.hpp"
using namespace meep;

//The thickness and the epsilon of the slab
const double g_h = 0.5;
const double g_eps = 12.25;

//The size of the computation cell
const double g_x = 3;
const double g_y = 3;
const double g_z = 3;

//The resolution of the computation cell
const double g_res = 50;

//The thickness of the pml
const double g_pml = 0.5;

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

double block(const vec &p) {
    if ( abs(p.z() - g_z/2.) < g_h/2. + 1e-6 ) {
        return g_eps;
    }
   
    return 1.0;
}

void exciteslab(component c) {
    volume v = vol3d(g_x, g_y, g_z, g_res);
    structure s0(v, empty, pml(g_pml));
     structure s(v, block, pml(g_pml));
    
     fields f0(&s0);    
     fields f(&s);
     f.output_hdf5(Dielectric, v.surroundings());
 
    double freq_min = 0.1;
    double freq_max = 0.9;
    int nfreq = 100;
    gaussian_src_time src((freq_min+freq_max)*0.5, 0.5/(freq_max-freq_min), 0, 5/(freq_max-freq_min));   
   
    geometric_volume flux_plane(vec(g_pml+0.1, g_pml+0.1, g_z-g_pml-0.1),
                                        vec(g_x-g_pml-0.1, g_y-g_pml-0.1, g_z-g_pml-0.1));
   
     f0.add_point_source(c, src, vec(g_x/2., g_y/2., g_z/2.), 1.0);
     f.add_point_source(c, src, vec(g_x/2., g_y/2., g_z/2.), 1.0);
    master_printf("Point sources added...\n");
   
    dft_flux ft0 = f0.add_dft_flux_plane(flux_plane, freq_min, freq_max, nfreq);
    dft_flux ft = f.add_dft_flux_plane(flux_plane, freq_min, freq_max, nfreq);
   
    master_printf("Simulating empty structure...\n");
    while (f0.time() < f0.last_source_time()) f0.step();
    while (f0.time() < f0.last_source_time()+500) f0.step();
    master_printf("Simulating uniform dielectric slab...\n");
    while (f.time() < f.last_source_time()) f.step();
    f.output_hdf5(Ez, v.surroundings());
    while (f.time() < f.last_source_time()+500) f.step();
   
    double *flux = ft.flux();
    double *flux0 = ft0.flux();
      double *T;
    T = new double[nfreq];
     for (int i=0; i<nfreq; ++i) {
           T[i] = flux[i] / flux0[i];
    }
      double dfreq = (freq_max-freq_min) / nfreq;
   
    master_printf("tranmission:, freq, T[i]\n");
     for (int i=0; i<nfreq; ++i) {
         master_printf("transmission:, %f, %f\n",freq_min+i*dfreq,T[i]);
     }
    
     delete [] flux;
     delete [] flux0;
}
    
    
int main(int argc, char **argv) {
     initialize mpi(argc, argv);
     master_printf("beginning a uniform dielectric slab transmission tests...\n");
     exciteslab(Hz);
     master_printf("finished.\n");
     return 0;
}


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

Reply via email to