Hi Konstantin Ladutenko .
> Dear teacher Steven and Meep Users,
>
> I have worked with simulation in MeepC-plus-plus (2D).
>
>  I did a simulation a electric field propagation (Ez) in a waveguide (2D)
> in Meep, but I need to do a simulation a electric field intensity
> propagation (Ez*Ez) or modulo of electric field, so I would like to know
> what Meep's comand I can use to simulation a electric field intensity
> propagation in MeepC-plus-plus?.
>
> Thanks

Anexo :

#include <meep.hpp>
#include <iostream>
using namespace meep;
//********************************************************************************************
double PuntaObject(const vec &p)
{
    if ((p.x() >= -15 && p.x() <= 15) && (p.y() >= 4 && p.y() <=5 ))
    {
    return 12.0;
    }
    return 1.0;
}
//**************************************************************************
int main(int argc, char **argv)
{
    meep::initialize mpi(argc, argv);   // Do this even for non-MPI Meep
    double resolution = 10;             // pixels per distance
    const double pml_thickness = 1.0;
    const double x = 30 + pml_thickness;
    const double y = 30 + pml_thickness;

    grid_volume grid_vol = vol2d(x, y, resolution);  // 30x30 2d cell
    grid_vol.center_origin();                        // set the origin as
the center of cell

    structure strct(grid_vol, PuntaObject, pml(pml_thickness));  //
structure punta
    fields field(&strct);
    field.use_real_fields();     // this is for optimization purposes
    field.output_hdf5(Dielectric, grid_vol.surroundings());
//************************************************************************
    double freq = 0.15, fwidth = 4.0;
    double start_time = 0, end_time = 200;
    continuous_src_time src(freq, fwidth, start_time, end_time);
//************************************************************************
    field.add_point_source(Ez, src, vec(-13.0,4.5));
//***********************************************************************
    h5file *h5_file = field.open_h5file("ez", h5file::WRITE, "", true);

    while (field.time() < field.last_source_time())
    {
        field.output_hdf5( fabs(Ez), grid_vol.surroundings(), h5_file,
true, false, ""); // Electric field intensity ~ Ez*Ez
     //   field.output_hdf5( Ez*Ez, grid_vol.surroundings(), h5_file, true,
false, "");
    //   field.output_hdf5(dpwr, grid_vol.surroundings(), h5_file, true,
false, "");
        field.step();
    }
  }
//***********************************************************************
    return 0;
}

thanks
-- 
Roger Leonardo Garay Avendaño
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to