TEXT   50

YAUP Yet Another Useless Undulator Program

Guest on 12th May 2022 09:59:52 AM

  1. YAUP - Yet Another (Useless) Undulator Program   
  2. Version 1.3.1
  3.  
  4.  
  5.  
  6. MODIFICATION RECORD    
  7.  
  8. - 12/92 - Initial version (without FFTs); calculates spectral and
  9.         angular distributions of the brightness and flux through
  10.         pinholes.
  11. - 01/92 - FFT version.
  12. - 04/92 - Bugs in module EXTRCT and trajectory calculation fixed.
  13.         Added degree-of-linear-polarization calculations.
  14. - 06/92 - Add Hanning windows to reduce spectral leakage;
  15.         expert-user options; power-load calculations.
  16. - 10/92 - New input-file format.  Life is easy now.(v1.0)
  17. - 04/93 - Include particle beam sizes. (v1.1)  
  18. - 09/93 - Fix a bug in the flux calculations with finite
  19.         observation distance Some changes in the input file format.
  20.         (v1.1b)
  21. - 11/93 - Switch back to double precision variables for temp
  22.         storage. Increases RAM requirements but improves "inter
  23.         platform" reproducibility of the results. (v1.2) Check (but do
  24.         not enforce) L/R symmetry criterion. (v1.2b) More flexible
  25.         scratch file names. (v1.2c)
  26. - 12/93 - User-definable scratch file names.  Bug in spline
  27.         interpolations fixed (INTGRD). Add GNUPLOT and BASENAME. (v1.2d)
  28. - 04/94 - Fix imsc bug. Rewrite parser routines.  Now compiles and
  29.         runs on an IBM RISC/6000 cluster. (v1.3)
  30. - 04/94 - Fix minor output bugs in mode 7.  Fix integration bug in
  31.         mode 7 (v1.3.1)
  32. - 07/94 - Some adjustments to the user interface (v 1.3.2)
  33.          
  34.            
  35.            
  36. WRITTEN BY      
  37.         Boyan Boyanov
  38.         Department of Physics
  39.         Illinois Institute of Technology
  40.         boyan@tmnxt1.iit.edu
  41.  
  42. REFERENCE      
  43.         B. I. Boyanov, G. Bunker, J. M. Lee, and T. I. Morrison
  44.         "Numerical Modeling of Tapered Undulators"
  45.         Nucl. Instr. Meth. A339,  596-603, 1994
  46.  
  47.  
  48.  
  49. DISCLAIMER
  50.  
  51. \begin{legalese}
  52.  
  53. This program is freeware (but *NOT* public domain). You may freely
  54. copy and redistribute it. Permission is granted to modify the source
  55. for your own purposes but NOT to redistribute the modifications without
  56. permission of the author. If you use this program while doing scientific
  57. research please cite this program in the acknowledgments of any resulting
  58. publications.
  59.  
  60. There are absolutely no warranty on this program. The author takes no
  61. responsibility for any damage caused by this program. The author takes
  62. no responsibility for time lost if incorrect or misleading results are
  63. produced by this program. If a warranty is required by law where you
  64. intend to use this software permission to use this software there is
  65. revoked.
  66.  
  67. \end{legalese}
  68.  
  69. Now that this junk is out of the way let's get on with the fun stuff.
  70.  
  71.  
  72.  
  73. TABLE OF CONTENTS
  74.  
  75. Section I .......................  Introduction
  76. Section II ......................  Compilation Instructions
  77. Section III .....................  New Features
  78. Section IV ......................  Input File Format
  79. Section V .......................  Output File Format
  80. Section VI ......................  Program Description
  81. Section VII .....................  Hints and Suggestions (PLEASE READ)
  82. Section VIII ....................  Data File Formats
  83. Section IX ......................  "Expert" Options  
  84. Section X .......................  Further Information
  85. Appendix A ......................  Program Diagnostics
  86. Appendix B ......................  Error Messages
  87.  
  88.  
  89.  
  90. I. INTRODUCTION
  91.  
  92.         1 yawp or yaup \'yoÇp\ vi
  93.         [ME yolpen]
  94.         (14c)
  95.         1: to make a raucous noise: SQUAWK
  96.         2: CLAMOR, COMPLAIN
  97.         Ð yawp-er n
  98.  
  99.         2 yawp also yaup n
  100.         (1824)
  101.         1: a raucous noise: SQUAWK
  102.         2: something suggestive of a raucous noise; specif:
  103.            rough vigorous language
  104.  
  105.         yawp  (or yaup) vb
  106.         1  syn    SQUALL 1, caw, ||quawk, squak, squawk
  107.         2  syn    GRIPE, ||beef, ||bellyache||||bitch, bleat,
  108.                          ||blow off, crab, fuss, squawk, yammer
  109.  
  110.         Webster's Ninth New Collegiate Dictionary
  111.         Webster's Collegiate Thesaurus
  112.         First Digital Edition
  113.         Copyright (c) 1988, 1990
  114.         NeXT Computer, Inc.,
  115.         and Merriam-Webster Inc.
  116.  
  117.  
  118. YAUP (Yet Another (Useless) Undulator Program) is a program that
  119. calculates radiation patterns (spectral and angular distributions of
  120. the brightness, the flux through a pinhole, spectral and angular power
  121. distributions) and polarization properties of tapered and untapered
  122. undulator radiation. The program has the following capabilities and
  123. restrictions:
  124.  
  125. - the magnetic field B within the undulator is assumed to be a
  126.         vertically-polarized amplitude and/or frequency-modulated
  127.         sinusoid. The  B-field distribution is read in from an external
  128.         file. Random and or systematic errors in the magnitude and phase
  129.         of the field may be included.
  130.  
  131. - e-beam size and divergence may be included in a first-order
  132.         approximation as a convolution of the zero-emittance spectrum
  133.         with the e-beam distribution.
  134.  
  135. - up-down (vertical) symmetry of the angular distribution of the
  136.         brightness is always assumed but left-right (horizontal)
  137.         symmetry of the spectrum may or may not be enforced (see the
  138.         description of input parameter XSYM in sections IV and VII).
  139.  
  140. - besides tapered undulators the program may be used to calculate
  141.         distributions from untapered undulators.  These calculations,
  142.         however, are inefficient and programs designed specifically for
  143.         untapered undulators, e.g. URGENT and USER_UNDULATOR, are
  144.         usually much faster.  We recommend that the program be used for
  145.         untapered undulators at energies not higher than the fifth
  146.         harmonic only when field errors have to be accounted for (see
  147.         section VII).
  148.  
  149. -  The use of FFTs greatly enhances the performance of the program
  150.         (in terms of time needed to complete the calculation),
  151.         especially in the case of calculations in a broad spectral
  152.         range.
  153.  
  154.  
  155.  
  156. II.  COMPILATION INSTRUCTIONS
  157.  
  158. YAUP is written in FORTRAN and uses several non-standard but widely
  159. available extensions - mainly DO ... END DO and DO WHILE ... END DO
  160. constructions, COMPLEX*16 data types and its associated intrinsic
  161. functions, and INCLUDE statements.  It calls no external library
  162. routines so it should be fairly easily transportable.  With the
  163. exception of (a large number of) insignificant warnings it passes all
  164. FTNCHEK tests with flying colors.
  165.  
  166. As of this writing YAUP has been tested on the following machines:
  167.  
  168. * NeXTStation (black), Absoft 3.1 compiler (BSD UNIX 4.3)
  169. * VAX 3100-3600, DEC FORTRAN compiler (VMS 5.1 or later)
  170. * Macintosh Quadra 610, Language Systems 3.0 compiler (System 7.1)
  171. * IBM RISC System/6000 cluster, IBM AIX XL Compiler/6000 (IBM AIX 3.2)
  172.  
  173. The program is distributed as a single module named YAUP.F. The file
  174. YAUP.INC is an include file that contains definitions of essential
  175. parameters and common blocks and should be placed in the same
  176. directory as YAUP.F at the time of compilation.
  177.  
  178. THE PROGRAM SHOULD BE COMPILED WITH THE STATIC MEMORY OPTION TURNED ON.
  179. IF YOUR COMPILER IS CASE SENSITIVE IT IS SAFER TO FOLD ALL VARIABLE
  180. NAMES TO LOWER (OR UPPER) CASE.  BEWARE OF OPTIMIZING COMPILERS - THE
  181. "OPTIMIZATIONS" MAY LEAD TO IMPROPER EXECUTION AND SHOULD BE AVOIDED
  182. UNLESS YOU ABSOLUTELY TRUST YOUR COMPILER'S OPTIMIZER.  THE FIRST
  183. THING YOU SHOULD DO IF YAUP DOES NOT EXECUTE PROPERLY IS TURN OFF ALL
  184. OPTIMIZATIONS.
  185.  
  186. A VERY important parameter in YAUP.INC that may need customizing to
  187. your compiler is LWORD.  YAUP uses unformatted direct-access files to
  188. store intermediate results and the various FORTRAN compilers handle
  189. these files in different ways. Generally the value of LWORD should be
  190. set equal to the number of bytes in the direct-access  storage unit,
  191. which for most compilers is 1.  The VAX FORTRAN compilers, however,
  192. use 4-byte portions (words).  SET LWORD TO 4 PRIOR TO COMPILATION IF
  193. YOU USE VAX FORTRAN OR SOME OTHER COMPILER WITH FUNNY IDEAS ON HOW THE
  194. RECL LENGTHS SHOULD BE SPECIFIED.   The program is distributed with
  195. LWORD set to 1.  It should run on any system with this setting but
  196. the amount of free disk space needed for successful execution may be
  197. unnecessarily large.
  198.  
  199. Some compilers (such as the older versions of MacFortran) do not allow
  200. direct-access records longer than 1024 bytes.  YAUP may not run on
  201. such systems.
  202.          
  203. Another possible customization concerns the way your compiler handles
  204. output string editing.  YAUP prints information on the progress of the
  205. calculations to the screen and in doing so it uses '+' (overprint)
  206. character editing. If your compiler interprets the first character of
  207. the output string as a control character you need not do anything (VAX
  208. and MPW (LangSys) FORTRAN, for example).  If this is not so, special
  209. action may be required (this is the case with many, if not most, Unix
  210. compilers). Absoft FORTRAN for NeXTStep, for example, requires the
  211. statement
  212.  
  213.         OPEN(UNIT=6,ACTION='PRINT')
  214.  
  215. added to the very beginning of YAUP.F to ensure that the
  216. screen-directed output is handled properly.  Check your compiler
  217. manula and inser the appropriate code if necessary.
  218.  
  219. YAUP needs somewhat large amounts of RAM and free disk space to compile
  220. and run properly.  At least 8 Mb RAM are needed for compilation on
  221. most machines, 5-6 Mb of free RAM should be available at runtime, and
  222. UP TO 260 Mb of free disk space (for temporary data storage) may be
  223. needed IF THE PROGRAM IS PUSHED TO EXTREMES.  The amount of disk space
  224. needed depends on the input parameters, but approximately
  225. 2*8*NXP*NYP*NE bytes of disk space will be needed for temporary data
  226. storage (for a description of NXP, NYP and NE see section IV).  If
  227. anything, this is a very rough underestimate.
  228.  
  229. For FORTRAN gurus only: The FORTRAN compiler on AIX machines handles
  230. IOSTAT in a very weird fashion.  When an I/O error is encountered, e.g.
  231. attempt to read a characted where a number is expected, IOSTAT is not
  232. set to a non-zero value, as is the case with most other compilers I
  233. have had to deal with.  Instead, an error message is printed to the
  234. terminal and the error is ignored. This interferes with YAUP's internal
  235. error-checking routines.  If someone knows of a fix, e.g. a compiler
  236. switch, I'd like to hear about it.  Send email to boyan@tmnxt1.iit.edu.
  237.  
  238.  
  239.  
  240. III. NEW FEATURES
  241.  
  242. This section describes the new features in YAUP relative to version
  243. 1.2.  Skip this section if this is the first time you are using YAUP.
  244.  
  245. - The L/R symmetry criterion (see B. I. Boyanov et al., NIM A, Feb
  246.         1, 1994) is checked, but not enforced.  That means that the
  247.         program will warn you when you are using XSYM=YES at dangerously
  248.         high energies, but will not force you to switch to XSYM=NO.
  249.  
  250. - New keywords: BASENAME, GNUPLOT.  See section IX.
  251.  
  252. - A serious bug in the spline interpolation procedures has been
  253.         fixed. The bug caused problems in calculations with large values
  254.         of NXP and/or NYP only.
  255.  
  256. - A bug in the I/O routines has been fixed.  (imsc -> imisc
  257.         conflict)
  258.  
  259. - The parser routines have been rewritten and are hopefully more
  260.         robust.  There are no changes in the input file format and the
  261.         user interface.
  262.  
  263. - The behavior of the program in MODE 7 has been fixed up.
  264.  
  265. - NXP and NYP are no longer under user control in MODE 1 and may be
  266.         set automatically in other modes.
  267.        
  268. - The default value of UPDATE is 1 (i.e. UPDATE=0 defaults to UPDATE=1).
  269.         Use UPDATE=-1 to turn off updating.
  270.  
  271. IV. INPUT FILE FORMAT
  272.  
  273. In the rest of this document keywords and file names are shown
  274. capitalized.  This is done for clarity and is not required.  If you
  275. are using YAUP on a system with case-sensitive file names (e.g. UNIX)
  276. use LOWER CASE for the file names. The case of the keywords is
  277. irrelevant as the program capitalizes all input internally.
  278.  
  279. Input is read from the file YAUP.INP which is expected to be in the
  280. current directory.  The input consists of tab, space or
  281. comma-delimited keywords followed by values. On any given line in the
  282. input file all text that appears after any of the characters %,!,#,
  283. or ; is treated as a comment (ignored).
  284.  
  285. The values are separated from the keywords by one or more spaces, tabs
  286. equal signs.  A list of valid keywords follows :
  287.  
  288.         PERIOD, NPER, NPTS
  289.         EMIN, EMAX, NE
  290.         ENERGY, CURRENT, SIGX, SIGY, SIGX1, SIGY1
  291.         DISTANCE, XPC, YPC, XPS, YPS, NXP, NYP
  292.         MODE, NSIG, TRAJECTORY, XSYM, HANNING  
  293.         BFILE, TFILE
  294.         QUIET,END
  295.  
  296. The order in which the keywords appear in YAUP.INP is not important (as
  297. long as ALL keywords are defined) but for the sake of clarity they may
  298. be grouped in the following categories :
  299.  
  300.  
  301. LINE 1 : specifies the undulator
  302.  
  303. -  PERIOD is the magnet period in centimeters (real)
  304. -  NPER is the number of periods (integer, 150 max)
  305. -  NPTS is the number of points PER PERIOD at which the trajectory
  306.         is to be calculated (integer, 10 min, 100 max, 40 sugg.). The
  307.         magnetic-field modulation and phase-error functions (see eq. 1)
  308.         must then be given at NPTS points per period (NPTS*NPER-1 points
  309.         total).
  310.  
  311.  
  312. LINE 2 : defines the photon energy range
  313.  
  314. -  EMIN is the photon starting energy in eV (real)
  315. -  EMAX is the final photon energy in eV (real)
  316. -  NE is the number of points in energy at which the spectrum will
  317.         be calculated (integer, used in spectral calculations, 500 max)
  318.  
  319.  
  320. LINE 3 : particle beam parameters
  321.  
  322. -  ENERGY is the electron energy in GeV (real)
  323. -  CURRENT is the beam current in Amps (real)
  324. -  SIGX is the horizontal beam size in mm (real)
  325. -  SIGY is the vertical beam size in mm (real)
  326. -  SIGX1 is the horizontal beam divergence in mrad (real)
  327. -  SIGY1 is the vertical beam divergence in mrad (real)
  328.  
  329.  
  330. LINE 4 :  pinhole size and position
  331.  
  332. -  DISTANCE is the distance to the observation point in meters. If
  333.         =0 then all pinhole sizes (defined below) are assumed to be in
  334.         angular units (mrad).  Otherwise the pinhole sizes are in
  335.         millimeters AND ALL BRIGHTNESS/POWER DENSITY DATA IS PER MM^2
  336.         RATHER THAN PER MRAD^2, E.G. PH/S/MM^2/0.1%BW.
  337. -  XPC is the horizontal position of the pinhole center in mrad or
  338.         mm (real)
  339. -  YPC is the vertical position of the pinhole center in mrad or
  340.         mm (real)
  341. -  XPS is the horizontal pinhole size in mrad or mm (real) -  YPS
  342.         is the vertical pinhole size in mrad or mm (real)
  343. -  NXP is the number of pinhole subintervals in the horizontal
  344.         direction (integer, 100 max)
  345. -  NYP is the number of pinhole subintervals in the vertical
  346.         direction (integer, 100 max)
  347.  
  348.  
  349. LINE 5 : control parameters
  350.  
  351. -  MODE=0-7 specifies the calculation mode (integer)
  352.         MODE=0 - trajectory calculation only. The settings of
  353.                 all parameters on lines 2-4 are irrelevant in
  354.                 this case.
  355.         MODE=1 - spectrum of the brightness from EMIN to
  356.                 EMAX at NE points  at position XPC,YPC.  In this
  357.                 case XPS,YPS, NXP, and NYP are irrelevant (see
  358.                 Section VII).
  359.         MODE=2 - angular distribution of the brightness at
  360.                 EMIN. In this case EMAX and NE are irrelevant.
  361.         MODE=3 - spectral AND angular distribution of the
  362.                 brightness.
  363.         MODE=4 - spectrum of the flux through a pinhole at
  364.                 NE points in the range [EMIN,EMAX].
  365.         MODE=5 - spectral distribution of the radiated power
  366.                 at XPC,YPC.  In this mode XPS, YPS, NXP and NYP
  367.                 are irrelevant (see Section VII).
  368.         MODE=6 - spectral AND angular distribution of the
  369.                 radiated power.
  370.         MODE=7 - angular distribution of the radiated power
  371.                 integrated from EMIN to EMAX.  In this case NE
  372.                 determines the number of energy points at which the
  373.                 spectrum will be calculated prior to the integration.  
  374.  
  375. -  NSIG is the number of standard deviations of beam divergence to
  376.         include in the calculation (integer, max=5). NSIG=0 gives the
  377.         zero-emittance spectrum (in this case SIGX, SIGY, SIGX1, SIGY1
  378.         are irrelevant).
  379.  
  380. -  TRAJECTORY  is a trajectory-calculation flag
  381.         TRAJECTORY=OLD - read the trajectory from the disk
  382.                 file specified by the keyword TFILE (see below).
  383.         TRAJECTORY=NEW - read the B-field distribution from a
  384.                 file specified by the keyword BFILE and calculate
  385.                 the trajectory  without saving it.
  386.         TRAJECTORY=NEW+KEEP - read the B-field distribution from
  387.                 a file specified with the keyword BFILE, calculate
  388.                 the trajectory and store it in a file specified by
  389.                 the keyword TFILE.  
  390.  
  391. -  XSYM=YES,NO flags whether horizontal symmetry of the spectrum
  392.         should be enforced (integer). Vertical symmetry is always
  393.         enforced. XSYM=NO - do not enforce horizontal symmetry XSYM=YES
  394.         - enforce horizontal symmetry
  395.  
  396. -  HANNING=0,1,...,NPER/2 is the number of periods at the entrance
  397.         and exit of the undulator over which a Hanning window will be
  398.         applied to the solution for the trajectory prior to the FFT.  If
  399.         HANNING=0 no window will be  applied (default).  USE WITH
  400.         EXTREME CAUTION.
  401.  
  402.  
  403. LINE 6 : I/O filename specifications
  404.  
  405. -  BFILE - when TRAJECTORY=NEW or NEW+KEEP this keyword must
  406.         specify a complete directory specification of the disk file
  407.         containing the B-field distribution (<80 chars).  If
  408.         TRAJECTORY=OLD the value of BFILE is irrelevant and may be
  409.         omitted.  THE FILE NAME MUST BE ENCLOSED IN DOUBLE QUOTES.
  410.  
  411. -  TFILE - when TRAJECTORY=OLD or NEW+KEEP this keyword must
  412.         specify a complete directory specification of the disk file
  413.         containing the trajectory or to which the trajectory will be
  414.         written. The maximum length of the filenames is 80 characters.
  415.         THE FILE NAME MUST BE ENCLOSED IN DOUBLE QUOTES.  If TRAJECTORY
  416.         = NEW this keyword may be omitted.
  417.  
  418. NOTE:  unless told otherwise YAUP converts all input to upper case. On
  419. case-sensitive systems (e.g. UNIX) this may cause problems with the
  420. interpretation of file names.  In such cases (or any time you want to
  421. keep the file names case-sensitive and/or want to use file names
  422. containing blanks) enclose the file names in DOUBLE quotes, e.g.
  423. BFILE= "/users/myname/myfile.b"
  424.  
  425.  
  426. LINE 7: Miscellaneous keywords
  427.  
  428. - QUIET=YES,NO - when YAUP encounters a word that it does not
  429.         recognize it will complain loudly.  You may prevent it from
  430.         doing so by using the QUIET flag.  By default QUIET is set to
  431.         NO. Setting QUIET=YES will cause all unrecognized keywords to be
  432.         ignored.  It is your responsibility to avoid all typos and
  433.         accidental occurrences of text containing keywords.  It is
  434.         probably a good idea to set QUIET=NO (default) and comment out
  435.         all additional text in YAUP.INP
  436.  
  437. - END - all input following the keyword END is ignored
  438.  
  439.  
  440. EXAMPLE 1.  Here is a sample input file
  441.  
  442. ---------------------YAUP.INP begins here-------------------
  443. ;Magnet parameters
  444. period=3.3      NPER = 75       npts=20
  445.  
  446. #Photon energy
  447. Emin=4000.  eMax = 6000.        nE=300  ;you may mix cases as you wish
  448.  
  449. %Storage ring
  450. ENERGY=7.0              CURRENT=0.1    
  451. SIGX=0.308              SIGY=0.085
  452. SIGX1=0.024             SIGY1=0.009
  453.  
  454. !Pinhole (mm or mrad)
  455. DisTaNcE = 50. ; all pinhole sizes are in mm now,
  456.                ; case of keyword does not matter
  457. XPC=0.000       XPS=2.000       NXP=50    ; this text is ignored
  458. YPC=0.000       YPS=2.000       NYP=50
  459.  
  460. %Calculation parameters
  461. MODE=4          NSIG=2  TRAJECTORY=NEW  
  462. XSYM=yes        HANNING=0
  463.  
  464. ;Filenames
  465. BFILE = "test.b"
  466. ;TFILE = "test.trj"
  467.  
  468. END
  469.  
  470. Note that four types of comment characters are allowed, even in the
  471. middle of a line.  You may put anything your heart desires after an
  472. END statement without using any comment characters, just like this
  473. text.
  474. ---------------------YAUP.INP ends here-------------------
  475.  
  476. In this case TRAJECTORY=NEW (calculate without saving), so there is no
  477. need to specify TFILE.  Note that comments may appear anywhere in the
  478. input file and that empty lines are ignored. Care must be taken to
  479. avoid comments which are identical to keywords when QUIET=YES.
  480.  
  481.  
  482. EXAMPLE 2. Another input file
  483.  
  484. ---------------------YAUP.INP begins here-------------------
  485.  
  486. ;Magnet parameters
  487. PERIOD=3.3      NPER = 75       NPTS=20
  488.  
  489. ;Photon energy
  490. EMIN=4000.  EMAX = 6000.        NE=300
  491.  
  492. ;Storage ring
  493. ENERGY=7.0              CURRENT=0.1    
  494. SIGX=0.308              SIGY=0.085
  495. SIGX1=0.024             SIGY1=0.009
  496.  
  497. ;Pinhole (mm or mrad)
  498. DISTANCE = 0.  ; all pinhole sizes are now in mrad
  499. XPC=0.000       XPS=0.000       NXP=0  
  500. YPC=0.000       YPS=0.100       NYP=50
  501.  
  502. ;Calculation parameters
  503. MODE=2          NSIG=2  trajectory=NEW+KEEP  
  504. XSYM=yes        HANNING=0
  505.  
  506. ;Filenames
  507. BFILE = "test.b"
  508. TFILE = "test.trj"
  509.  
  510. ---------------------YAUP.INP ends here-------------------
  511.  
  512. Here TRAJECTORY=NEW+KEEP (calculate and save) so both input (for the
  513. B-field) and output (for the trajectory) filenames must be specified.
  514. The same is true if MODE=0 regardless of the setting of TRAJECTORY
  515. Note that you may omit the END keyword when you don't need it.
  516.  
  517.  
  518. EXAMPLE 3. Yet another sample input file.
  519.  
  520. -------------------YAUP.INP begins here-------------------
  521.  
  522. ;Magnet parameters
  523. PERIOD=3.3      NPER = 75       NPTS=20
  524.  
  525. ;Photon energy
  526. EMIN=4000.  EMAX = 6000.        NE=300
  527.  
  528. ;Storage ring
  529. ENERGY=7.0              CURRENT=0.1    
  530. SIGX=0.308              SIGY=0.085
  531. SIGX1=0.024             SIGY1=0.009
  532.  
  533. ;Pinhole (mm or mrad)
  534. DISTANCE = 50.
  535. XPC=0.000       XPS=0.100       NXP=50  
  536. YPC=0.000       YPS=0.100       NYP=50
  537.  
  538. ;Calculation parameters
  539. MODE=4          NSIG=2  TRAJECTORY=old  
  540. XSYM=yes        HANNING=0
  541.  
  542. ;Filenames
  543. BFILE = "testbri"
  544. TFILE = "test.trj"
  545.  
  546. ---------------------YAUP.INP ends here-------------------
  547.  
  548.  
  549. EXAMPLE 4. A bad example
  550.  
  551. -------------------YAUP.INP begins here-------------------
  552. QUIET=yes
  553.  
  554. Magnet parameters - this will not cause an error
  555. PERIOD=3.3      NPER = 75       NPTS=20
  556.  
  557. ;Photon energy
  558. EMIN=4000.  EMAX = 6000.        NE=300
  559.  
  560. QUIET=no
  561. Storage ring - this text will make YAUP complain
  562. ENERGY=7.0              CURRENT=0.1    
  563. SIGX=0.308              SIGY=0.085
  564. SIGX1=0.024             SIGY1=0.009
  565.  
  566. ;Pinhole (mm)
  567. DISTANCE = 50.
  568. XPC=0.000       XPS=0.000       NXP=0  
  569. YPC=0.000       YPS=0.100       NYP=0
  570.  
  571. ;Calculation parameters
  572. MODE=1          NSIG=2  TRAJECTORY=old  
  573. XSYM=yes        HANNING=0
  574.  
  575. ; MODE=1 so YPS does not matter
  576.  
  577. ;Filenames
  578. BFILE = "test.b"
  579. TFILE = "test.trj"
  580.  
  581. ---------------------YAUP.INP ends here-------------------
  582.  
  583. In this example QUIET is initially set to YES so the line "Magnet
  584. parameters..." will be ignored.  Later in the file, however, QUIET is
  585. set back to NO and the line "Storage..." will cause the program to
  586. complain.
  587.  
  588. Extensive error checking of the input stream is performed but it is
  589. mostly for syntax errors and missing keywords.  Obvious errors like
  590. negative ENERGY or variables out of bounds will be reported but no
  591. other attempt is made to see if the input data makes any sense.
  592.  
  593.  
  594.  
  595. V. OUTPUT FILE FORMAT
  596.  
  597. All results are written to a file called YAUP-N.OUT where N is an
  598. integer from 0 to 9.  Initially the program tries to open a file
  599. called YAUP-0.OUT.  If the file already exists in the current
  600. directory the program attempts to open the file YAUP-1.OUT and so on,
  601. until a unique file name YAUP-N.OUT if found.  If the files YAUP-0.OUT
  602. through YAUP-9.OUT already exist the program terminates with the
  603. error message
  604.  
  605. *************
  606. opnout:: cannot open an output file  
  607. please delete all yaup-*.* files
  608. *************
  609.  
  610. You will have to manually delete at least one of the YAUP-*.OUT files
  611. before attempting to restart the program.  This inconvenience is
  612. intended to protect the results of lengthy calculations from
  613. accidental deletion (you can tell that I did that many times, can't
  614. you :-)).
  615.  
  616. The output file is straight ASCII and may be plotted with the program
  617. of your choice.
  618.    
  619.  
  620.  
  621. VI. PROGRAM DESCRIPTION
  622.  
  623. The program assumes that the tapered undulator is a periodic array of
  624. magnets with alternating poles and a magnet gap that varies along the
  625. undulator axis z in a user-specified fashion.  Thus the magnet field
  626. within the undulator is some amplitude-modulated sinusoid :
  627.  
  628. Btot(z)=B(z)*sin(2*pi/L*z+phi(z)).      (1)
  629.  
  630. Here Btot is the total field, z is the longitudinal coordinate (along
  631. the undulator axis), L is the undulator period and phi(z) accounts for
  632. any phase errors that may be present in the field (amplitude errors
  633. should be included in B(z)).
  634.  
  635. The user specifies the function B(z) (in tesla) and phi(z) (in
  636. radians).  The  equations of motion are solved numerically subject to
  637. the boundary condition that the transverse displacement at z=0 and
  638. z=N*L is zero (no beam steering).  Zero beam divergence is assumed in
  639. these calculations.
  640.  
  641. Once the trajectory is available it is used to calculate the energy
  642. radiated by a single electron traversing that trajectory in a
  643. user-specified angular and energy range.  In order to minimize the
  644. computation time the program tries to use certain symmetries of the
  645. spectrum to reduce the angular range to the possible minimum.  It is
  646. therefore very likely that the angular range of the actual
  647. calculations (printed on the screen) will differ significantly from
  648. the angular range requested by the user, but as long as the FINAL
  649. results are in the requested range this should be no cause for alarm.
  650.  
  651. As mentioned earlier beam emittance may be accounted for in a first
  652. order approximation by convoluting the zero emittance spectrum with
  653. the e-beam velocity distribution.  Up to five standard deviations of
  654. beam divergence may be included in the calculations at this time
  655. which should be more than enough for all practical purposes.
  656.  
  657.  
  658.  
  659. VII. HINTS AND SUGGESTIONS (PLEASE, PLEASE READ)
  660.  
  661. If a pinhole covers both positive and negative angles the program may
  662. not calculate the brightness over the requested angular range but will
  663. rather use the allowed reflection symmetries of the spectrum to
  664. minimize the angular range of the calculations.  In such case there
  665. will be APPROXIMATELY (see below) NXP/2 and NYP/2 points in the
  666. minimal angular range.  Any adjustments to the input parameters are
  667. written to the output file so that the values saved there reflect the
  668. ACTUAL parameters used in the calculations.
  669.  
  670. The parameter XSYM flags whether to assume reflection symmetry of the
  671. spectrum with respect to the vertical (yz) plane.  This is a valid
  672. symmetry for untapered undulators (if no field errors are present). In
  673. every other case the presence or absence of this symmetry should be
  674. verified (calculate an angular distribution of the brightness at
  675. several energies with XSYM=NO for an on-axis pinhole and compare the
  676. results for positive and negative x-angles) and XSYM=YES should be
  677. used whenever possible. For an approximate analytical criterion see
  678. the reference cited at the beginning of this document.  This criterion
  679. is checked internally and whenever it is not satisfied and XSYM is set
  680. to YES the program will issue a warning message:
  681.  
  682. ************************************************
  683. *EMAX may be too high.  Consider using XSYM=NO.*
  684. ************************************************
  685.  
  686. In order to calculate the convolutions with the beam divergence
  687. efficiently (NSIG>0, all modes), the step sizes for the brightness
  688. calculations and the sampling of the e-beam distribution have to be
  689. identical and fixed.  Since the number of sampling points for the
  690. particle beam distribution is limited to 78 in each direction, some
  691. minor adjustment of the step and pinhole sizes may be needed.  The
  692. program performs all necessary  adjustments to NXP, NYP, XPS and YPS
  693. automatically and saves them in the output file.  The values written
  694. to the output file are the ones used in the calculation.
  695.  
  696. Since the user-requested pinhole must be covered in an integer number
  697. of steps minor adjustments to the pinhole sizes may also be
  698. necessary.  This is done automatically and all changes are recorded in
  699. the output file.
  700.  
  701. To account properly for beam emittance (NSIG>0) the program needs a
  702. "sufficiently dense" angular/spatial mesh of points.  This is
  703. especially true for calculations involving untapered undulators and
  704. tapered undulators with a small amount of taper, where the
  705. zero-emittance spectrum is a rapidly oscillating function of the angle
  706. between the observation direction and the undulator axis.  An
  707. angular/spatial mesh may be considered "sufficiently dense" if
  708. doubling the number of points in angle in the X and/or Y directions
  709. (i.e. NXP and NYP) leaves spectrum reasonably unchanged.
  710. Insufficiently dense angular/spatial mesh will result in spurious
  711. oscillations in the calculated spectra.
  712.  
  713. Usually NSIG=2 will do a decent job and NPTS=40 is more than enough.
  714. Unnecessarily large values for these parameters will slow down the
  715. execution of the program considerably and may lead to insufficient
  716. averaging (and smoothing) of the zero- emittance spectrum.
  717.  
  718. If NXP and/or NYP=0,1 and XPS and/or YPS>0, the stepsize for the
  719. angular-distribution calculations is chosen internally.  It is
  720. highly recommended that you set NXP and NYP to zero when MODE=2,3,4,6.
  721. Note that when MODE=1,5 XPS and YPS are forced to zero and the angular
  722. stepsize is ALWAYS controlled internally (if NSIG>0).
  723.  
  724. It is a good idea to leave a blank line at the end of the input file.
  725. If this is not done the program may respond with an error message on
  726. some systems.
  727.  
  728. Only minor error checking of the input stream is performed.  If
  729. inconsistent input parameters are given the results produced by the
  730. program (if any) most likely will make no sense.  It is the user's
  731. responsibility to ensure that the input is "reasonable" and the output
  732. behaves "as expected" to certain changes of the input parameters. THIS
  733. IS NOT A COMMERCIAL PRODUCT AND IS NOT DESIGNED TO BE "FOOL-PROOF".
  734.  
  735. As mentioned in the introduction, it is not recommended to use this
  736. program for calculations of untapered undulators.  URGENT will handle
  737. such devices much more efficiently. Programs such as URGENT, however,
  738. cannot account for field errors or fringe fields of any kind.  If this
  739. is what you want, YAUP may be used to do the calculations but it must
  740. be kept in mind that the zero-emittance spectrum of untapered
  741. undulators is a  wildly oscillating function of the angles (both
  742. horizontal and vertical) and in some cases the convolution with the
  743. beam emittance may not  provide sufficient "statistics" to wash out
  744. these oscillations unless the stepsize is sufficiently small (this is
  745. especially true for large values of NSIG and/or XPS/YPS when
  746. MODE=2,3,4,6). In such cases it is HIGHLY desirable that you set
  747. NXP=NYP=0 and NSIG=2 whenever possible.  If you insist on using
  748. your own NXP/NYP, please run YAUP once with NXP=NYP=0 and note the
  749. step sizes (in both the X and Y directions) that the program chooses.  
  750. We recommend that the step sizes for all subsequent calculations with
  751. this configuration (i.e. number of poles, magnet period, beam energy,
  752. AND photon energy range) does not exceed these values more than two
  753. times whenever possible.
  754.  
  755. Use HANNING *very* cautiously.  When in doubt use HANNING=0.  Whenever
  756. HANNING>0 *always* inspect the trajectory visually.
  757.  
  758. When interrupted the program leaves the internal files YAUP.CFG,
  759. YAUP.S0, and YAUP.S1 on the disk.  These files must be removed
  760. manually before restarting the program. For more info see section IX.
  761.  
  762. In some cases the program will terminate with an error message
  763. suggesting that you use certain values of NCRIT and/or MFFT. (see
  764. section IX).  Under normal operation (i.e. when you are not abusing
  765. the program) they will not be encountered. If you use the suggested
  766. values the program will probably produce results but you should be
  767. ** VERY VERY ** SUSPICIOUS of them.
  768.  
  769.  
  770.  
  771. VIII. DATA FILE FORMATS
  772.  
  773. The B-field file should be written in double precision to an
  774. unformatted FORTRAN file as follows :
  775.  
  776.         IMPLICIT DOUBLE PRECISION (A-H,O-Z)
  777.         .
  778.         .
  779.         .
  780.         NPTST=NPER*NPTS+1
  781.         DZ=PERIOD/NPTS
  782.         BMIN=1.D30
  783.         DO I=1,NPTST
  784.            Z=(I-1)*DZ
  785.            < calculate B(z) and phi(z) >
  786.            IF (B(I).LT.BMIN) BMIN=B(I)
  787.         END DO  
  788.         OPEN(1, FILE=filename, STATUS='UNKNOWN',FORM='UNFORMATTED')
  789.         WRITE (1) PERIOD, NPER, NPTS,BMIN
  790.         WRITE(1) ( B(I), PHI(I), I=1,NPTST )
  791.         CLOSE(1)
  792.         .
  793.         .
  794.         .
  795.        
  796. In the above code NPTST is the total number of points at which the
  797. trajectory will be calculated, PERIOD is the undulator period (in cm)
  798. ), and B (in tesla) and PHI are the values of the modulating function
  799. and the phase errors (as defined by eq.(1)) at points Z=(I-1)*DZ,
  800. I=1,NPTST, DZ=PERIOD/NPTS. BMIN is the minimum value of B(I),
  801. I=1,...,NPTST.  The values of PERIOD, NPER and NPTS in the B-field
  802. file and YAUP.INP must be the same or the program will terminate with
  803. an error message.
  804.  
  805. A program called BFIELD.F is distributed with YAUP.F. BFIELD.F is a
  806. standalone module that generates a B-field file for an undulator with
  807. a linearly tapered gap in a format acceptable to YAUP.  The user must
  808. specify the gap GZMIN at Z=Zmin=0 and the amount of gap taper
  809. DG=(GZMAX-GZMIN)/GZMIN (either positive or negative).  The program
  810. interpolates the gap linearly between GZMIN and GZMAX.  The field
  811. strength dependence is specific to the proposed APS undulators but the
  812. user may modify this section of the program according to his/her
  813. specific needs.  Zero phase errors are assumed. See the file BFIELD.F
  814. for more details.
  815.  
  816. The format of the trajectory file is similar to that of the B-field
  817. file.  YAUP uses the following code to save the trajectory (when
  818. ITRAJ=SAVE or MODE=0) :
  819.  
  820.         IMPLICIT DOUBLE PRECISION (A-H,O-Z)
  821.         .
  822.         .
  823.         .
  824.         KMIN=0.934*PERIOD*BMIN
  825.         EFUND=949.*ENERGY**2/(PERIOD*(1.D0+KMIN**2/2.D0))      
  826.         OPEN(1, FILE=filename,STATUS='UNKNOWN',FORM='UNFORMATTED')
  827.         WRITE(1) PERIOD,NPER,NPTS,ENERGY,EFUND
  828.         WRITE(1) ( CT(I),X(I),BETAX(I),BETAZ(I), I=1,NPTST )
  829.         CLOSE(1)        
  830.         .
  831.         .
  832.         .
  833.        
  834. where PERIOD,NPER,NPTS,and NPTS are as before, ENERGY is the electron
  835. energy in GeV, EFUND is the on-axis fundamental energy (in eV) of  a
  836. untapered undulator with K=KMIN=0.934*PERIOD*BMIN, and CT (in
  837. centimeters), X (in cm), BETAX, and BETAZ are the usual quantities as
  838. a function of the longitudinal coordinate Z=(I-1)*DZ, I=1,NPTST.
  839. Contact the authors at the addresses given at the end of this document
  840. if you need a program that converts the trajectory and B-field files
  841. back to ASCII format and vice-versa.
  842.  
  843.  
  844.  
  845. IX. "EXPERT" options.
  846.  
  847. This section deals with somewhat technical questions that concern
  848. primarily the fine-tuning of the program execution.  It is intended
  849. for "expert" users.  The use of the capabilities described here is
  850. strictly optional.  If you intend to use the program as a black box
  851. you probably do not need to read what follows.
  852.  
  853. The execution of YAUP is controlled by a number of parameters: STATUS,
  854. UPDATE, RESOLUTION, NCRIT, MFFT, BW, and GNUPLOT.  The most
  855. time-consuming portion of the program is the calculation of the
  856. zero-emittance Stoke's coefficients S0 and S1. The values of these
  857. coefficients as a function of energy and angle are written to two
  858. files named YAUP.S0 and YAUP.S1 (defaults).  The status of the current
  859. job is saved in the "status file" YAUP.CFG. If the program is
  860. interrupted at any time, these three files (and the ORIGINAL YAUP.INP)
  861. may be used to continue the calculations from the point of
  862. interruption instead of starting from scratch. The default location
  863. of these files is the current directory.  If you would prefer to have
  864. them in a scratch directory (e.g. /tmp on UNIX systems) or rename
  865. them altogether, you may do so through the use of the BASENAME keyword
  866. (see below).  On some systems you can avoid counting these files
  867. against your disk quota by doing this.
  868.  
  869. - BASENAME="filespec", if present, determines the basename of all
  870.         output files produced by YAUP. Here "filespec" is a file
  871.         specification (enclosed in double quotes as usual) such that
  872.         "filespec.txt" is a valid file name.  Examples of valid
  873.         filespec's are "/tmp/yaup" (UNIX), "c:\tmp\yaup1" (DOS),
  874.         "[.junk]yaup2" (VMS), "HD20:junk:yaup3" (Mac). If a basename is
  875.         given program output will be directed to the file
  876.         "filespec-n.out" (instead of YAUP-n.OUT), the Stokes'
  877.         coefficients will be written to "filespec.s0" and "filespec.s1"
  878.         (instead of YAUP.S0 and YAUP.S1), and the configuration file
  879.         name will be "filespec.cfg" (instead of YAUP.CFG). This is
  880.         particularly useful if you want to run several YAUP (batch) jobs
  881.         in the same directory. Note, however, that input is ALWAYS read
  882.         from YAUP.INP.
  883.  
  884. - The handling of YAUP.S0, YAUP.S1 and YAUP.CFG (which will be
  885.         jointly referred to as "temporary files") is controlled by the
  886.         STATUS keyword:
  887.  
  888.         STATUS=NEW - start a new job.  Delete all temporary files
  889.                 when done.
  890.         STATUS=NEW+KEEP - start a new job. Keep all temporary files
  891.                 when done.
  892.         STATUS=OLD - continue an interrupted job from the point of
  893.                 interruption.  All temporary files must already exist on
  894.                 disk and are deleted at the end of the job.
  895.         STATUS=OLD+KEEP - continue an interrupted job from the point of
  896.                 interruption.  All temporary files must already exist on
  897.                 disk and are saved at the end of the job.
  898.  
  899. If the files were intentionally saved (with STATUS=%%%+KEEP), program
  900. execution will resume with the 2D convolution with the beam emittance.
  901. You may use this option to calculate the flux through a pinhole once
  902. you have calculated the spectral and angular distributions of the
  903. brightness in the pinhole (and vice versa).  If the file YAUP.INP
  904. differs in any way (besides the values of MODE, TRAJECTORY, STATUS, and
  905. UPDATE) from the original, the program will terminate with the message
  906.  
  907. *************
  908. status:: invalid checksum found in "yaup.cfg"
  909. cannot continue
  910. *************
  911.  
  912. If STATUS=NEW or NEW+KEEP and any of the files YAUP.S0, YAUP.S1, and
  913. YAUP.CFG already exist in the current  directory the program will
  914. terminate with an error message.  You will be expected to delete these
  915. files manually.
  916.  
  917. - UPDATE controls the frequency with which the temporary files are
  918.         updated (i.e. closed and then reopened).  If UPDATE>=0 the actual
  919.         frequency of the updates will depend on the input parameters
  920.         but approximately every UPDATE*NYP points the files will be
  921.         closed and then reopened. In the special case NXP/NYP=0 (see
  922.         section VII) the program will calculate the values of NXP/NYP
  923.         internally and will update the temporary files every UPDATE*NYP
  924.         points. When UPDATE<0 an update is forced only once - when the
  925.         zero-emittance calculations are completed (there may be other
  926.         unforced updates but that depends on the amount of temporary
  927.         data and the size of the file buffers on your system). A small
  928.         (positive) value of UPDATE will force frequent updates and will
  929.         minimize the data loss in case of a power failure or unintended
  930.         interruption but will slow down program execution somewhat.
  931.         Obviously the highest update frequency corresponds to UPDATE=1.
  932.         UPDATE=0 defaults to UPDATE=1.
  933.  
  934.  
  935. - RESOLUTION controls the internal scaling of the angular/spatial
  936.         stepsize when  NXP/NYP=0 (see section VII). The program calculates
  937.         the angular width ANGW of the zero-emittance first-harmonic lobe
  938.         of an untapered undulator with the same hardware parameters tuned
  939.         to EMAX and sets the angular stepsize to ANGW/RESOLUTION. The
  940.         default is RESOLUTION=6.
  941.  
  942. - In order to avoid power-aliasing problems YAUP will try to
  943.         increase the sampling rate of the function that is FFTd until
  944.         the Nyquist energy is at least ECRIT=NCRIT/2*EFUND+EMAX eV,
  945.         where NCRIT is a parameter currently set to 20 and EFUND is
  946.         defined in section VIII. The spurious contributions to the
  947.         spectrum at any energy E the will then come from energies not
  948.         lower than E+NCRIT*EFUND. By default NCRIT=20.  This means that
  949.         for untapered undulator calculations the power aliasing
  950.         contributions will come from harmonics at least 20 orders higher
  951.         than the highest harmonic in the energy range of interest.  In
  952.         plain English, if you are calculating the undulator spectrum in
  953.         an energy range containing the fifth, sixth, and seventh
  954.         harmonic, the power aliasing contributions will come at most
  955.         from the 27th harmonic.
  956.  
  957. - To account for the beam emittance the program convolutes the
  958.         angular distribution of the brightness at each energy with the
  959.         electron divergence/spatial distribution. Since the energy
  960.         stepsize in energy of the FFTd spectrum varies with the
  961.         observation direction the spectrum must be interpolated so as
  962.         to find the values of the zero- emittance brightness at the
  963.         user-requested energies. Typically the zero-emittance spectrum
  964.         of the brightness is a sinc-like oscillating function of energy
  965.         and a good interpolation will be possible only if the energy
  966.         mesh is "sufficiently dense". The program controls the energy
  967.         stepsize of the FFT internally (it has nothing to do with the
  968.         user-specified energy stepsize as determined from EMIN, EMAX,
  969.         and NE).  The choice for an energy stepsize is  based on the
  970.         values the parameters MFFT and NCRIT and is adjusted so that
  971.         there will be approximately MFFT points per oscillation in the
  972.         spectrum.  MFFT must be chosen so that a sufficient number of
  973.         points is available to perform the interpolation described
  974.         above. The default value is 8.  Anything less than 4 seems
  975.         unacceptable (to me). MFFT MUST BE A POWER OF 2. THE PROGRAM
  976.         DOES NOT CHECK THAT.
  977.  
  978. - BW is the bandwidth of the results.  The defaults is BW=0.001
  979.         (e.g. ph/s/0.1% BW(/mrad^2 or /mm^2))
  980.  
  981. - GNUPLOT=XLINES,YLINES,NONE allows formatting of the output file
  982.         for GNUPLOT compatibility. When plotting Z=F(X,Y) 3D data
  983.         GNUPLOT requires that each set of lines in the input file that
  984.         defines a contour in the XY plane be separated from the
  985.         preceding and following sets by a blank line.  Obviously this
  986.         option is useful only when calculating 2D distributions.
  987.        
  988.         XLINES - a blank line will be left after every NXP*NYP lines.
  989.         YLINES - a blank line will be left after every NYP lines
  990.         NONE - no additional formatting is performed.  This is equivalent
  991.                 to omitting the GNUPLOT keyword.
  992.                
  993. In some cases the program will terminate with an error messages
  994. suggesting that you use certain values of NCRIT and/or MFFT. Under
  995. normal operation (i.e. when you are not abusing the program) they will
  996. not be encountered. If you use the suggested values the program will
  997. probably produce results but you should be ** VERY VERY ** SUSPICIOUS
  998. of them.
  999.  
  1000.  
  1001. EXAMPLE 5.  A demo YAUP.INP that uses the expert options.
  1002.  
  1003. ---------------------YAUP.INP begins here-------------------
  1004.  
  1005. ;Magnet parameters
  1006. PERIOD=3.3      NPER = 75       NPTS=20
  1007.  
  1008. ;Photon energy
  1009. EMIN=3000.  EMAX = 600000.        NE=300
  1010.  
  1011. ;Storage ring
  1012. ENERGY=7.0              CURRENT=0.1    
  1013. SIGX=0.308              SIGY=0.085
  1014. SIGX1=0.024             SIGY1=0.009
  1015.  
  1016. ;Pinhole (mm or mrad)
  1017. DISTANCE = 0.
  1018. XPC=0.050       XPS=.100       NXP=50  
  1019. YPC=0.030       YPS=.100       NYP=50
  1020.  
  1021. ;Calculation parameters
  1022. MODE=4          NSIG=2  TRAJECTORY=old  
  1023. XSYM=yes                HANNING=0
  1024.  
  1025. ;Filenames
  1026. BFILE = "planar-1.76-bf"
  1027. TFILE = "planar-1.76-trj"
  1028. BASENAME = "/tmp/hello"
  1029.  
  1030. ;END
  1031.  
  1032. ;Advanced keywords
  1033. STATUS=old+keep         UPDATE=2          RESOLUTION=12
  1034. NCRIT=25                MFFT=0            BW=0.01
  1035. ---------------------YAUP.INP ends here-------------------
  1036.  
  1037. In this hypothetical input file STATUS=old+save, UPDATE=2,
  1038. RESOLUTION=12, NCRIT=25, MFFT1=8 (default), and BW=0.01 (1%BW).
  1039. Setting any parameter equal to zero signals the program to use the
  1040. defaults (as defined in the parameter descriptions above). Here
  1041. BASENAME="/tmp/hello" so output will be written to /tmp/hello-0.out
  1042. and the temporary files will be /tmp/hello.s0, /tmp/hello.s1, and
  1043. /tmp/hello.cfg
  1044.  
  1045.  
  1046.  
  1047. X. Further information
  1048.  
  1049. You may copy and distribute this program freely as well as modify it
  1050. for your purposes but you may NOT distribute hacked copies.  Instead
  1051. send all constructive comments to the me and I (bib) will try to
  1052. incorporate them into future releases (if any).  Your work will be
  1053. properly credited. Also see the disclaimer in the beginning of this
  1054. document. To  request your own copy send Email to:
  1055.  
  1056.            boyan@tmnxt1.iit.edu  
  1057.            boyaboy@karl.iit.edu          
  1058.            boyaboy@iitvax        (Bitnet)
  1059.  
  1060. or contact
  1061.  
  1062.            Boyan Boyanov
  1063.            Department of Physics
  1064.            Illinois Institute of Technology
  1065.            Chicago,IL 60616 USA
  1066.  
  1067.            phone   (312) 567-3398    
  1068.            fax     (312) 567-3396
  1069.  
  1070. This is the only way you are sure to have the latest (and hopefully the
  1071. least buggy) version of the program as well as any future upgrades.
  1072.  
  1073. Please direct all bug reports, suggestions for improvements, and
  1074. requests for further assistance (preferably via Email) to the above
  1075. addresses.  Do not be afraid to complain.  The program satisfies my
  1076. own needs in its present form and unless I receive substantial
  1077. feedback I will make no effort to change/improve anything.
  1078.  
  1079.  
  1080.  
  1081. XI. Acknowledgments
  1082.  
  1083. Some parts of this program  as well as this document itself have drawn
  1084. heavily from URGENT (R. Walker and B. Diviacco) and its supporting
  1085. documentation.  The author is greatly indebted to R. Walker
  1086. (Synchrotrone Trieste) for kindly giving his permission for this.
  1087. Thanks are due to Pathikrit Bandyopadhyay for thoroughly abusing the
  1088. code :-). The development of this program was supported in part by a gift
  1089. from Amoco Corporation.
  1090.  
  1091. To those of you who had the patience to read through this entire piece
  1092. of crap - thank you. Let me know if it was worth the effort.
  1093.  
  1094.  
  1095.  
  1096.  
  1097. APPENDIX A. Program diagnostics
  1098.  
  1099. Several diagnostic files are provided with the program:
  1100.         testbf.txt - sample b-field configuration
  1101.         txt2u.f - program to convert taper33.txt into binary format
  1102.         yaup.inp - sample input file
  1103.         yaup-0.out - output generated with yaup.inp and testbf.txt
  1104.        
  1105. To perform program diagnostics:
  1106.  
  1107. 1) Compile txt2u.f.  The same precautions should be used when
  1108. compiling TXT2U as when compiling yaup, i.e. use static allocation,
  1109. fold all variables to lower/upper case, and do not optimize.
  1110.  
  1111. 2) Run txt2u with the following input:
  1112.  
  1113. ------------------------------------------------------------
  1114. txt2u - convert text b-field files to YAUP format.
  1115.  
  1116. Input file name ? testbf.txt
  1117. Output file name ? test.bf
  1118. Magnet period (cm) ? 3.3
  1119. Number of periods ? 75
  1120. Number of points per period ? 40
  1121.  
  1122. Working...
  1123. Done.
  1124. ------------------------------------------------------------
  1125.  
  1126.  
  1127. TXT2U should create a b-field file called test.bf
  1128.  
  1129. 3) Run YAUP with the provided YAUP.INP.  This should produce the
  1130. following output on your screen
  1131.  
  1132. ------------------------------------------------------------
  1133.  
  1134. YAUP 1.3.1 - Yet Another (Useless) Undulator Program
  1135. Last modified on APR-13-94
  1136. Send bug reports to boyan@tmnxt1.iit.edu
  1137.  
  1138. ------------------------------------------------------------
  1139.  
  1140. Reading B-field distribution (in tesla) from file test.bf
  1141. Writing output to yaup-0.out
  1142.  
  1143. ------------------------------------------------------------
  1144.  
  1145. Beginning calculation of electron trajectory as a function
  1146. of the longitudinal  coordinate. The total undulator length
  1147. is  247.5 centimeters.
  1148.  
  1149.     Pass #     z(m)     % done        error (cm)
  1150.       3       2.474     100.0        2.249587E-03
  1151.  
  1152. Trajectory calculations completed.
  1153. Error after the final pass (cm) :   -7.657119E-11 ( 0.00 % )
  1154. Initial betax                   :    9.092205E-05
  1155. Final   betax                   :    7.673175E-05
  1156.  
  1157. ------------------------------------------------------------
  1158.  
  1159. Beginning zero-emittance brightness calculations.
  1160. emin =   7000.0   emax =  10000.0   ne = 201
  1161. xmin =   -.0480   xmax =   0.0000   nx =  30
  1162. ymin =   -.0180   ymax =   0.0000   ny =  12
  1163.  
  1164.    x (mrad/mm)  y (mrad/mm)  % done
  1165.      0.0000       0.0000      100.0                                  
  1166.  
  1167. ------------------------------------------------------------
  1168.  
  1169. Convoluting with the beam divergence.
  1170.  
  1171. energy (eV)            % done
  1172.     10000.              100
  1173.  
  1174. ------------------------------------------------------------
  1175.  
  1176. This calculation takes about 10 minutes on a 25 MHz 68040 NeXTStation.
  1177. If the output file (e.g. YAUP-1.OUT) does not reproduce the provided
  1178. YAUP-0.OUT with sufficient accuracy (1-2 % at the very least) you may
  1179. need to make some adjustments. Send DETAILED email to boyan@tmnxt1.iit.edu,
  1180. and I will try to help you solve the problem.
  1181.  
  1182.  
  1183.  
  1184.  
  1185. APPENDIX B. Error messages.
  1186.  
  1187. Some nice day when I have nothing better to do I'll describe all error
  1188. messages here.  Don't count on it though :-).
  1189.  
  1190.  
  1191. 07/94 Chicago b

Raw Paste


Login or Register to edit or fork this paste. It's free.