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

R/Q: Real fields

The following macro contains the commands to evaluate the above formula for a given resonant field. This macro is contained in /usr/local/gd1/postprocessor-macros.
macro rshunt
  pushflags, noprompt, nomenu, nomessage
  define(rshunt_PATH, @path)                # remember current section
  -base                                     # goto the base of the branch-tree
  -energy                                   # compute stored energy
      quantity= e                           # ... we dont need to compute the
      solution= @arg1                       #     energy in the magnetic field
      doit                                  #     -- it has to be the same
# echo *** W_e is @eenergy
  return
  -lintegral                                # accelerating voltage
      direction= z, component= z
      startpoint= (0,0, @zmin)
      length= auto
      doit
# echo *** vabs is @vabs
  return
  define(rshunt_value_a, eval(@vabs **2/(2*@pi*@frequency*(2*2*@eenergy))))
  define(rshunt_value_r, eval(@vreal**2/(2*@pi*@frequency*(2*2*@eenergy))))
  define(rshunt_value_i, eval(@vimag**2/(2*@pi*@frequency*(2*2*@eenergy))))
  echo
  echo *** mode number         is @arg1
  echo *** frequency           is @frequency {Hz}
  echo ***
  echo *** shunt impedances as computed from | U * conjg(U) | :
  echo *** Shunt Impedance/Q   is rshunt_value_a {Ohms}
  echo *** Shunt Impedance/Q/m is eval(rshunt_value_a/@length) {Ohms/m}
  echo ***
  echo *** shunt impedances as computed from | Re(U) * Re(U) | :
  echo *** Shunt Impedance/Q   is rshunt_value_r {Ohms}
  echo *** Shunt Impedance/Q/m is eval(rshunt_value_r/@length) {Ohms/m}
  echo ***
  echo *** shunt impedances as computed from | Im(U) * Im(U) | :
  echo *** Shunt Impedance/Q   is rshunt_value_i {Ohms}
  echo *** Shunt Impedance/Q/m is eval(rshunt_value_i/@length) {Ohms/m}

## echo return path is : rshunt_PATH
  rshunt_PATH                               # back to where we came from ...
  undefine(rshunt_PATH)
## echo return path is : rshunt_PATH
  popflags
endmacro