next up previous contents
Next: Q-Values: Complex fields Up: Q-Values Previous: Q-Values   Contents

Q-Values: Real fields

The following macro contains the commands to evaluate the above formula for a given resonant field. This macro is contained in the file /usr/local/gd1/postprocessor-macros.
macro QValue
  pushflags, noprompt, nomenu, nomessage
  define(QValue_PATH, @path)                  # remember current section
  -base                                       # goto the base of the branch-tree
  -energy                                     # compute stored energy
      quantity= h                             # ... we dont need to compute the
      solution= @arg1                         #     energy in the electric field
      doit                                    #     -- it has to be the same
  -wlosses                                    # Wall-losses
      doit
 echo
echo *** h-Energy   is @henergy
echo *** metalpower is @metalpower
  return
  define(QValue_value, eval(2*@pi*@frequency*2*@henergy/@metalpower))
  echo *** mode number       is @arg1
  echo *** frequency         is @frequency {Hz}
  echo *** QValue            is QValue_value {1}
# echo return path is : QValue_PATH
  QValue_PATH                                 # back to where we came from ...
  undefine(QValue_PATH)
  popflags
endmacro
With the definition of the macro available, we can compute the Q-Value of the first resonant mode by saying:
   call QValue(1)
To compute the Q-values of the first five modes, we may say:
 do i= 1, 5
    call QValue(i)
 enddo