PyPSG

File Format

The input file format for PySPG simply consists on lines of text. The first non-blank character of each line is treated as the iteration type, and depending upon this, a different amount of parameters is needed: the different iteration types and parameters are shown in the following table. Please note that each argument is separed by any blank (spaces or tabs).

Examples

  1. A simulation in which D=0.4, k=0.2 are kept fixed and a varies linearly between 1 and 5 with a step of .2.

    :D   0.4
    :k   0.2
    +a   1 5 .2
    

  2. Now, D=0.4, k varies linearly between 0 and 3 step 0.25 anda varies geometrically beginning with 0.1 and finishng at 12.8 step 2.
    :D   0.4 
    +k   0.0 3.0 0.25
    *a   0.1 12.8 2.
    
  3. Finally, D=0.4, and D=0.6, The other parameters as in the previous example (the step of k is set to 1.). But the simulation mustbe repeated 100 times
    .D   0.4  0.6
    +k   0.0  3.0   1.
    *a   0.1  12.8  2.
    # 100
    

Storage of data

For each varying iterator type (i.e not ":" nor "#") a directory is created with the variable nameand its value. EXCEPT FOR THE LAST ITERATOR.

Examples

  1. For the file in Example 1: the output files are left in the CWD -just one varying iterator-
  2. For the file in Example 2: the following directories are created

    |
    +--   k-0.0
    +--   k-0.25
    +--   k-0.5
    +--   k-0.75
    +--   k-1.0
    +--   k-1.25
    +--   k-1.5
    +--   k-1.75
    +--   k-2.0
    +--   k-2.25
    +--   k-2.5
    +--   k-2.75
    +--   k-3.0
    
    And the output files are generated in each directory
  3. For the file in Example 3: the following directories are created
    |
    +--   D-0.4
    +------   k-0.0
    +------   k-1.0
    +------   k-2.0
    +------   k-3.0
    +--   D-0.6
    +------   k-0.0
    +------   k-1.0
    +------   k-2.0
    +------   k-3.0
    
THE OUTPUT (SDOUT) IS REDIRECTED TO A FILE YOU DEFINE. BY DEFAULT IS "out.dat". So if you just use write(*,*), printf(...) or whatever be the equivalent code of your language all the output will be appended to that file in the corresponding directory

Syntactic sugar

If you know python, it will be interesting for you to know that math is imported and that the way expressions are evaluated are through eval(). If you do not know python, first let me recommend you to learn it. Second, the first sentence of this paragraph means that you can use even expresions like these
+D   0. pi pi/20.
+k   sin(pi/4) exp(3**2) 0.5
WARNING!!! It is completely fundamental for you to remember that ANY BLANK (TAB or SPACES) IS TREATED AS SEPARATOR So, for example,
+D   0. pi pi/ 20.
will give an error. Such errors are easy to find. Easier (at least) than the work would imply coding a version of PySPG aware of them. Howerer, if you have suggestions on this topic, contact me.
Go back to the documentation page
© 2003-2005 Claudio J. Tessone