Dear Mischa,
I tried to implement a structure with polarization(only 1 point). It appears to
me that the polarizability part does not work. There is still no polarization
in the structure. I modified update_pols.cpp to print out npP[i] and opP[i] in
fields_chunks::update_pols() method.
--------------------------------------------------------------------
if (npenergy)
for (int i = 0; i < ntot; ++i) {
master_printf("npenergy: npP[%d]:%g
opP[%d]:%g\n",i,npP[i],i,opP[i]);
npenergy[i] += 0.5 * (npP[i] - opP[i]) * fE[i];
opP[i] = funinv * (cn * npP[i] + co * opP[i] + nps[i] *
fE[i]);//9.144 nps[i] should be replaced by 9.144 Sai_a*(N2-N1)
}
else
for (int i = 0; i < ntot; ++i){
master_printf("npenergy else: npP[%d]:%g
opP[%d]:%g\n",i,npP[i],i,opP[i]);
opP[i] = funinv * (cn * npP[i] + co * opP[i] + nps[i] * fE[i]);
}
--------------------------------------------------------------------
My guess is that these two lines in my own C++ program are not enough.
--------------------------------------------------------------------
s.add_polarizability(sigma1,E_stuff,1.1,1e-5);
s.add_polarizability(sigma2,E_stuff,.5,.1);
--------------------------------------------------------------------
If you did similar problems before, please share how you add polarizability to
the structure.
Attached my program:
--------------------------------------------------------------------
#include <meep.hpp>
using namespace meep;
double eps(const vec &p) {
return 2.25;
}
double sigma1(const vec&){return .5;}
double sigma2(const vec&){return 2e-5;}
const double fcen=1, df=2;
int main(int argc, char *argv[]){
initialize mpi(argc, argv);
const grid_volume vol = vol3d(0,0,0,20);
structure s(vol,eps);
s.add_polarizability(sigma1,E_stuff,1.1,1e-5);//type(Ez) will be translated
to E_stuff
s.add_polarizability(sigma2,E_stuff,.5,.1);
master_printf("^^^^^^^vol.ntot():%d^^^^^^\n",vol.ntot());
double h=1;
double tor[4][4];
for(int i=0;i<4;i++)
{
tor[i][0]=1;
tor[i][1]=1;
tor[i][2]=1;
tor[i][3]=1;
}
fields f=fields(&s,0,true,0,0,tor,h);
//fields f(&s);
continuous_src_time src(fcen,df);
f.add_point_source(Ez, src, vol.center());//center of wvg
while ( f.time() < f.last_source_time())
{
f.step();
}
}
--------------------------------------------------------------------
Best Regards,
Bin Huang (Bryan)
MIT Graduate Student '10
Computation for Design and Optimization
(+65)98947649
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss