ne.gif (2791 bytes)     NE421 Introduction to Nuclear Criticality Safety

Return to Course Outline


 



Temple and Rof utilities

Two other potentially useful utilities that are buried inside NE421.jar are the Temple and Rof utilities.

In fact, I would go so far as to say that maybe these two utilities might be of use to you even if you never use Metric or Oktoc again, since they are just text file manipulators--Temple for the setup of text files and Rof for data mining from text files. But, at the very least, they should be of use to you in the homework and projects of this class.

Temple

Temple simply gives you the option of putting wildcards into the input deck and creating multiple versions of the input file. (I have heard people talk about a utility called WORM--write once run many--that serves the same purpose. I wrote this long before I heard of WORM, and I am putting it right into your lap, so do what you will...)

A simple example is all you really need, so here it is.

Start with the simple example of a sphere of U235:


=csas25 parm=centrm
Sphere of U235
44GROUPNDF5
read composition
U 1 1 293 92235 100 end
end composition
read param gen=100000 sig=0.001 npg=10000 nsk=3 tme=.1 end param
read geometry
 global unit 1
  sphere 1 1 6.5  
end geometry
end data
end

Let's assume you want to run a parametric study varying the radius of the sphere in unit 1. Rather than meticulously creating multiple versions of the input deck by hand, you can use Temple to do it for you.

  • The first step (at least for me, because it helps me organize my work), I copy an input file that works into a file with the ".tpl" extension, say "rad.tpl".
  • <
  • Next, I replace the entry I want to vary with a variable that begins with two ampersands:
  • 
    =csas25 parm=centrm
    Sphere of U235
    44GROUPNDF5
    read composition
    U 1 1 293 92235 100 end
    end composition
    read param gen=100000 sig=0.001 npg=10000 nsk=3 tme=.1 end param
    read geometry
     global unit 1
      sphere 1 1 &&rad  
    end geometry
    end data
    end  
    
  • Finally, I add a section to the end of the file that defines the variable (without the ampersands). If you put in:
  • 
    =csas25 parm=centrm
    Sphere of U235
    44GROUPNDF5
    read composition
    U 1 1 293 92235 100 end
    end composition
    read param gen=100000 sig=0.001 npg=10000 nsk=3 tme=.1 end param
    read geometry
     global unit 1
      sphere 1 1 &&rad  
    end geometry
    end data
    end  
    read variables
    rad = 6.5
    end variables
    

    and run it by entering "java -cp NE421.jar Temple rad.tpl", it will create a file named "rad-001.in" that looks just like your original input file.

Temple improvement #1: Enter multiple variables

But if you really want to run a parametric study, just change the rad variable to hold multiple values:


=csas25 parm=centrm
Sphere of U235
44GROUPNDF5
read composition
U 1 1 293 92235 100 end
end composition
read param gen=100000 sig=0.001 npg=10000 nsk=3 tme=.1 end param
read geometry
 global unit 1
  sphere 1 1 &&rad  
end geometry
end data
end  
read variables
rad = 4 4.5 5 5.5 6 6.5 7 7.5 8
end variables

With this change, the same command line execution of "java -cp NE421.jar Temple rad.tpl", will create files named "rad-001.in","rad-002.in", etc., one for each of the values of the variable rad.

Since the input file names are sequential but otherwise not informative, I suggest you change the title line to include the variable, like this:


=csas25 parm=centrm
Sphere of U235, rad = &&rad cm
44GROUPNDF5
read composition
U 1 1 293 92235 100 end
end composition
read param gen=100000 sig=0.001 npg=10000 nsk=3 tme=.1 end param
read geometry
 global unit 1
  sphere 1 1 &&rad  
end geometry
end data
end  
read variables
rad = 4 4.5 5 5.5 6 6.5 7 7.5 8
end variables

Not only will this help you document the input file, but we will find this useful for the Rof utility (to be described next).

But before we get to that, let's discuss...

Temple improvement #2: Calculating the variables

You can also put a little math into the definition of the variables, but you have to tell Temple you are doing it by putting the formula between two brackets

For example, what if we wanted the previous problem sphere to be reflected by a foot of water? We could do this with another variable,like this:


=csas25 parm=centrm
Sphere of U235, rad = &&rad cm
44GROUPNDF5
read composition
U 1 1 293 92235 100 end
h2o 2 1 293 end
end composition
read param gen=100000 sig=0.001 npg=10000 nsk=3 tme=.1 end param
read geometry
 global unit 1
  sphere 1 1 &&rad  
  sphere 2 1 &&radw  
end geometry
end data
end  
read variables
rad = 4 4.5 5 5.5 6 6.5 7 7.5 8
radw = [rad + 30.48 ]
end variables

Now, as the radius of the sphere changes, the radius of the water will always be a foot beyond it.

NOTE: Other ways this foot of water could be added are:


radw = [rad + 12 * 2.54 ]
radw = [rad + 12 * 1IN ]
radw = [rad + 12IN ]
radw = [rad + 1FT ]
radw = [rad + 1FT0IN ]

Notice that the IN and FT have to be tacked onto the end of the number. No spaces allowed!

Temple also understands:

  • 4 + 5
  • 4 - 5
  • 4 * 5
  • 4 / 5
  • 4 ^ 5
  • 4 * (2+3)

(Conventional order of operations applies.)

Final note: For the truly lazy (like me), Temple creates a batch file named "Runit.bat" that will (on a PC system at least) run all of the created files, one after the other.

Rof

Rof (I think I intended "read only file", but I don't remember) is the back-end counterpart to Temple, that reads useful information from text files.

(Again, many people I know pull this off with script files of various sorts but, again, I have this so I use it--and offer it to you if you think it will be useful.)

Like Temple, Rof involves creating a text file and including variables that start with two ampersands.

And like Temple, I think it is best shown with an example.

The example that is immediately at hand is to read the data that is created by the final Oktoc banner. Remember that it looks like this:


       ******************************************************************************************************************** 
       ***                                                                                                              *** 
       ***                                  ******      Final Results Table      ******                                 *** 
       ***                                                                                                              *** 
       ***        Best estimate system k-eff                                  0.68827 + or -  0.00115 ( =  0.69058 )    *** 
       ***                                                                                                              *** 
       ***        Energy of average lethargy of Fission (eV)                15238.198 + or -  339.004                   *** 
       ***                                                                                                              *** 
       ***        System nu bar                                               2.56146 + or -  0.00057                   *** 
       ***                                                                                                              *** 
       ***        Fissile material mean free path (cm)                        2.35226 + or -  0.00267                   *** 
       ***                                                                                                              *** 
       ******************************************************************************************************************** 
       ***                                                                                                              *** 
       ***                                            FISSILE MATERIAL BALANCE                                          *** 
       ***                                                                                                              *** 
       ***                           Fission neutron production (F)   1.00000                                           *** 
       ***                                           Absorption (A)   0.45273 + or -  0.00126                           *** 
       ***                         Fissile material net leakage (L)   1.00044 + or -  0.00126                           *** 
       ***                                                  Out    +  1.26972 + or -  0.00120                           *** 
       ***                                                   In    -  0.26927 + or -  0.00148                           ***                                                                                                              *** 
       ***                                                                                                              *** 
       ******************************************************************************************************************** 
       ******************************************************************************************************************** 
 
********************************************************************************************************************************** 
          congratulations!  you have  successfully traversed the easy path through Oktoc in only 0.25765 minutes 
********************************************************************************************************************************** 

I copied these lines into a file named 'oktoc.pat', trimmed it down to the lines with the data I wanted, and added variables to get:


       ***        Best estimate system k-eff                                  &&keff + or -  &&kSD ( =  &&k2xSD
       ***        Energy of average lethargy of Fission (eV)               &&ealf + or -         &&ealfSD 
       ***        System nu bar                                               &&nu + or -  &&nuSD 
       ***        Fissile material mean free path (cm)                        &&mfp + or -  &&mfpSD 
       ***                           Fission neutron production (F)   &&F 
       ***                                           Absorption (A)   &&A + or -  &&ASD
       ***                         Fissile material net leakage (L)   &&L + or -  &&LSD
       ***                                                  Out    +  &&Lplus + or -  &&LplusSD 
       ***                                                   In    -  &&Lminus + or -  &&LminusSD                                                                                                              *** 
congratulations!  you have  successfully traversed the ? path through ? ? in &&min minutes 

A couple of notes from the example above:

  • The pattern for each line only has to go as far as the variables you want. The rest of the line doesn't matter (unless it is needed to keep LOTS of lines from fitting the pattern--you get a row for each fit, so it is best to have only ONE line in the output file that fits) , and might hurt because...
  • The words on the line (other than the variable itself) have to have EXACT agreement with what is in the output file. So, for example, it cannot contain any text that changes, except that...
  • You can put in '?' to denote text tokens (single strings of characters) that might change. I did it in the example (last line) so that I can use it for SCALE output as well. SCALE's line with the execution time actually reads 'congratulations! you have successfully traversed the perilous path through keno v in x.xxxxx minutes', so I modified the last line so it could read SCALE output as well as OKTOC output.

When you execute this, you can use wild cards to denote the files to look in. For example, for the multiple-radius example from the Temple part above, this would be a command-line entry of 'java -cp NE421.jar Rof oktoc.pat rad*.out'.

Then it will look in all of the files in the directory that fit this pattern. (If it doesn't find a specific data variable in the .pat file, it just moves on, rather than failing.)

The result of the search are put into an EXCEL file with the name 'rof.csv' (for comma-separated-version, I suppose). You can open it as a (simplified) EXCEL file simply by typing (at the command line) 'rof.csv'.

For the Temple example (with the &&rad but not the &&radw), the resulting EXCEL spreadsheet has a first column of the file names, a second column that are the case k-effective values, followed by the standard deviation, etc., to the last variable (min).

This is useful, of course, but--as I mentioned in the Temple example--the case name might not be very informative.

So, what I generally do is to--like the Temple example above--add the important variable(s) to the title like and then add the title line from the '.tpl' file to the start of the 'oktoc.pat' file (which I then usually name 'this.pat' because I have no imagination).

For the rad.tpl example, the resulting 'this.pat' would look like this:


Sphere of U235, rad = &&rad cm
       ***        Best estimate system k-eff                                  &&keff + or -  &&kSD ( =  &&k2xSD
       ***        Energy of average lethargy of Fission (eV)               &&ealf + or -         &&ealfSD 
       ***        System nu bar                                               &&nu + or -  &&nuSD 
       ***        Fissile material mean free path (cm)                        &&mfp + or -  &&mfpSD 
       ***                           Fission neutron production (F)   &&F 
       ***                                           Absorption (A)   &&A + or -  &&ASD
       ***                         Fissile material net leakage (L)   &&L + or -  &&LSD
       ***                                                  Out    +  &&Lplus + or -  &&LplusSD 
       ***                                                   In    -  &&Lminus + or -  &&LminusSD                                                                                                              *** 
congratulations!  you have  successfully traversed the ? path through ? ? in &&min minutes 

and the resulting 'rof.csv' will include a column for the 'rad' variable that identifies the cases. (Suitable for creating those EXCEL plots I am always asking for.)