next up previous contents
Next: Computing normalized shunt impedances Up: Q-Values Previous: Q-Values: Real fields   Contents

Q-Values: Complex fields

For complex fields (computed with periodic boundary conditions), we have to integrate over the real and imaginary part separately:
macro perQValue
  pushflags, noprompt, nomenu, nomessage
  define(perQValue_PATH, @path)               # remember current section
  -base                                       # goto the base of the branch-tree
  -energy                                     # compute stored energy
      quantity= hre                           # ... we dont need to compute the
      solution= @arg1                         #     energy in the electric field
      doit                                    #     -- it has to be the same
# echo *** W_h of real part is @henergy
      define(hre_energy, @henergy)
      quantity= him
      doit
      define(him_energy, @henergy)
define(htot_energy, eval(hre_energy+him_energy) )
  -wlosses                                    # Wall-losses
      quantity= hre, doit
      define(hre_metalpower, @metalpower)
      quantity= him, doit
      define(him_metalpower, @metalpower)
      define(htot_metalpower, eval(hre_metalpower+him_metalpower))
# echo *** total h-Energy   is htot_energy
# echo *** total metalpower is htot_metalpower
  define(perQValue_value, eval(2*@pi*@frequency*2*htot_energy/htot_metalpower))
  echo
  echo *** mode number       is @arg1
  echo *** frequency         is @frequency {Hz}
  echo *** QValue            is perQValue_value {1}
# echo return path is : perQValue_PATH
  perQValue_PATH                              # back to where we came from ...
  undefine(perQValue_PATH)
  popflags
endmacro
With the definition of the macro available, we can compute the Q-Value of the first resonant mode by saying:
   call perQValue(1)
To compute the Q-values of the first five modes, we may say:
 do i= 1, 5
    call perQValue(i)
 enddo