Dear Kongtao,
I think it's better to publish your questions on the mailing list so that more
people can see. There'll always be starters like you and me who needs to see
this.
This is my result.
time for set_epsilon = 0.000122943 s
creating output file "./eps-000000.00.h5"...
frequency, amplitude, qulity factor
0.319442+3.45608e-07i, -0.41515-0.96689i, -462145
Field time usage:
connnecting chunks: 0.000581054 s
time stepping: 0.253687 s
communicating: 0.0489411 s
outputting fields: 0.0719879 s
Fourier transforming: 0.00393384 s
everything else: 0.0309625 s
Elapsed run time = 0.488892 s
To be honest, my results are never exactly the same as given. I also
implemented all the scheme examples shown in the tutorials again using C++.
Most of the graphs are similar but none of my programs give exactly the same
results.
It might be machine difference of C++ compiler. Or it might be caused by a
layer of ctl language.
Best Regards,
Bin Huang (Bryan)
MIT Graduate Student '10
Computation for Design and Optimization
(+65)98947649
________________________________________
From: 朱孔涛 [[email protected]]
Sent: Tuesday, November 16, 2010 3:34 AM
To: Bin Huang
Subject: Re: [Meep-discuss] meep installation
Hi,Bin
i have run the example on the meep home page.But my output is quite
different from the given one.
The program is as follows(though i have modified some bugs,it is
basically the same as given):
#include <meep.hpp>
using namespace meep;
const double eps1 = 12.0; // epsilon of layer 1
const double eps2 = 1.0; // epsilon of layer 2
const double grating_periodicity = 1.0;
const double d1 = sqrt(eps2) / (sqrt(eps1)+sqrt(eps2)); // quarter
wave stack dimentions
const double d2 = sqrt(eps1) / (sqrt(eps1)+sqrt(eps2));
const double half_cavity_width = d2;
const int N = 5;
const double pml_thickness = 1.0;
const double z_center = half_cavity_width + N*grating_periodicity +
pml_thickness;
double eps(const vec &p)
{
vec r = p - vec(z_center);
if (abs(r.z()) < half_cavity_width)
return 1.0;
else
{
double dz = abs(r.z()) - half_cavity_width;
while (dz > grating_periodicity) dz -= grating_periodicity;
return (dz < d1) ? eps1 : eps2;
}
}
int main(int argc, char **argv)
{
initialize mpi(argc, argv);
const double amicron = 10.0;
const grid_volume vol = vol1d(2*z_center, amicron);
structure s(vol, eps, pml(pml_thickness));
fields f(&s);
const double w_midgap =
(sqrt(eps1)+sqrt(eps2))/(4*sqrt(eps1)*sqrt(eps2));
gaussian_src_time src(w_midgap, 1.0, 0.0, 5.0);
f.add_point_source(Ex, src, vol.center());
f.output_hdf5(Dielectric, vol.surroundings());
// double curr_time = f.time();
// while (f.time() < curr_time + 1/w_midgap)
// {
// f.output_hdf5(Ex, vol.surroundings());
// f.step();
// }
while (f.time() < f.last_source_time())
f.step();
int maxbands = 5;
int ttot = int(400/f.dt)+1;
complex<double> *p = new complex<double>[ttot];
complex<double> *amp = new complex<double>[maxbands];
double *freq_re = new double[maxbands];
double *freq_im = new double[maxbands];
int i = 0;
while (f.time() < f.last_source_time() + 400)
{
f.step();
p[i++] = f.get_field(Ex, vol.center());
}
int num = do_harminv(p, ttot, f.dt, 0.8*w_midgap, 1.2*w_midgap,
maxbands, amp, freq_re, freq_im);
master_printf("frequency, amplitude, qulity factor\n");
for (int i = 0; i < num; ++i)
master_printf("%0.6g%+0.6gi, %0.5g%+0.5gi, %g\n", freq_re[i],
freq_im[i], real(amp[i]), imag(amp[i]), -0.5*freq_re[i]/freq_im[i]);
return 0;
}
the given output is 3.26087e+06.But mine is 2.43075e+07
What is the output of this program on your machine?
What is your idea about this difference?Thanks.
Best regards,
--
Zhu Kongtao
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss