#include #include #include #include #include "superdirectivity.h" #include "sph_bessel.h" #include "jade.h" using namespace std; int main(int argc, char* argv[]) { // directivity calculation /**/ { cout.precision(15); int ni = 3, ND = 30; Real kz, wl, wv, dir; vector kR; vector eps; wl = 0.455; wv = 2*_pi/wl; sphere_ml sph(ND); // kR.push_back(2*_pi/0.455*0.07985); // eps.push_back(pow(Real(6.325),2)); // eps.push_back(Real(1)); /** kR.push_back(2*_pi*0.0486056995345798/0.455); kR.push_back(2*_pi*0.0824637171512022/0.455); kR.push_back(2*_pi*0.08645/0.455); eps.push_back(pow(Real(4.98055106546034),2)); eps.push_back(pow(Real(5.0),2)); eps.push_back(pow(Real(3.34491667760117),2)); eps.push_back(Real(1)); /**/ kR.push_back(0.023666594336234 * wv); kR.push_back(0.136411859930056 * wv); kR.push_back(0.1365 * wv); eps.push_back(pow(Real(1.0),2)); eps.push_back(pow(Real(7.97246729336805),2)); eps.push_back(pow(Real(5.17006034408423),2)); eps.push_back(Real(1)); // premittivity of the supprounding medium // dependence of the directivity from the dipole position ofstream out_dir("e:/Alexey/03 - code/data/directivity/dir.dat"); for (kz=0.01*kR[2]; kz<1.5*kR[2]; kz+=.01*kR[2]) { out_dir << kz << " " << sph.get_directivity_edipole_x(kz,kR,eps) << endl; } // single directivity evaluation kz = 2*_pi*0.299; //0.5 * (kR[0] + kR[1]); dir = sph.get_directivity_edipole_x(kz,kR,eps); cout << "directivity at position kz = " << kz << " equals to " << dir << endl; // get amplitude vector from the last directivity calculation: vector v_amp = sph.get_last_ampl(); cout << "amplitudes of e-waves (m = 1):\n"; for (int n=0; n E_par, E_perp; ofstream out_pat("e:/Alexey/03 - code/data/directivity/pat.dat"); for (Real th=0; th<361; th+=1) { E_par = sph.ampl_far(th*_pi/180, Real(0)); E_perp = sph.ampl_far(th*_pi/180, 0.5*_pi); out_pat << th+90 << " " << (norm(E_par[0])) << " " << (norm(E_perp[1])) << endl; } return 0; } /**/ /**/ /**/ // directivity optimization section /**/ { int ni = 3; // number of spherical interfaces Real kr_max = Real(1); // maximum kr Real eps_max = Real(225); // maximum epsilon sphere_ml_parallel cls_sph; // class for calculation of directivity vector vb_min, vb_max; // parameter boundaries // boundaries for all optimization parameters: vb_min.push_back(Real(0.01)); vb_max.push_back(Real(1.5)*kr_max); // dipole position for (int i=0; i(&cls_sph)); sub_population.RunOptimization(cout, reinterpret_cast(&cls_sph)); sub_population.PrintResult("directivity function "); MPI_Finalize(); return 0; } /**/ }