Logo Search packages:      
Sourcecode: necpp version File versions  Download package

void nec_context::gfld ( nec_float  rho,
nec_float  phi,
nec_float  rz,
nec_complex *  eth,
nec_complex *  epi,
nec_complex *  erd,
bool  space_only,
nec_float  _wavelength 

gfld computes the radiated field including ground wave.

space_only Compute only the space wave (was ksymp == 1)

Definition at line 6825 of file nec_context.cpp.

References bir, c_geometry::cab, cir, c_geometry::n, c_geometry::sab, c_geometry::salp, c_geometry::segment_length, c_geometry::x, c_geometry::y, and c_geometry::z.

      int i, k;
      nec_float b, r, thet, arg, phx, phy, rx, ry, dx, dy, dz, rix, riy, rhs, rhp;
      nec_float rhx, rhy, calp, cbet, sbet, cph, sph, el, rfl, riz, thx, thy, thz;
      nec_float rxyz, rnx, rny, rnz, omega, sill, top, bot, a, too, boo, c, rr, ri;
      nec_complex cix, ciy, ciz, exa, erv;
      nec_complex ezv, erh, eph, ezh, ex, ey;
      r= sqrt( rho*rho+ rz*rz );
      if ( (space_only) || (abs(ground.zrati) > .5) || (r > 1.e5) )
            /* computation of space wave only */
            if ( rz >= 1.0e-20)
                  thet= atan( rho/ rz);
                  thet= pi()*.5;
            ffld(thet, phi, eth, epi, _wavelength);
            arg= -two_pi() * r;
            exa= nec_complex( cos( arg), sin( arg))/ r;
            *eth= *eth* exa;
            *epi= *epi* exa;
      } /* if ( (space_only) && (abs(gound.zrati) > .5) && (r > 1.e5) ) */
      /* computation of space and ground waves. */
      phx=- sin( phi);
      phy= cos( phi);
      rx= rho* phy;
      ry=- rho* phx;
      /* summation of field from individual segments */
      for( i = 0; i < m_geometry->n; i++ )
            dx= m_geometry->cab[i];
            dy= m_geometry->sab[i];
            dz= m_geometry->salp[i];
            rix= rx- m_geometry->x[i];
            riy= ry- m_geometry->y[i];
            rhs= rix* rix+ riy* riy;
            rhp= sqrt( rhs);
            if ( rhp >= 1.0e-6)
                  rhx= rix/ rhp;
                  rhy= riy/ rhp;
            calp=1.- dz* dz;
            if ( calp >= 1.0e-6)
                  calp= sqrt( calp);
                  cbet= dx/ calp;
                  sbet= dy/ calp;
                  cph= rhx* cbet+ rhy* sbet;
                  sph= rhy* cbet- rhx* sbet;
                  cph= rhx;
                  sph= rhy;
            el= pi()* m_geometry->segment_length[i];
            /* Integration of (current)*(phase factor) over segment and image for 
               constant, sine, and cosine current distributions */
            for( k = 0; k < 2; k++ )
                  rfl=- rfl;
                  riz= rz- m_geometry->z[i]* rfl;
                  rxyz= sqrt( rix* rix+ riy* riy+ riz* riz);
                  rnx= rix/ rxyz;
                  rny= riy/ rxyz;
                  rnz= riz/ rxyz;
                  omega=-( rnx* dx+ rny* dy+ rnz* dz* rfl);
                  sill= omega* el;
                  top= el+ sill;
                  bot= el- sill;
                  if ( fabs( omega) >= 1.0e-7)
                        a=2.* sin( sill)/ omega;
                        a=(2.- omega* omega* el* el/3.)* el;
                  if ( fabs( top) >= 1.0e-7)
                        too= sin( top)/ top;
                        too=1.- top* top/6.;
                  if ( fabs( bot) >= 1.0e-7)
                        boo= sin( bot)/ bot;
                        boo=1.- bot* bot/6.;
                  b= el*( boo- too);
                  c= el*( boo+ too);
                  rr= a* air[i]+ b* bii[i]+ c* cir[i];
                  ri= a* aii[i]- b* bir[i]+ c* cii[i];
                  arg= two_pi()*( m_geometry->x[i]* rnx+ m_geometry->y[i]* rny+ m_geometry->z[i]* rnz* rfl);
                  exa= nec_complex( cos( arg), sin( arg))* nec_complex( rr, ri)/two_pi();
                  if ( k != 1 )
                        ground_wave.xx1= exa;
                        ground_wave.r1= rxyz;
                        ground_wave.zmh= riz;
                  ground_wave.xx2 = exa;
                  ground_wave.r2= rxyz;
                  ground_wave.zph= riz;
            } /* for( k = 0; k < 2; k++ ) */
            /* call subroutine to compute the field */
            /* of segment including ground wave. */
            gwave( &erv, &ezv, &erh, &ezh, &eph, ground_wave);
            erh= erh* cph* calp+ erv* dz;
            eph= eph* sph* calp;
            ezh= ezh* cph* calp+ ezv* dz;
            ex= erh* rhx- eph* rhy;
            ey= erh* rhy+ eph* rhx;
            cix= cix+ ex;
            ciy= ciy+ ey;
            ciz= ciz+ ezh;
      } /* for( i = 0; i < n; i++ ) */
      arg= -two_pi() * r;
      exa= nec_complex( cos( arg), sin( arg));
      cix= cix* exa;
      ciy= ciy* exa;
      ciz= ciz* exa;
      rnx= rx/ r;
      rny= ry/ r;
      rnz= rz/ r;
      thx= rnz* phy;
      thy=- rnz* phx;
      thz=- rho/ r;
      *eth= cix* thx+ ciy* thy+ ciz* thz;
      *epi= cix* phx+ ciy* phy;
      *erd= cix* rnx+ ciy* rny+ ciz* rnz;

Generated by  Doxygen 1.6.0   Back to index