next up previous contents
Next: Examples Up: Computing normalized shunt impedances Previous: R/Q: Real fields   Contents

R/Q: Complex fields

For complex fields, we have to evaluate separately the real part and the imaginary part of the field. This is done with the following macro:
macro perrshunt
  pushflags, noprompt, nomenu, nomessage
  define(rshunt_PATH, @path)                  # remember current section
  -base                                       # goto the base of the branch-tree
  -energy                                     # compute stored energy
      quantity= ere                           # ... we dont need to compute the
      solution= @arg1                         #     energy in the magnetic field
      doit                                    #     -- it has to be the same
# echo *** W_e of real part is @eenergy
      define(ere_energy, @eenergy)
      quantity= eim
      doit
      define(eim_energy, @eenergy)
define(etotenergy, eval(ere_energy+eim_energy) )
  return
  -lintegral                                  # accelerating voltage
      direction= z, component= z
      startpoint= (0,0, @zmin)
      length= auto
      quantity= ere, doit
# echo *** vabs of real part is @vabs
      define(V_ere_re, @vreal) define(V_ere_im, @vimag)
      quantity= eim, doit
# echo *** vabs of imaginary part is @vabs
      define(V_eim_re, @vreal) define(V_eim_im, @vimag)
  return
define(vztotre, eval(V_ere_re-V_eim_im))
define(vztotim, eval(V_ere_im+V_eim_re))
define(vztotabs, eval((vztotre**2+vztotim**2)**0.5) )
  define(rshunt_value, eval(vztotabs**2/(2*@pi*@frequency*(2*etotenergy))))
  echo
  echo *** mode number       is @arg1
  echo *** frequency         is @frequency {Hz}
  echo *** Shunt Impedance   is rshunt_value {Ohms}
  echo *** Shunt Impedance/m is eval(rshunt_value/@length) {Ohms/m}
# echo return path is : rshunt_PATH
  rshunt_PATH                                 # back to where we came from ...
  undefine(rshunt_PATH)
  popflags
endmacro