Differences

This shows you the differences between two versions of the page.

en:pwe [2013/01/24 02:41]
deinega [Eigenmodes spatial distribution]
en:pwe [2013/02/14 00:56] (current)
deinega [Waveguide modes. Supercell technique.]
Line 152: Line 152:
   int rsl=10;   int rsl=10;
   for(int i=0;i<=rsl;i++)   for(int i=0;i<=rsl;i++)
-    task.AddWaveVector(Vector_3(0,i*.5/rsl,0),str);+    task.AddWaveVector(Vector_3(0,i*.5/rsl,0));
  
   task.Calculate();   task.Calculate();
Line 179: Line 179:
  
 <code cpp> <code cpp>
 +#include "plane_wave_exp.h"
 +
 +int main(int argc,char **argv){
 +
 +  emInit(argc,argv);
 +
 +  pwExperiment task;
 +
 +  int super=15;
 +  int super_air=12;
 +  task.AddObject(emMedium(11.9),GetCylinder(Vector_3(super+.5,.5,0),Vector_3(0,0,1),.12));
 +  for(int i=0;i<super;i++){
 +    if(i>=super_air){
 +      task.AddObject(emMedium(11.9),GetCylinder(Vector_3(i+.5,.5,0),Vector_3(0,0,1),.2));
 +      task.AddObject(emMedium(11.9),GetCylinder(Vector_3(2*super-i+.5,.5,0),Vector_3(0,0,1),.2));
 +    }
 +  }
 +
 +  task.SetPolarization("TM");
 +  task.SetBandsNumber(50);
 +  task.SetMeshStepsNumber((2*super+1)*50,50);
 +  task.SetPlaneWavesNumber((2*super+1)*5,5);
 +
 +  int rsl=10;
 +  for(int i=0;i<=rsl;i++){
 +    string str="";
 +    if(i==rsl-2)
 +      str="0.4";
 +    task.AddWaveVector(Vector_3(0,i*.5/rsl,0),str);
 +  }
 +
 +  task.AddBandDistribution(7);
 +  task.AddBandDistribution(19);
 +
 +  int size=10;
 +  task.AddDetectorSet("f",0,Vector_3(2*super+1,size,0),iVector_3(10*(2*super+1),10*size,1));
 +
 +  task.Calculate();
 +
 +  return 1;
 +}
 </code> </code>
  
Line 186: Line 227:
 Default value of this parameter is empty string "" (spatial distribution will not be calculated).  Default value of this parameter is empty string "" (spatial distribution will not be calculated). 
  
-Function AddDetectorSet specifies points ('detectors') where we want to calculate eigenmode value. Syntax of this function is the same as that one used in FDTD. First parameter of AddDetectorSet is detectors name (“f” in our case). This name will be used for names of files associated with detectors. Next three parameters specify 3D grid where detectors are placed, namely, two opposite corners of the grid and number of grid steps along three directions.+Function AddDetectorSet specifies points ('detectors') where we want to calculate eigenmode value. Syntax of this function is the same as [[/en/tutorial#detectors|syntax used for FDTD simulations]]. First parameter of AddDetectorSet is detectors name (“f” in our case). This name will be used for names of files associated with detectors. Next three parameters specify 3D grid where detectors are placed, namely, two opposite corners of the grid and number of grid steps along three directions.
  
 As a result of calculation we get files 'DetectorName_WavevectorName_Bandnumber.d'. These files contain tabular data in the format x - y - z - Re(field) - Im(field) As a result of calculation we get files 'DetectorName_WavevectorName_Bandnumber.d'. These files contain tabular data in the format x - y - z - Re(field) - Im(field)
 In our 2D case of TM polarization, field corresponds to z-component of electric field E. In our 2D case of TM polarization, field corresponds to z-component of electric field E.
 Files with field spatial distribution can be plotted by gnuplot. Files with field spatial distribution can be plotted by gnuplot.
 +
 +  gnuplot> set pm3d interpolate 2,2
 +  gnuplot> set view 0,0
 +  gnuplot> cmax=4
 +  gnuplot> set palette defined (-cmax 'blue', 0 'white', cmax 'red')
 +  gnuplot> set cbrange [-cmax:cmax]
 +  gnuplot> sp [5:25] 'f0.4_7.d' u 1:2:4 w pm3d
 +
 +{{pwe:field_waveguide.png}}
 +
 +In this example we plot eigenmode corresponding to band 7 at wavevector 0.4. This is waveguide mode (it also can be seen from results for bandstructure). We choose gnuplot parameter 'cmax=4' for better color resolution (for other eigenmodes optimal value of cmax could be different). We plot real part of eigenmode <tex>{\rm Re}({\bf E})</tex>. Electric field in time is a combination of real and imaginary parts: <tex>{\rm Re}({\bf E}\exp{(i\omega t)})</tex>.
 ====== Bandstructure of 3D photonic crystals ====== ====== Bandstructure of 3D photonic crystals ======
  
 +Not ready yet.
 +If you need it urgently, just send email to Alexei Deinega.
 
/home/kintechlab/fdtd.kintechlab.com/docs/data/attic/en/pwe.1358980912.txt.gz · Last modified: 2013/01/24 02:41 by deinega     Back to top