The code I wrote is below.

#include "meep.hpp"
using namespace meep;

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


// The center of the block
const double g_xcen = g_x/2.;
const double g_ycen = g_y/2.;
const double g_zcen = g_z/2.;

const double g_zmonitor = 3.;
//The resolution of the computation cell
const int g_res = 10;

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

// The freq range
double g_fmin = 0.1;
double g_fmax = 0.2;
int g_nfreq = 100;

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

   
void excite(const component c) {
       
    volume v = vol3d(g_x, g_y, g_z, g_res);
    gaussian_src_time src((g_fmin+g_fmax)*0.5 , 0.5/(g_fmax-g_fmin), 0, 5/(g_fmax-g_fmin));
    vec src_point(g_xcen, g_ycen, g_zcen);
                       
    geometric_volume flux_plane(vec(g_pml, g_pml, g_zmonitor), vec(g_x-g_pml, g_y-g_pml, g_zmonitor));
       
    master_printf("Simulating empty structure...\n"); 
    structure s0(v, empty, pml(g_pml), mirror(Z, v));
    trash_output_directory("empty");
    s0.set_output_directory ("empty");
    fields f0(&s0);

    master_printf("sources added...\n");
    f0.add_point_source(c, src, src_point, 1.0);
    dft_flux flux_trans0 = f0.add_dft_flux_plane(flux_plane, g_fmin, g_fmax, g_nfreq);
}

   
int main(int argc, char **argv) {
    initialize mpi(argc, argv);
    quiet = true;
    master_printf("Beginning...\n");
    component c = Hz;
    excite(c);
    master_printf("Finished.\n");
    return 0;
}

The compiler is mpiCC.

The result is:

Using MPI version 1.2, 1 processes
Beginning...
Simulating empty structure...
sources added...
*** glibc detected *** double free or corruption (!prev): 0x09788af8 ***
p0_1967:  p4_error: interrupt SIGx: 6

Then I add flux_trans0.remove().
It seems  ok.

Many thanks!

BR
Jun

_______________________________________________
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