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

void nec_context::efld ( nec_float  xi,
nec_float  yi,
nec_float  zi,
nec_float  ai,
bool  not_on_source_segment 
) [private]

Compute near E-fields of a segment due to constant sine and cosine currents distributions. The ground effect is included.

Parameters:
xi,yi,zi x,y,z components of the field evaluation point.
ai Radius of the segment on which the field is evaluated.
on_source_segment Flag to indicate if the field evaluation point is not on the source segment (i != j)

Definition at line 3149 of file nec_context.cpp.

References rom2().

Referenced by nefld().

{
      #define     txk   egnd[0]
      #define     tyk   egnd[1]
      #define     tzk   egnd[2]
      #define     txs   egnd[3]
      #define     tys   egnd[4]
      #define     tzs   egnd[5]
      #define     txc   egnd[6]
      #define     tyc   egnd[7]
      #define     tzc   egnd[8]
      
      nec_float salpr, zij, zp, rhox;
      nec_float rhoy, rhoz, rh, r, rmag, cth, px, py;
      nec_float xymag, xspec, yspec, rhospc, dmin, shaf;
      nec_complex epx, epy, refs, refps, zrsin, zratx, zscrn;
      nec_complex tezs, ters, tezc, terc, tezk, terk;
      complex_array egnd(9);
      
      nec_float xij = xi - xj;
      nec_float yij = yi - yj;
      bool ijx = not_on_source_segment;
      
      {
            // calculate the direct field.
            salpr= salpj;
            zij= zi- zj;
            zp= xij* cabj+ yij* sabj+ zij* salpr;
            rhox= xij- cabj* zp;
            rhoy= yij- sabj* zp;
            rhoz= zij- salpr* zp;
      
            rh = sqrt( rhox*rhox + rhoy*rhoy + rhoz*rhoz + ai*ai);
            if ( rh <= 1.e-10)
            {
                  rhox=0.0;
                  rhoy=0.0;
                  rhoz=0.0;
            }
            else
            {
                  rhox= rhox/ rh;
                  rhoy= rhoy/ rh;
                  rhoz= rhoz/ rh;
            }
      
            /* lumped current element approx. for large separations */
            r= sqrt( zp*zp + rh*rh);
            if ( r >= rkh)
            {
                  rmag = two_pi() * r;
                  cth = zp/ r;
                  px = rh/ r;
                  txk = nec_complex( cos( rmag),- sin( rmag));
                  py= two_pi() * r* r;
                  tyk= em::impedance() * cth* txk* nec_complex(1.0,-1.0/ rmag)/ py;
                  tzk= em::impedance() * px* txk* nec_complex(1.0, rmag-1.0/ rmag)/(2.* py);
                  tezk= tyk* cth- tzk* px;
                  terk= tyk* px+ tzk* cth;
                  rmag= sin( pi()* m_s)/ pi();
                  tezc= tezk* rmag;
                  terc= terk* rmag;
                  tezk= tezk* m_s;
                  terk= terk* m_s;
                  txs=cplx_00();
                  tys=cplx_00();
                  tzs=cplx_00();
            
            } /* if ( r >= rkh) */
      
            if ( r < rkh)
            {
                  /* eksc for thin wire approx. or ekscx for extended t.w. approx. */
                  if ( m_use_exk == false)
                        eksc( m_s, zp, rh, two_pi(), ijx, &tezs, &ters, &tezc, &terc, &tezk, &terk );
                  else
                        ekscx( m_b, m_s, zp, rh, two_pi(), ijx, ind1, ind2, &tezs, &ters, &tezc, &terc, &tezk, &terk);
            
                  txs= tezs* cabj+ ters* rhox;
                  tys= tezs* sabj+ ters* rhoy;
                  tzs= tezs* salpr+ ters* rhoz;
            }
      
            txk= tezk* cabj+ terk* rhox;
            tyk= tezk* sabj+ terk* rhoy;
            tzk= tezk* salpr+ terk* rhoz;
            txc= tezc* cabj+ terc* rhox;
            tyc= tezc* sabj+ terc* rhoy;
            tzc= tezc* salpr+ terc* rhoz;
      
            exk= txk;
            eyk= tyk;
            ezk= tzk;
            exs= txs;
            eys= tys;
            ezs= tzs;
            exc= txc;
            eyc= tyc;
            ezc= tzc;
      }
      
      if (ground.present())
      {
            // Now do the reflected field...
            ijx=1;
            salpr= -salpj;
            zij= zi + zj;
            zp= xij* cabj+ yij* sabj+ zij* salpr;
            rhox= xij- cabj* zp;
            rhoy= yij- sabj* zp;
            rhoz= zij- salpr* zp;
      
            rh = sqrt( rhox*rhox + rhoy*rhoy + rhoz*rhoz + ai*ai);
            if ( rh <= 1.e-10)
            {
                  rhox=0.0;
                  rhoy=0.0;
                  rhoz=0.0;
            }
            else
            {
                  rhox= rhox/ rh;
                  rhoy= rhoy/ rh;
                  rhoz= rhoz/ rh;
            }
      
            /* lumped current element approx. for large separations */
            r= sqrt( zp*zp + rh*rh);
            if ( r >= rkh)
            {
                  rmag = two_pi() * r;
                  cth = zp/ r;
                  px = rh/ r;
                  txk = nec_complex( cos( rmag),- sin( rmag));
                  py= two_pi() * r* r;
                  tyk= em::impedance() * cth* txk* nec_complex(1.0,-1.0/ rmag)/ py;
                  tzk= em::impedance() * px* txk* nec_complex(1.0, rmag-1.0/ rmag)/(2.* py);
                  tezk= tyk* cth- tzk* px;
                  terk= tyk* px+ tzk* cth;
                  rmag= sin( pi()* m_s)/ pi();
                  tezc= tezk* rmag;
                  terc= terk* rmag;
                  tezk= tezk* m_s;
                  terk= terk* m_s;
                  txs=cplx_00();
                  tys=cplx_00();
                  tzs=cplx_00();
            
            } /* if ( r >= rkh) */
      
            if ( r < rkh)
            {
                  /* eksc for thin wire approx. or ekscx for extended t.w. approx. */
                  if ( m_use_exk == false)
                        eksc( m_s, zp, rh, two_pi(), ijx, &tezs, &ters, &tezc, &terc, &tezk, &terk );
                  else
                        ekscx( m_b, m_s, zp, rh, two_pi(), ijx, ind1, ind2, &tezs, &ters, &tezc, &terc, &tezk, &terk);
            
                  txs= tezs* cabj+ ters* rhox;
                  tys= tezs* sabj+ ters* rhoy;
                  tzs= tezs* salpr+ ters* rhoz;
            }
      
            txk= tezk* cabj+ terk* rhox;
            tyk= tezk* sabj+ terk* rhoy;
            tzk= tezk* salpr+ terk* rhoz;
            txc= tezc* cabj+ terc* rhox;
            tyc= tezc* sabj+ terc* rhoy;
            tzc= tezc* salpr+ terc* rhoz;
      
            ASSERT(ground.is_valid());
            if (ground.type_finite_reflection())
            {
                  zratx= ground.zrati;
                  rmag= r;
                  xymag= sqrt( xij* xij+ yij* yij);
            
                  /* set parameters for radial wire ground screen. */
                  if (  ground.radial_wire_count != 0)
                  {
                        xspec=( xi* zj+ zi* xj)/( zi+ zj);
                        yspec=( yi* zj+ zi* yj)/( zi+ zj);
                        rhospc= sqrt( xspec*xspec + yspec*yspec + ground.t2*ground.t2);
                  
                        if ( rhospc <= ground.scrwl)
                        {
                              zscrn= ground.m_t1* rhospc* log( rhospc/ ground.t2);
                              zratx=( zscrn* ground.zrati)/( em::impedance() * ground.zrati+ zscrn);
                        }
                  } /* if (  ground.radial_wire_count != 0) */
            
                  /* Calculation of reflection coefficients when ground is specified. */
                  if ( xymag <= 1.0e-6)
                  {
                        px=0.;
                        py=0.;
                        cth=1.;
                        zrsin=cplx_10();
                  }
                  else
                  {
                        px=- yij/ xymag;
                        py= xij/ xymag;
                        cth= zij/ rmag;
                        zrsin= sqrt(1.0 - zratx*zratx*(1.0 - cth*cth) );
                  } /* if ( xymag <= 1.0e-6) */
            
                  refs=( cth- zratx* zrsin)/( cth+ zratx* zrsin);
                  refps=-( zratx* cth- zrsin)/( zratx* cth+ zrsin);
                  refps= refps- refs;
                  epy= px* txk+ py* tyk;
                  epx= px* epy;
                  epy= py* epy;
                  txk= refs* txk+ refps* epx;
                  tyk= refs* tyk+ refps* epy;
                  tzk= refs* tzk;
                  epy= px* txs+ py* tys;
                  epx= px* epy;
                  epy= py* epy;
                  txs= refs* txs+ refps* epx;
                  tys= refs* tys+ refps* epy;
                  tzs= refs* tzs;
                  epy= px* txc+ py* tyc;
                  epx= px* epy;
                  epy= py* epy;
                  txc= refs* txc+ refps* epx;
                  tyc= refs* tyc+ refps* epy;
                  tzc= refs* tzc;
            
            } /* if (ground.type_finite_reflection()) */
            
            exk -= txk* ground.frati;
            eyk -= tyk* ground.frati;
            ezk -= tzk* ground.frati;
            exs -= txs* ground.frati;
            eys -= tys* ground.frati;
            ezs -= tzs* ground.frati;
            exc -= txc* ground.frati;
            eyc -= tyc* ground.frati;
            ezc -= tzc* ground.frati;
            
      }
      
      if (false == ground.type_sommerfeld_norton()) // (ground.iperf != 2)
            return;
      
      /* field due to ground using Sommerfeld/Norton */
      sn = norm(cabj, sabj);
      if ( sn >= 1.0e-5)
      {
            xsn= cabj/ sn;
            ysn= sabj/ sn;
      }
      else
      {
            sn=0.0;
            xsn=1.0;
            ysn=0.0;
      }
      
      /* displace observation point for thin wire approximation */
      zij= zi+ zj;
      salpr=- salpj;
      rhox= sabj* zij- salpr* yij;
      rhoy= salpr* xij- cabj* zij;
      rhoz= cabj* yij- sabj* xij;
      rh = norm(rhox, rhoy, rhoz); // rhox* rhox+ rhoy* rhoy+ rhoz* rhoz;
      
      if ( rh <= 1.e-10)
      {
            xo= xi- ai* ysn;
            yo= yi+ ai* xsn;
            zo= zi;
      }
      else
      {
            rh= ai/ sqrt( rh);
            if ( rhoz < 0.0)
                  rh=- rh;
            xo= xi+ rh* rhox;
            yo= yi+ rh* rhoy;
            zo= zi+ rh* rhoz;
      
      } /* if ( rh <= 1.e-10) */
      
      r = xij*xij + yij*yij + zij*zij;
      
      if ( r <= .95)
      {
            /* Field from interpolation is integrated over segment */
            isnor=1;
            dmin = norm(exk) + norm(eyk) + norm(ezk);
      
            dmin = 0.01* sqrt(dmin);
            shaf = 0.5* m_s;
            rom2(-shaf, shaf, egnd, dmin);
      }
      else
      {
            /* Norton field equations and lumped current element approximation */
            isnor=2;
            sflds(0., egnd);
      } /* if ( r <= .95) */
      
      if ( r > .95)
      {
            zp= xij* cabj+ yij* sabj+ zij* salpr;
            rh= r- zp* zp;
            if ( rh <= 1.e-10)
                  dmin = 0.0;
            else
                  dmin = sqrt( rh/( rh+ ai* ai));
      
            if ( dmin <= .95)
            {
                  px=1.- dmin;
                  terk=( txk* cabj+ tyk* sabj+ tzk* salpr)* px;
                  txk= dmin* txk+ terk* cabj;
                  tyk= dmin* tyk+ terk* sabj;
                  tzk= dmin* tzk+ terk* salpr;
                  ters=( txs* cabj+ tys* sabj+ tzs* salpr)* px;
                  txs= dmin* txs+ ters* cabj;
                  tys= dmin* tys+ ters* sabj;
                  tzs= dmin* tzs+ ters* salpr;
                  terc=( txc* cabj+ tyc* sabj+ tzc* salpr)* px;
                  txc= dmin* txc+ terc* cabj;
                  tyc= dmin* tyc+ terc* sabj;
                  tzc= dmin* tzc+ terc* salpr;
            }
      } /* if ( r > .95) */
      
      exk= exk+ txk;
      eyk= eyk+ tyk;
      ezk= ezk+ tzk;
      exs= exs+ txs;
      eys= eys+ tys;
      ezs= ezs+ tzs;
      exc= exc+ txc;
      eyc= eyc+ tyc;
      ezc= ezc+ tzc;
}


Generated by  Doxygen 1.6.0   Back to index