AcGrace NRC Analysis Code EXTENSIONS


Introduction:

AcGrace is the NRC Analysis Code version of Grace which has been modified to provide direct interfaces to NRC analysis codes, NRC Databank files, the Symbolic Nuclear Analysis Package (SNAP), and to provide an easier means of performing calculations using data from these files.  AcGrace is a decendent of Xmgr5 which was created from the xmgr software was originally developed by Paul Turner, and later maintained by the Xmgr Team, coordinated by Evgeny Stambulchik.

The Analysis Code Extensions made to Grace to create AcGrace include:

The AcGrace distribution also includes several Utility Programs used to convert RELAP5, TRAC, VICTORIA and MELCOR data files into compressed, demultiplexed, machine independent binary data formats.  Demultiplexed data files can provide a significant improvement in performance over the multiplexed files generated directly by the analysis codes.

The distribution also includes several Example script files demonstrating the calculational capabilities of AcGrace.

Questions or comments concerning these extensions should be referred to:

        Ken Jones
        e-mail: krjones@appliedprog.com
        voice: (570)204-4052


Summary of Updates and Bug Fixes.

AcGrace 5.1.12D:

AcGrace 5.1.12C:

AcGrace 5.1.12B:

AcGrace 5.1.12A: AcGrace 5.1.9D: AcGrace 5.1.9C: AcGrace 5.1.9B: AcGrace 5.1.9A: AcGrace 5.1.8A: Initial Version AcGrace 5.1.4A:

Additions to the Interactive Interface

The File menu has been extended to include options to open graphics files generated by several analysis codes and to connect to calculations and experimental data through CORBA interfaces.  The Data menu has also been extended allow data channels to be selected from these files and data connections.

Connect To... Menu

The Connect To... menu item located under the File pulldown menu has been added to provide interactive access to CORBA interfaces.  These include the NRC Databank, the SNAP Calculation servers, and calculations archived in the SNAP database.

NRC Databank

Located under the Files/Connect To... pulldown menu, this option will provide a dialog box that can be used to open a connection to the NRC Databank.  The name and port number of the NRC Databank Server are specified in the .Xdefaults file.  The following entries identify am NRC Databank server running on port 5010 of RES15.usnrc.gov:
XMgrace.nrcDbServer:   RES15.usnrc.gov
XMgrace.nrcDbPort:   5010
The port number for the NRC Databank server will default to 5010 if left unspecified.

Up to 10 experimental data sources numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the source ID number on this menu, or specify that the next available ID be used.  A source location must be specified to identify the server to connect to.  A list of calculations that are either running of have been completed is displayed for the selected server.  Select a run and press the Accept button to attach to a calculation.

Calculation Servers

Located under the Files/Connect To... pulldown menu, this option will provide a dialog box that can be used to open connections to SNAP calculation servers.  If the user is not logged onto the SNAP database, the user will be prompted for a SNAP user id and password.  This logon is used to obtain the list of active calculation servers and to authenticate access to calculations.  The name and port number of the SNAP Database Server are specified in the .Xdefaults file.  The following entries identify a SNAP Database server running on port 5005 of RES15.usnrc.gov:
XMgrace.snapDbServer:   RES15.usnrc.gov
XMgrace.snapDbPort:   5005
The port number for the SNAP Database server will default to 5005 if left unspecified.

The no database server if specified, or the database logon is unsuccessful, a list of up to 10 calculation servers may be specified in the .Xdefaults file.  Entries in the form of 'XMgrace.snapCalcServerN' where N varies from 0 to 9 are used to specifiy the server names.  The port numbers are specified by entries in the form 'XMgrace.snapCalcPortN'.  The port numbers default to 5006 and should not be changed except for debugging purposes.  For example, the following entries identify five SNAP Calculation servers running each running on port 5006 with the exception of bambi which is running on port 6006:

XMgrace.snapCalcServer0:   RES15
XMgrace.snapCalcServer1:   k9.scientech.com
XMgrace.snapCalcServer2:   bambi
XMgrace.snapCalcServer3:   RES23
XMgrace.snapCalcServer4:   taz
XMgrace.snapCalcPort2:   6006
Please note that the calculation servers specified in the .Xdefaults file are only used in the event that a SNAP database connection is not made.  In this case, the user will only have access to data sources with public read access.

Up to 10 data sources numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the source ID number on this menu, or specify that the next available ID be used.  A source location must be specified to identify the server to connect to.  A list of calculations that are either running of have been completed is then displayed for the selected server.  Select a run and press the Accept button to attach to a calculation.

To avoid multiple logons when launching AcGrace from other SNAP software components, a SNAP database connection may be passed to AcGrace by including "-snapdb <ior>" on the command line where  <ior>  is a stringified CORBA reference to an existing database interface object.

SNAP Archive

Located under the Files/Connect To... pulldown menu. Although not currently implemented, this option will provide a dialog box that can be used to open a calculation that has been archived to the SNAP Database.
 

Read Menu Additions

Eight menus have been added to the AcGrace user interface to allow Analysis Code and NRC database files to be read directly into AcGrace data sets.

Read RELAP data

Located under the Files/Read pulldown menu. This option will open a file selection menu used to open RELAP5 data files. The user must indicate whether the file is a restart plot file, a demultiplexed restart plot file, a strip file written in SI units, or a strip file written in british units. Up to 10 RELAP5 files numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the file ID number on this menu, or specify that the next available ID be used.
 

Read MELCOR data

Located under the Files/Read pulldown menu. This option will open a file selection menu used to open MELCOR data files. The user must indicate whether the file is a MELCOR plot file, or a demultiplexed plot file. Up to 10 MELCOR files numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the file ID number on this menu, or specify that the next available ID be used.
 

Read TRAC data

Located under the Files/Read pulldown menu. This option will open a file selection menu used to open TRAC data files. The user must indicate whether the file is a trcgrf plot file, a demultiplexed plot file created by trcgrf2dmx or an XTV plot file (may be multiplexed or de-multiplexed). Up to 10 TRAC files numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the file ID number on this menu, or specify that the next available ID be used.
 

Read FRAPCON data

Located under the Files/Read pulldown menu. This option will open a file selection menu used to open FRAPCON data files. Up to 10 FRAPCON files numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the file ID number on this menu, or specify that the next available ID be used.
 

Read SINDA data

Located under the Files/Read pulldown menu. This option will open a file selection menu used to open SINDA data files. Up to 10 SINDA files numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the file ID number on this menu, or specify that the next available ID be used.

Read VICTORIA data

Located under the Files/Read pulldown menu. This option will open a file selection menu used to open VICTORIA data files. The user must indicate whether the file is a native VICTORIA plot file, or a demultiplexed plot file created bi vic2dmx.  Up to 10 VICTORIA files numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the file ID number on this menu, or specify that the next available ID be used.
 

Read COBRA-TF data

Located under the Files/Read pulldown menu. This option will open a file selection menu used to open COBRA-TF data files. Up to 10 COBRA-TF files numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the file ID number on this menu, or specify that the next available ID be used.
 

Read CONTAIN data

Located under the Files/Read pulldown menu. This option will open a file selection menu used to open CONTAIN data files. Up to 10 CONTAIN files numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the file ID number on this menu, or specify that the next available ID be used.
 

Read Database data

Located under the Files/Read pulldown menu. This option will open a file selection menu used to open NRC Databank data files. Up to 10 NRC Databank files numbered 0 to 9, may be opened simultaneously. The user may either explicitly specify the file ID number on this menu, or specify that the next available ID be used.
 

Data Menu Additions

Data Connections Menu

This menu option provides menu options for access of NRC Databank and SNAP Calculation server data channels.

NRC Databank Data

This menu option is used to select data channels from open NRC Databank connections.  The active data connection may be changed using the "Use Experiment" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. The user may select between time, power and burnup for the independent variable using the X-Axis Variable button. Additional menu options are similar to those described below for the RELAP Data menu.

Calculation Server Data

This menu option is used to select data channels from open Calculation Server connections.  The active data connection may be changed using the "Use Experiment" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. The user may select between time, power and burnup for the independent variable using the X-Axis Variable button. Additional menu options are similar to those described below for the RELAP Data menu.

RELAP data

Located under the Data pulldown menu. This option will open a menu used to select RELAP5 data channels. The active RELAP5 file may be changed using the "Use File" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. A filter string may be entered to reduce the number of channels displayed on the menu. The filter string follows the awk language search variable syntax. Examples include:
  mflowj-10*    display only channels that start with
                "mflowj-10"
  mflowj-[68]*  display only channels that start with
                "mflowj-" and have a 6 or 8 as the next
                character.
The "Clear Selections" button clears any currently selected channels. "Clear Current Sets" deletes all sets from the current graph. Either SI or British units may be selected from a radio box. Appropriate conversion factors and y-axis units will be applied to the raw data channels. A pop-up menu allows the user to select the desired time scale units.
 

MELCOR data

Located under the Data pulldown menu. This option will open a menu used to select MELCOR data channels. The active data file may be changed using the "Use File" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. Menu options are similar to those described above for the RELAP Data menu.

TRAC data

Located under the Data pulldown menu. This option will open a menu used to select TRAC data channels. The active data file may be changed using the "Use File" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. Menu options are similar to those described above for the RELAP Data menu.

The following namining convention is employed for TRAC-M variables:

TRAC-M Variables
Dimension Variable CCC SSS III JJJ KKK
0D var-CCC component number non-existant non-existant non-existant non-existant
1D var-CCCIII component number   axial index    
2D var-CCCIIIJJJ component number   axial index radial index  
3D var-CCCIIIJJJKKK component number   axial index radial index theta index
0D var-CCCSSS component number sub-component number (rod) non-existant non-existant non-existant
1D var-CCCSSSIII component number sub-component number (rod) axial index    
2D var-CCCSSSIIIJJJ component number sub-component number (rod) axial index radial index  
3D var-CCCSSSIIIJJJKKK component number sub-component number (rod) axial index radial index theta index

FRAPCON data

Located under the Data pulldown menu. This option will open a menu used to select FRAPCON data channels. The active data file may be changed using the "Use File" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. The user may select between time, power and burnup for the independent variable using the X-Axis Variable button. Additional menu options are similar to those described above for the RELAP Data menu.
 

SINDA data

Located under the Data pulldown menu. This option will open a menu used to select SINDA data channels. The active data file may be changed using the "Use File" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. The user may select between time, power and burnup for the independent variable using the X-Axis Variable button. Additional menu options are similar to those described above for the RELAP Data menu.

VICTORIA data

Located under the Data pulldown menu. This option will open a menu used to select VICTORIA data channels. The active data file may be changed using the "Use File" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. Additional menu options are similar to those described above for the RELAP Data menu.

The following naming convention is used to represent VICTORIA data channels:

varname[-subscript1][-subscript2][-iiijjj]

Where:

varname is the name of the variable.
-subscript1 is an optional qualifier that contains a named subscript of  either SPEC, ELEM, COMP or ELEM.
-subscript2 is an optional qualifier that contains a named subscript of  either  SECT, NODE or FNODE.
-jjjiii is an optional qualifier that identify the J and I coordinates.

COBRA-TF data

Located under the Data pulldown menu. This option will open a menu used to select COBRA-TF data channels. The active data file may be changed using the "Use File" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. Menu options are similar to those described above for the RELAP Data menu.

The following namining convention is employed for COBRA-TF variables:
 

COBRA-TF Variables
Component Type Variable i j k
Channel var-iiijjj Channel Number Vertical Node non-existant
Gap var-iiijjj Gap Number Vertical Node
Heat Structure var-iiijjjkkk Rod Number Surface Number Vertical Node


 

CONTAIN data

Located under the Data pulldown menu. This option will open a menu used to select CONTAIN data channels. The active data file may be changed using the "Use File" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. Menu options are similar to those described above for the RELAP Data menu.

CONTAIN data channels utilize the following namming convention:

Ffff[_Cccc][_keyword1][_keyword2]

where:

fff is the plot flag used to identify the type of data.

ccc is the cell number (optional).

keyword1 is the first keyword value (optional).

keyword2 is the second keyword value (optional).

Please refer to Table 16.1 of the CONTAIN 2.0 Code Manual, NUREG/CR-6533, for the list of available flag types and associated keyword values.
 

NRC Database data

Located under the Data pulldown menu. This option will open a menu used to select NRC Databank data channels. The active NRC Databank file may be changed using the "Use File" button. Channels are selected by placing the mouse pointer over the desired channel name and pressing the left mouse button. A filter string may be entered to reduce the number of channels displayed on the menu. The filter string follows the awk language search variable syntax.

The "Clear Selections" button clears any currently selected channels. "Clear Current Sets" deletes all sets from the current graph. Either SI or British units may be selected from a radio box. Appropriate conversion factors and y-axis units will be applied to the raw data channels. A pop-up menu allows the user to select the desired time scale units.

 An "Interpolate/Decimate/Filter" button is used to access an option menu used to control processing of the data as it is read. The Skip factor is used with the decimate option, while the Begin, End and Step values are used with the interpolate option. A digital filter with up to 30 weighting factors may also be used. These options are further discussed below.
 


Additions to the Command Interpreter

The RELAP5 and NRC Databank interfaces can also be accessed though the command interpreter. The additions to the command interpreter that are used for these interfaces are documented in this section. The additions to the command interpreter that are used for the Equation Interpreter are documented in the next section.

RELAP5 Commands

RELAP [fileno] filetype "filename"

Open a RELAP5 data file.
Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   filetype = restart - RELAP5 restart files
              demux   - Demultiplexed RELAP5 restart files
              strip   - RELAP5 strip files (with SI data)
              stripb  - RELAP5 strip files (with British data)
   "filename" = RELAP5 file name. 
                Note, the file name must be in quotes.

RREAD [fileno] ["channel"] [units_type]

Specify a RELAP5 data channel and/or the type of units.
 Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "channel" = RELAP5 data channel.  Note, the name must be in
               quotes.
   units_type = si      Convert to SI units (default).
                british Convert to british units.
                done    Process RELAP5 data channels.
Specifying the units_type without a RELAP5 channel name will change the default units type. e.i.
     RREAD british
Specifying the units_type following the RELAP5 channel name will change the units type for that channel only. e.i.
     RREAD "p-100020000" british
The key word, done, must follow the list of RELAP5 data channel names. It instructs the software to load the data corresponding to the selected RELAP5 channel names into data sets. The done keyword may be entered either with the last channel name or on a subsequent RREAD line.

RTIME time_units

Set the units type for the time axis.
 Where:
   time_units = seconds
                minutes
                hours
                days
                fortnights

RSIZE [fileno] number

Change the default memory requirements for RELAP5 data.
 Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   number = maximum number of points to be entered per data
            channel.  (default = 10000).
RELAP5 STRIP are read completely into memory. The memory requirements for STRIP can be determined from:

 Total memory requirement = (# of channels on strip file) * RSIZE * (# of bytes/float)

 It may be desirable to increase RSIZE to read data sets containing more than 10000 time frames or to decrease RSIZE to increase program efficiency if shorter data sets are used.

MELCOR Commands

MELCOR [fileno] filetype "filename"

Open a MELCOR data file.
Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   filetype = PTF - MELCOR plot files
              demux   - Demultiplexed MELCOR plot files
   "filename" = MELCOR file name. 
                Note, the file name must be in quotes.

MREAD [fileno] ["channel"] [units_type]

Specify a MELCOR data channel and/or the type of units.

 Where:

   fileno = Integer value between 0 and 9 identifying the file
            number.
   "channel" = MELCOR data channel.  Note, the name must be in
               quotes.
   units_type = si      Convert to SI units (default).
                british Convert to british units.
                done    Process MELCOR data channels.
Specifying the units_type without a MELCOR channel name will change the default units type. e.i.
     MREAD british
Specifying the units_type following the MELCOR channel name will change the units type for that channel only. e.i.
     MREAD "BUR-N-SE_107" british
The key word, done, must follow the list of MELCOR data channel names. It instructs the software to load the data corresponding to the selected MELCOR channel names into data sets. The done keyword may be entered either with the last channel name or on a subsequent MREAD line.

MSIZE [fileno] number

Change the default memory requirements for MELCOR data.
 Where:
   number = maximum number of points to be entered per data
            channel.  (default = 10000).

TRAC Commands

TRAC [fileno] filetype "filename"

Open a TRAC data file.
Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   filetype = TRCGRF - TRCGRF plot files
              DEMUX  - Demultiplexed TRCGRF plot files created
                       with trcgrf2dmx
              XTV    - XTV files written with XDR (iogrf=2) or
                       demultiplexed XTV files created with
                       xtv2dmx
   "filename" = TRAC file name. 
                Note, the file name must be in quotes.

TREAD [fileno] ["channel"] [units_type]

Specify a TRAC data channel and/or the type of units.
 Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "channel" = TRAC data channel.  Note, the name must be in
               quotes.
   units_type = si      Convert to SI units (default).
                british Convert to british units.
                done    Process MELCOR data channels.
Specifying the units_type without a TRAC channel name will change the default units type. e.i.
     TREAD british
Specifying the units_type following the TRAC channel name will change the units type for that channel only. e.i.
     TREAD "TWALL-010101" british
The key word, done, must follow the list of TRAC data channel names. It instructs the software to load the data corresponding to the selected TRAC channel names into data sets. The done keyword may be entered either with the last channel name or on a subsequent TREAD line.

TSIZE [fileno] number

Change the default memory requirements for TRAC data.
 Where:
   number = maximum number of points to be entered per data
            channel.  (default = 10000).

FRAPCON Commands

FRAPCON [fileno] "filename"

Open a FRAPCON data file.
Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "filename" = FRAPCON file name. 
                Note, the file name must be in quotes.

FCREAD [fileno] ["channel"] [units_type]

Specify a FRAPCON data channel and/or the type of units.
 Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "channel" = FRAPCON data channel.  Note, the name must be in
               quotes.
   units_type = si      Convert to SI units (default).
                british Convert to british units.
                done    Process FRAPCON data channels.
The key word, done, must follow the list of FRAPCON data channel names. It instructs the software to load the data corresponding to the selected FRAPCON channel names into data sets. The done keyword may be entered either with the last channel name or on a subsequent FCREAD line.

FCINDP x-axis

Set the independent variable type for FRAPCON data.
 Where:
   x-axis = time   Use time in seconds (default).
            power  Use linear power in kw/m or kw/ft.
            burnup Use burnup in MWD/kg.

VICTORIA Commands

VICTORIA [fileno] filetype "filename"

Open a VICTORIA data file.
Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   filetype = NATIVE - Native VICTORIA plot files
              DEMUX  - Demultiplexed VICTORIA plot files created
                       with vic2dmx
   "filename" = VICTORIA file name. 
                Note, the file name must be in quotes.

VREAD [fileno] ["channel"] [units_type]

Specify a VICTORIA data channel and/or the type of units.
 Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "channel" = VICTORIA data channel.  Note, the name must be in
               quotes.
   units_type = si      Convert to SI units (default).
                british Convert to british units.
                done    Process VICTORIA data channels.
Specifying the units_type without a VICTORIA channel name will change the default units type. e.i.
     VREAD british
Specifying the units_type following the VICTORIA channel name will change the units type for that channel only. e.i.
     VREAD "PV-0002001" british
The key word, done, must follow the list of VICTORIA data channel names. It instructs the software to load the data corresponding to the selected VICTORIA channel names into data sets. The done keyword may be entered either with the last channel name or on a subsequent VREAD line.

VSIZE [fileno] number

Change the default memory requirements for VICTORIA data.
 Where:
   number = maximum number of points to be entered per data
            channel.  (default = 10000).

COBRA-TF Commands

COBRATF [fileno] "filename"

Open a COBRA-TF data file.
Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "filename" = COBRA-TF file name. 
                Note, the file name must be in quotes.

COBRAREAD [fileno] ["channel"] [units_type]

Specify a COBRA-TF data channel and/or the type of units.
 Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "channel" = COBRA-TF data channel.  Note, the name must be in
               quotes.
   units_type = si      Convert to SI units (default).
                british Convert to british units.
                done    Process COBRA-TF data channels.
Specifying the units_type without a COBRA-TF channel name will change the default units type. e.i.
     COBRAREAD british
Specifying the units_type following the COBRA-TF channel name will change the units type for that channel only. e.i.
     COBRAREAD "tclad-002001" british
The key word, done, must follow the list of COBRA-TF data channel names. It instructs the software to load the data corresponding to the selected COBRA-TF channel names into data sets. The done keyword may be entered either with the last channel name or on a subsequent COBRAREAD line.

COBRASIZE [fileno] number

Change the default memory requirements for COBRA-TF data.
 Where:
   number = maximum number of points to be entered per data
            channel.  (default = 10000).

CONTAIN Commands

CONTAIN[fileno] "filename"

Open a CONTAIN data file.
Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "filename" = CONTAIN file name. 
                Note, the file name must be in quotes.

CONTAINREAD [fileno] ["channel"] [units_type]

Specify a CONTAIN data channel and/or the type of units.
 Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "channel" = CONTAIN data channel.  Note, the name must be in
               quotes.
   units_type = si      Convert to SI units (default).
                british Convert to british units.
                done    Process CONTAIN data channels.
Specifying the units_type without a CONTAIN channel name will change the default units type. e.i.
     CONTAINREAD british
Specifying the units_type following the CONTAIN channel name will change the units type for that channel only. e.i.
     CONTAINREAD "F101_C001" british
The key word, done, must follow the list of CONTAIN data channel names. It instructs the software to load the data corresponding to the selected CONTAIN channel names into data sets. The done keyword may be entered either with the last channel name or on a subsequent CONTAINREAD line.
 

Connection Commands

CONNECT SNAP [srcno] "src_name" "run_name"

Open a SNAP data source.
Where:
   srcno = Integer value between 0 and 9 identifying the source
           number.
   "src_name" = SNAP data source name (must be in quotes).
   "run_name" = The name of the calculation (must be in quotes).

CONNECT SNAP srcno

Change the active SNAP data source number.
Where:
   srcno = Integer value between 0 and 9 identifying the source
           number.

READSNAP [srcno] ["channel"] [units_type]

Specify a SNAP data channel and/or the type of units.
 Where:
   srcno = Integer value between 0 and 9 identifying the source
            number.
   "channel" = SNAP data channel.  Note, the name must be in
               quotes.
   units_type = si      Convert to SI units (default).
                british Convert to british units.
                done    Process SNAP data channels.
The key word, done, must follow the list of SNAP data channel names. It instructs the software to load the data corresponding to the selected SNAP channel names into data sets. The done keyword may be entered either with the last channel name or on a subsequent IREAD line.

CONNECT NRCDB [srcno] "facility_name" "experiment_name"

Open an NRC Databank server data source.
Where:
   srcno = Integer value between 0 and 9 identifying the source
           number.
   "facility_name" = The name of the facility (must be in quotes).
   "experiment_name" = The name of the experiment (must be in quotes).

CONNECT NRCDB srcno

Change the active NRC Databank source number.
Where:
   srcno = Integer value between 0 and 9 identifying the source
           number.

READNRCDB [srcno] ["channel"] [units_type]

Specify an NRC Databank server data channel and/or the type of units.
 Where:
   srcno = Integer value between 0 and 9 identifying the source
            number.
   "channel" = NRD Databank data channel.  Note, the name must be in
               quotes.
   units_type = si      Convert to SI units (default).
                british Convert to british units.
                done    Process SNAP data channels.
The key word, done, must follow the list of SNAP data channel names. It instructs the software to load the data corresponding to the selected SNAP channel names into data sets. The done keyword may be entered either with the last channel name or on a subsequent IREAD line.

NRC Databank Commands

NRCDB [fileno] "filename"

Open an NRC Database data file.
Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "filename" = NRC Database file name. Note, the file name must
                be in quotes.

NREAD [fileno] ["channel"] [units_type]

Specify an NRC Database data channel and/or the type of units.
 Where:
   fileno = Integer value between 0 and 9 identifying the file
            number.
   "channel" =  NRC Database data channel.  Note, the name must
                be in quotes.
   units_type = si      Convert to SI units (default).
                british Convert to british units.
                done    Process RELAP5 data channels.
Specifying the units_type without a data channel name will change the default units type. e.i.
     NREAD british
Specifying the units_type following the NRC Databank channel name will change the units type for that channel only. e.i.
     NREAD "PV-270" british
The key word, done, must follow the list of data channel names. It instructs the software to load the data corresponding to the channels into data sets. The done keyword may be entered either with the last channel name or on a subsequent NREAD line.

INTERPOLATE begin end step

Interpolate an NRC Databank channel to obtain a fixed set of x values on an NREAD. This option overrides a DECIMATE command and remains in effect for all NREAD commands until turned off.
 Where:
   begin = the start time.  This value should be entered in
           seconds.
   end = the end time.  This value should be entered in seconds.
   step = the size of a time step.  This value should be entered
          in seconds.  A value of 0.0 will turn off this option.

DECIMATE n

Skip values an NRC Databank channel to obtain a fixed set of x values on an NREAD. This option overrides an INTERPOLATE command and remains in effect for all NREAD commands, until turned off.
 Where:
   n = skip factor.  A value of 2 will force future NREAD commands
       to skip every other point.  A value of 0 will turn off
       this option.

DIGFLTR onoff

Turn the digital filter on or off. This digital filter is only applied to NRC Databank channels during an NREAD command.

DFWEIGHT n weight

Enter a weighting factor for the digital filter.
 Where:
   n = weight index.  Should be an integer value between 0 and
                      the n-1 where n is the number of points in
                      the filter.  A maximum of 99 weighting
                      factors may be used.
   weight = weighting factor.  The weighting factor for this
                      position.  The sum of all weighting
                      factors should total to 1.0.
e.i. The following commands create and activate a digital filter with seven points that will be applied during future NREAD commands.
    DFWEIGHT   0   0.01881066
    DFWEIGHT   1   0.113684
    DFWEIGHT   2   0.226243
    DFWEIGHT   3   0.282525
    DFWEIGHT   4   0.226243
    DFWEIGHT   5   0.113684
    DFWEIGHT   6   0.01881066
    DIGFLTR ON

DFBOXCAR n

Create and activate a digital filter with uniform weighting factors.
 Where:
   n = # of weights.  Should be an integer value between 1 and
                      the 99.  n uniform weighting factors with
                      values of 1/n are applied to the data.
e.i. The following commands create and activate a digital filter with 9 points that will be applied during future NREAD commands.
    DFBOXCAR  9

Equation Interpreter

Although AcGrace provides fairly extensive capability to manipulate data channels, there are two drawbacks associated with using AcGrace to perform calculations: An equation interpreter has been added to AcGrace to resolve these problems, and to permit the user to more easily manipulate data obtained from RELAP5 and the NRC Databank. The features incorporated into this interpreter include: Using the equation interpreter, the previous example can then be written as follows:
   RELAP 0 restart "rstplt"
   CALC "<deltaP_dome> = R0_p-10102000 - R0_p-10103000" 
   PLOTVAR "<deltaP_dome>"
   REDRAW

Equation Interpreter Commands

CALC "eqn"

Evaluate a user defined equation containing functions, operators and symbolic variables.
 Where:
   "eqn" is a user defined equation.
Symbolic variables can be either:
  • scalars - such as Psat

  •  
  • RELAP5 channels - such as R0_p-102010000, these are the RELAP5 channel names prefixed by "Rn_" where n corresponds to the RELAP5 file number (0-9).

  •  
  • TRAC channels - such as T0_twall-102010, these are the TRAC channel names prefixed by "Tn_" where n corresponds to the TRAC file number (0-9).

  • An elevation value may be specified in meters for heat structure and fuel rod variables that contain an axial index by adding an "@elev" to the end of the variable name.  This will be used to calculate the value of the variable at a fixed elevation as TRAC-M performs coarse/fine re-nodalization of the model.  In this case, an axial index value of 001 must be specified.   For example, T0_rftn991006001022@0.5, represents the value of rftn for radial node 22 of rod number 6 of component 991 interpolated over the axial nodes at a fized elevation of 0.5 m.
     
  • MELCOR channels - such as M0_(HS-TEMP_801), these are the MELCOR channel names prefixed by "Mn_(" and ends with a ")" where n corresponds to the MELCOR file number (0-9).

  •  
  • FRAPCON channels - such as F0_hoop_strain_08, these are the FRAPCON channel names prefixed by "Fn_" where n corresponds to the FRAPCON file number (0-9).

  •  
  • SINDA channels - such as S0_temp_HC_01, these are the SINDA channel names prefixed by "Sn_" where n corresponds to the SINDA file number (0-9).

  • COBRA-TF channels - such as tclad_001002002, these are the COBRA-TF channel names prefixed by "Cn_" where n corresponds to the COBRA-TF file number (0-9).


  • CONTAIN channels - such as CN0_(F101_C001), these are the CONTAIN channel names prefixed by "CNn_(" where and eding with a ")" where n corresponds to the CONTAIN file number (0-9).


  • nrcdb channels - such as N0_(TW-123). In this case the NRC Databank channel name is prefixed by "Nn_(" and ends with a ")" where n is the NRC Databank file number (0-9).

  •  
  • AcGrace data sets - the syntax for data sets is "gm.sn" where m is the graph number and n is the set number. A variable such as g0.s2 will correspond to the data contained in set number 2 of graph number 0.

  •  
  • vectors or channels - such as <Psat>, must be enclosed with <> typically used to store results of calculations.
  • Examples include:
           RELAP 0 restart "relap_rst1"
           NRCDB 0 "osu_data"
           CALC "<deltaP> = R0_p-102010000 - N0_(P-123)"
           CALC "<deltaP> = <deltaP>^2 * 12.0"
           CALC "<result> = <deltaP> >= 1.e6"
     
    Note:
  • Everything within the quotes is case sensitive this includes function calls and variable names.
  • A line continuation symbol "\" can be used to create multi-line equations. It must be the last character entered on the line.
  • Whenever an operator acts on two channels, interpolation is automatically performed to ensure the operator is applied to y values with common x values. The resultant channel contains the x values from the first argument that are contained within the range of the second argument.
  • Data may not be assigned to either RELAP5 or NRC Databank channels. For example, expressions such as "R0_p-102010000 = <deltaP>" are not permitted.
  • PLOTVAR "var"

    Load a user defined variable into an AcGrace data set. The next available data set of the current graph is used.
     Where:
       "var" is the channel variable to be plotted. Note, var must
             be in quotes.
    e.i.
     PLOTVAR "N0_PV-270"
     PLOTVAR "<deltaP>"

    SAVEVAR "var"

    Mark a variable to be saved. This command is used to mark user defined variables that should not be deleted using the global keywords of DELVAR. SAVEVAR is also used to identify user defined variables should be written to disk with the WRITEVARS command.
     Where:
       "var" is the variable to be saved.  Note, the var must be
             in quotes.

    UNSAVEVAR "var"

    Un-mark a saved variable. This command is used to mark user defined variables that should not be written to disk with the WRITEVARS command. It has no effect unless the variable has been previously saved with a SAVEVAR command. This command, used with SAVEVAR and WRITEVARS can be used to write variables to separate files.
     Where:
       "var" is the variable to be unsaved.  Note, the var must be
             in quotes.

    DELVAR "var"

    Delete a variable. This allows variables to be deleted to free up memory.
    Where:
       "var" is the variable to be deleted.  Note, the var must be
             in quotes.
    The following global keywords may also be used for var:
          all     - delete all variables.
          relap   - delete all relap5 variables. (Rn_xx-yyy)
          nrcdb   - delete all NRC Databank variables. (Nn_(xxx)
          xmgrset - delete all AcGrace set variables. (Gn.Sm)
          user    - delete all user defined variables. (<xxx>)

    WRITEVARS [file_type] "filename"

    Write all user defined variables marked with the SAVEVAR command to a disk file.
    Where:
       file_type = PIB   Create a platform independent binary file.
                         (default)
                   ASCII Create an ASCII data file.
       "filename" is the name of the disk file.  Note, the contents
                  of an existing file will be overwritten.

    READVARS "filename"

    Read all user defined variables contained on a disk file.
    Where: 
    
       "filename" is name of the disk file.  Note, any existing
                  variables that are also contained in the file
                  will be overwritten.

    Operators

    Table 1 contains a list of the operators supported by the equation interpreter. These include both arithmetic and boolean operators. Boolean operators return either 1.0 for true or 0.0 for a false condition and the results or boolean operations can be used in arithmetic calculations. These operators are similar to those used in the `C' language with the exception that the `^' symbol is used here for exponentiation, rather than as a bit-wise OR operator. The precedence and associativity of the operators is also the same as in the `C' language.

     Unless otherwise noted, each of these operators may be applied to any combination of constants, scalar variables and channel variables. Operations involving channel variables act on the dependent variables only, so a string such as "<p_dome> - 100.0" subtracts 100.0 from each y-value in <p_dome>.

     If an operation is performed between two channel variables, interpolation will be performed as needed to ensure calculations are performed on the same independent variables. The resulting channel variable will contain the x-values from the left argument that are contained within the right argument. Extrapolation is not performed beyond the range of either channel variable.

    Table 1: Precedence and associativity of operators.

    Operators
    Associativity
    Comments
    ( )
    left to right
    Precedence
    -
    right to left
    Unary Minus
    ^
    right to left
    Exponentiation, the power must be a scalar value.
    * /
    left to right
    Multiplication, division.
    + -
    left to right
    Addition, subtraction.
    < <= > >=
    left to right
    Boolean comparison operators.
    == != 
    left to right
    Boolean equals and not-equals comparison operators.
    &&
    left to right
    Boolean AND
    ||
    left to right
    Boolean OR
    =
    right to left
    Assignment
     

    Math Functions

    Table 2 contains a list of the arithmetic functions supported by the equation interpreter. Except as noted, these functions may be applied to any combination of constants, scalar variables and channel variables. As with operators, functions involving channel variables act on the dependent variables only, so a string such as "max(<p_dome>, 100.0)" returns a channel variable containing the x-values of <p_dome> and y-values containing the maximum of either each y-value in <p_dome> or 100.0.

     If a function is performed between two channel variables, interpolation is performed as needed to ensure calculations are performed on the same independent variables. The resulting channel variable will contain the x-values from the left argument that are contained within the right argument. Extrapolation is not performed beyond the range of either channel variable.

    Table 2: Arithmetic functions.

    Function          Description
    _______________________________________________________
    sin(x)            sine of x
    cos(x)            cosine
    tan(x)            tangent of x
    asin(x)           arcsin(x)
    acos(x)           arccos(x)
    atan(x)           artan(x)
    sinh(x)           hyperbolic sine of x
    cosh(x)           hyperbolic cosine of x
    tanh(x)           hyperbolic tangent of x
    exp(x)            exponential function of x
    ln(x)             natural logarithm of x, x >0
    log(x)            natural logarithm of x, x >0
    log10(x)          base 10 logarithm of x, x >0
    sqrt(x)           square root of x
    ceil(x)           smallest integer not less than x
                      as a double
    floor(x)          largest integer not greater than x
                      as a double
    abs(x)            absolute value of x
    min(x,y)          minimum of x and y
    max(x,y)          maximum of x and y
    bound(s1, s2, x)  x bounded by scalars s1 and s2, s1<s2
    deriv(var)        Return derivative of var as a channel
                      variable.
    integrate(var)    Return the integral of var as a channel
                      variable.
    meanval(var)      Return the mean value of channel variable
                      var as a double.
    stddev(var)       Return the standard deviation of channel
                      variable var as a double.
    minXval(var)      Return the minimum value of the x-range
                      of channel variable var as a double.
    maxXval(var)      Return the maximum value of the x-range
                      of channel variable var as a double.
    minYval(var)      Return the minimum value of the y-range
                      of channel variable var as a double.
    maxYval(var)      Return the maximum value of the y-range
                      of channel variable var as a double.
    _______________________________________________________
    1. Arguments x and y represent. either constants, scalar
       variables, or channel variables.

    Convenience Functions

    Table 3 contains a list of convenience functions implemented in the equation interpreter. The shiftx function allow the independent variables to be shifted by a scalar value.

    The combine function can be used to change the independent variable. It is used to create a new channel variable that contains x-values based on the y-values of the first argument and y-values based on the y-values of the second argument. Interpolation is performed as required to ensure that the independent variables of each argument are properly aligned.

     The newSet function creates a new channel variable containing (x2-x1)/dx + 1 points, with the first point being (x1, y1) and the last being (x2, y2). If a zero or negative value of dx is entered, the new channel variable will contain only the (x1, y1) point.

     The getYval and putPt functions are useful for manipulating individual data points. getYval will return the y-value of a channel variable associated with a given x-value. putPt can be used to insert individual points into a channel variable.

     The integrate and deriv functions are used to calculate the integral and derivative of channel variables respectively.

     The functions meanval, stddev, minXval, minYval, maxXval, and maxYval each take a single channel variable as an argument and return a scalar value corresponding to the mean, standard deviation, minimum x-range, minimum y-range, maximum x-range, and maximum y-range, respectively.

     

    Table 3: Convenience functions.

    Function                   Description
    ____________________________________________________________
    shiftx(dx, var)            Shift channel variable var along
                               x-axis by dx, var is not
                               affected. Returns a channel
                               variable.
    combine(var1, var2)        Create a channel variable, using
                               y-values from var1 for x-values
                               and y-values from var2 for
                               y-values.
    newSet(x1, x2, dx, y1, y2) Create a channel variable, with
                               x-values ranging from x1 to x2
                               incremented by dx, and y-values
                               ranging from y1 to y2.
    putPt(x, y, var)           Insert point (x, y) into var,
                               var is not affected.  The new,
                               point is inserted in sequence
                               along the x-axis.
                               Returns a channel variable.
    getYval(x, var)            Return the y-value in var
                               associated with an x-value of x.
    dropPoints(var1,var2)      Return a channel variable
                               containing the points from var2
                               that do not have corresponding
                               zero values in var1.
    ____________________________________________________________
    1. Arguments var, var1 and var2 represent channel variables.
       Arguments x, y, x1, x2, dx, y1,and y2 are scalars.

    Steam Table Functions

    The RELAP5 steam table functions are implemented in this version. Starting with version 4.0.1A, the RELAP5 water property file, tpfh2o, is no longer required.  Each steam table function requires two search variable types and one output variable type. The syntax used for each function is:
     out_in1in2(in1var, in2var)

     where:

       in1 is the first search property.  The list of supported input
           properties is given in Table 4.
       in2 is the second search property.  The list of supported
           input properties is given in Table 4.
       in1var is either a constant, a scalar variable, or channel
              variable containing the value(s) of the first search
              variable. The values should be in the appropriate SI
              units indicated in Table 4.
       in2var is either a constant, a scalar variable, or channel
              variable containing the value(s) of the second search
              variable. The values should be in the appropriate SI
              units indicated in Table 4.
       out is an output property.  The list of output properties is
           provided in Table 5.
    For example, to calculate the critical mass flux using the Henry-Fauske model at a constant pressure of 10. MPa and a temperature from channel variable <hot_leg_temp>, storing the result into a new variable <crit_mass_flux>, enter:
     CALC "<crit_mass_flux> = ghf_PT(10. e6, <hot_leg_temp>)"
     

    Table 4: Steam table function input combinations

         

    Table 5: Steam table function outputs

            Symbol  Description
            _________________________________________________
            P       Pressure (Pa)
            T       Temperature (K)
            v       Specific volume (m^3/kg)
            rho     Density (kg/m^3)
            u       Internal Energy (J/kg)
            h       Enthalpy (J/kg)
            s       Entropy (J/kg-K)
            cp      Const. Press. Spec. Heat (J/kg-K)
            cv      Const. Vol. Spec. Heat (J/kg-K)
            gamma   Ratio of Spec. Heats cp/cv
            x       Quality
            a       Void Fraction
            vf      Specific volume - liquid (m^3/kg)
            vg      Specific volume - vapor (m^3/kg)
            rhof    Density - liquid (kg/m^3)
            rhog    Density - vapor (kg/m^3)
            uf      Internal Energy - liquid (J/kg)
            ug      Internal Energy - vapor (J/kg)
            hf      Enthalpy - liquid (J/kg)
            hg      Enthalpy - vapor (J/kg)
            sf      Entropy - liquid (J/kg-K)
            sg      Entropy - vapor (J/kg-K)
            cpf     Const. Press. Spec. Heat - liquid (J/kg-K)
            cpg     Const. Press. Spec. Heat - vapor (J/kg-K)
            cvf     Const. Vol. Spec. Heat - liquid (J/kg-K)
            cvg     Const. Vol. Spec. Heat - vapor (J/kg-K)
            gammaf  Ratio of Spec. Heats cp/cv - liquid
            gammag  Ratio of Spec. Heats cp/cv - vapor
            state   Fluid property state
            gcrit   Critical mass flux (kg/m^2s)
            ghem    Critical mass flux - HEM model (kg/m^2s)
            ghf     Critical mass flux - Henry-Fauske model
                    (kg/m^2s)
            betaff  Liquid Coefficient of Expansion (/K)
            betagg  Vapor Coefficient of Expansion (/K)
            __________________________________________________

    Conversion Functions

    Several units conversion functions have been included to simplify converting data into and out of the standard SI units required by the steam table routines. Table 6 contains a list of these conversion functions. The syntax of each of these functions is:
     
    For example, to convert a pressure channel, <P_hot_leg_psia>, from psia to Pa, use:

     CALC "<P_hot_leg_Pa> = psia2Pa(<P_hot_leg_psia>)"
     
     


    Utility Programs

    RELAP5, TRAC and MELCOR data files may be accessed directly by AcGrace. However, accessing data channels from a large plot files may result in a fairly long delay while the entire data file is read. For this reason, a demultiplexed data format was added to AcGrace in order to minimize the time required to read data files. Four utility programs, r2dmx, trcgrf2dmx, xtv2dmx and mel2dmx, were created to convert RELAP5, TRACB, TRACM and MELCOR data files into a demultiplexed format, respectively. The demultiplexed data files are written in a machine independent, binary format, allowing calculations run on a wide range of platforms to be analyzed efficiently on another platform. By default, the demultiplexed data files are written in a compressed format. Decompression is performed on the fly, for selected data channels.

    An improved data compression algorithm, utilizing  zlib routines, has been incorporated into the NRC Databank Platform Independent, PIB, data format starting with xmgr5 version 4.0.1A.  This compression algorithm can significantly reduce the size of the data files (typically to ~30% of original size) without impacting the performance of data retrieval.  The AcGrace program can read either the compressed or uncompressed format directly.  Two utility functions zpib and unzpib were created to compress and decompress the files respectively.

    r2dmx - RELAP5 file demultiplexer

    Syntax:
        r2dmx [ options ]
    
    Options:
        -r : specify RELAP5 restart plot file (default: rstplt)
        -d : specify Demultiplexed file (default: relap.dmx)
        -m : buffer size in MB used to hold relap data
             1>N>128 (default: 8)
        -c : compress data (default)
        -cq: perform a quick run-length compression
        -nc: do not perform compression
        -v : verbose mode
        -s : silent mode
        -h : print help message

    trcgrf2dmx - TRAC TRCGRF file demultiplexer

    Syntax:
        trcgrf2dmx [ options ]
    
    Options:
        -r : specify TRCGRF plot file (default: trcgrf)
        -d : specify Demultiplexed file (default: trac.dmx)
        -m : buffer size in MB used to hold relap data
             1>N>128 (default: 8)
        -c : compress data (default)
        -nc: do not perform compression
        -v : verbose mode
        -s : silent mode
        -h : print help message

    xtv2dmx - TRAC XTV file demultiplexer

    Syntax:
        xtv2dmx [ options ]
    
    Options:
        -r : specify XTV plot file (default: trcxtv.xdr)
             file must be created in XDR format (iogrf=2)
        -d : specify Demultiplexed file (default: trcxtv.dmx)
        -m : buffer size in MB used to hold relap data
             1>N>128 (default: 8)
        -c : compress data (default)
        -nc: do not perform compression
        -v : verbose mode
        -s : silent mode
        -h : print help message

    mel2dmx - MELCOR file demultiplexer

    Syntax:
        mel2dmx [ options ]
    
     Options:  
        -p : specify MELCOR plot file (default: melcor.PTF)
        -d : specify Demultiplexed file (default: melcor.dmx)
        -m : buffer size in MB used to hold MELCOR data
             1>N>128 (default: 8)
        -c : compress data (default)
        -nc: do not perform compression
        -v : verbose mode
        -s : silent mode
        -h : print help message

    vic2dmx - VICTORIA file demultiplexer

    Syntax:
        vic2dmx [ options ]
    
     Options:  
        -p : specify VICTORIA plot file (default: vic.grf)
        -d : specify Demultiplexed file (default: vic.dmx)
        -m : buffer size in MB used to hold VICTORIA data
             1>N>128 (default: 8)
        -c : compress data (default)
        -nc: do not perform compression
        -v : verbose mode
        -s : silent mode
        -h : print help message

    zpib - NRC Databank PIB file compression program

    Syntax:
        zpib [-h] [-v] infile [outfile]
    
    Where: infile is the pib file to be compressed
           outfile is the compressed pib file. (default: <infile>.ZPIB)
    
    Options:  
        -v : verbose mode
        -h : print help message

    unzpib - NRC Databank PIB file decompression program

    Syntax:
        unzpib [-h] [-v] infile [outfile]
    
    Where: infile is the compressed pib file
           outfile is the pib file to be decompressed. (default: <infile>.PIB)
    
    Options:  
        -v : verbose mode
        -h : print help message

    CORBA Interface

    An optional external CORBA interface has been added to AcGrace that allows other programs direct access to the command interpreter of AcGrace.  In order to utilize this interface, AcGrace must be compiled with  _CORBA_ defined.  The command line argument -intf should be specified when starting AcGrace to initialize to CORBA interface.


    Example Command Files

    Three examples of using the command interpreter are provided below. The batch files may be executed either interactively through the "Commands" option under the "File" pulldown menu or in batch mode by adding "-batch filename" to the command line.

    Example One - Steam Table Functions

    This example plots the saturation line on a Temperature vs. Entropy diagram. First a channel variable, <Temperature>, containing 1001 points is created, with the x-range varying from 0 to 1000 and the y-range varying from 273.2 K to 647.3 K is created. Two additional channel variables are then created using the <Temperature> channel variable and the steam table function s_Tq, which returns entropy given a temperature and a quality. Channel variable <ent_stm> contains the entropy values associated with a quality of 1.0, while channel variable <ent_liq> contains the entropy values associated with a quality of 0.0.

     The combine function creates a new channel variable using the y values of the first and second arguments (aligned by their x values), as the x and y values respectively. The channel variables <line_stm> and <line_liq> then contain entropy values in their x-ranges and temperature values in their y-ranges.

    CALC "<Temperature>=newSet(0,1000,1,273.2,647.3)"
    CALC "<ent_stm>=s_Tx(<Temperature>,1.0)"
    CALC "<ent_liq>=s_Tx(<Temperature>,0.0)"
    CALC "<line_stm>=combine(<ent_stm>,<Temperature>)"
    CALC "<line_liq>=combine(<ent_liq>,<Temperature>)"
    PLOTVAR "<line_stm>"
    PLOTVAR "<line_liq>"
    xaxis  label "Entropy (J/kg-K)"
    yaxis  label "Temperature (K)"
    title "Saturation Line"
    AUTOSCALE

    Example Two - Plotting RELAP5 vs NRC Databank

    This example demonstrates using data from multiple files. Two RELAP5 files and one NRC Databank file are opened. Calculations are then performed using data from each source, and the results are plotted.
    #
    # open data files
    #
    RELAP 0 DEMUX   "/kkju0/kkj/case1.dmx"
    RELAP 1 RESTART "/kkju0/kkj/case2.rstplt"
    NRCDB 0 "/home/sbwr_data/dec/sbwl12-FILT.bin"
    #
    # Calculate the pressure difference for each relap case
    #
    CALC "<deltaP_C1> = R0_p-100010000 - R0_p-240010000"
    CALC "<deltaP_C2> = R1_p-100010000 - R1_p-240010000"
    #
    # convert to psi
    #
    CALC "<deltaP_C1> = Pa2psia(<deltaP_C1>)"
    CALC "<deltaP_C2> = Pa2psia(<deltaP_C2>)"
    #
    # find the absolute value of the error
    #
    CALC "<deltaP_Err_C1> = abs(<deltaP_C1> - N0_(DP-120))"
    CALC "<deltaP_Err_C2> = abs(<deltaP_C2> - N0_(DP-120))"
    #
    # calculate the maximum of the two error curves
    #
    CALC "<max_DP_err> = max(<deltaP_Err_C1>, <deltaP_Err_C2>)"
    #
    # plot results
    #
    PLOTVAR "<max_DP_err>"
    yaxis  label "Delta P Error (psi)"
    AUTOSCALE
    PRINT TO FILE "deltPerr.ps"
    HARDCOPY

    Example Three - ROSA Upper Plenum Mass and Energy Balance

    This example provides a fairly extensive demonstration of the calculational capabilities available using the equation interpreter. A mass and energy balance is performed using data obtained from the ROSA test facility.
    NRCDB 0 "/nrc1u1/zoo/ap-cl-03/apcl03-FILT.bin"
    GETP "rosa.par"
    #
    #
    # MASS AND ENERGY BALANCE ###########
    #
    #
    CALC "UP_h1 = 0.1484"
    CALC "UP_h2 = 0.5674"
    CALC "UP_h3 = 1.9154"
    CALC "UP_h4 = 2.1260"
    CALC "UP_vol1 = 0.0204"
    CALC "UP_vol2 = 0.0872" 
    CALC "UP_vol3 = 0.3497"
    CALC "UP_vol4 = 0.3880"
    #
    ############################################################
    # calculate time dependent liquid levels for each subvolume
    ############################################################
    #
    CALC "<UP_liqh1> = bound(0.0,UP_h1,N0_(CL-UP))"
    CALC "<UP_liqh2> = bound(UP_h1,UP_h2,N0_(CL-UP))"
    CALC "<UP_liqh3> = bound(UP_h2,UP_h3,N0_(CL-UP))"
    CALC "<UP_liqh4> = bound(UP_h3,UP_h4,N0_(CL-UP))"
    #
    PLOTVAR "<UP_liqh1>"
    PLOTVAR "<UP_liqh2>"
    PLOTVAR "<UP_liqh3>"
    PLOTVAR "<UP_liqh4>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Liquid Level (m)"
    AUTOSCALE
    PRINT TO FILE "UP_LiqLev.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    ############################################################
    # calculate liquid volumes
    ############################################################
    #
    CALC "<UP_liqVol1> = (<UP_liqh1>*UP_vol1)/UP_h1"
    CALC "<UP_liqVol2> = ((<UP_liqh2>-UP_h1)*(UP_vol2-UP_vol1))\
                          /(UP_h2-UP_h1)"
    CALC "<UP_liqVol3> = ((<UP_liqh3>-UP_h2)*(UP_vol3-UP_vol2))\
                          /(UP_h3-UP_h2)"
    CALC "<UP_liqVol4> = ((<UP_liqh4>-UP_h3)*(UP_vol4-UP_vol3))\
                          /(UP_h4-UP_h3)"
    #
    PLOTVAR "<UP_liqVol1>"
    PLOTVAR "<UP_liqVol2>"
    PLOTVAR "<UP_liqVol3>"
    PLOTVAR "<UP_liqVol4>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Liquid Volume (m3)"
    AUTOSCALE
    PRINT TO FILE "UP_LiqVol.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    ############################################################
    # calculate vapor volumes
    ############################################################
    #
    CALC "<UP_vapVol1> = UP_vol1-<UP_liqVol1>"
    CALC "<UP_vapVol2> = (UP_vol2-UP_vol1-<UP_liqVol2>)"
    CALC "<UP_vapVol3> = (UP_vol3-UP_vol2-<UP_liqVol3>)"
    CALC "<UP_vapVol4> = (UP_vol4-UP_vol3-<UP_liqVol4>)"
    #
    PLOTVAR "<UP_vapVol1>"
    PLOTVAR "<UP_vapVol2>"
    PLOTVAR "<UP_vapVol3>"
    PLOTVAR "<UP_vapVol4>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "UP_ Vapor Volume (m3)"
    AUTOSCALE
    PRINT TO FILE "UP_vapVol.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    ############################################################
    # calculate rhof & rhog
    ############################################################
    #
    CALC "<UP_rhof1> = rhof_Tx(N0_(TE-E049F-PV), 0.0)"
    CALC "<UP_rhof2> = rhof_Tx(N0_(TE-E049F-PV), 0.0)"
    CALC "<UP_rhof3> = rhof_Tx(N0_(TE-E060F-PV), 0.0)"
    CALC "<UP_rhof4> = rhof_Tx(N0_(TE-E060F-PV), 0.0)"
    #
    PLOTVAR "<UP_rhof1>"
    PLOTVAR "<UP_rhof2>"
    PLOTVAR "<UP_rhof3>"
    PLOTVAR "<UP_rhof4>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "UP_Liquid Density (kg/m3)"
    AUTOSCALE
    PRINT TO FILE "UP_rhof.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    CALC "<UP_rhog1> = rhog_Tx(N0_(TE-E049F-PV), 1.0)"
    CALC "<UP_rhog2> = rhog_Tx(N0_(TE-E049F-PV), 1.0)"
    CALC "<UP_rhog3> = rhog_Tx(N0_(TE-E060F-PV), 1.0)"
    CALC "<UP_rhog4> = rhog_Tx(N0_(TE-E060F-PV), 1.0)"
    #
    PLOTVAR "<UP_rhog1>"
    PLOTVAR "<UP_rhog2>"
    PLOTVAR "<UP_rhog3>"
    PLOTVAR "<UP_rhog4>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "UP_Vapor Density (kg/m3)"
    AUTOSCALE
    PRINT TO FILE "UP_rhog.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    ############################################################
    # calculate liquid and vapor mass in each volume and sum 
    ############################################################
    #
    CALC "<UP_mf1>  =  <UP_liqVol1>*<UP_rhof1>"
    CALC "<UP_mf2>  =  <UP_liqVol2>*<UP_rhof2>"
    CALC "<UP_mf3>  =  <UP_liqVol3>*<UP_rhof3>"
    CALC "<UP_mf4>  =  <UP_liqVol4>*<UP_rhof4>"
    #
    PLOTVAR "<UP_mf1>"
    PLOTVAR "<UP_mf2>"
    PLOTVAR "<UP_mf3>"
    PLOTVAR "<UP_mf4>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Liquid Mass in UP_ Subvolumes (kg)"
    AUTOSCALE
    PRINT TO FILE "UP_mf.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    CALC "<UP_mg1>  =  <UP_vapVol1>*<UP_rhog1>"
    CALC "<UP_mg2>  =  <UP_vapVol2>*<UP_rhog2>"
    CALC "<UP_mg3>  =  <UP_vapVol3>*<UP_rhog3>"
    CALC "<UP_mg4>  =  <UP_vapVol4>*<UP_rhog4>"
    #
    PLOTVAR "<UP_mg1>"
    PLOTVAR "<UP_mg2>"
    PLOTVAR "<UP_mg3>"
    PLOTVAR "<UP_mg4>"
    title "ROSA AP-CL-03"
    world xmin -500
    
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Vapor Mass in UP_ Subvolumes (kg)"
    AUTOSCALE
    PRINT TO FILE "UP_mg.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    ############################################################
    # calculate total mass in each volume
    ############################################################
    #
    CALC "<UP_mass1>  =  <UP_mf1> + <UP_mg1>"
    CALC "<UP_mass2>  =  <UP_mf2> + <UP_mg2>"
    CALC "<UP_mass3>  =  <UP_mf3> + <UP_mg3>"
    CALC "<UP_mass4>  =  <UP_mf4> + <UP_mg4>"
    #
    PLOTVAR "<UP_mass1>"
    PLOTVAR "<UP_mass2>"
    PLOTVAR "<UP_mass3>"
    PLOTVAR "<UP_mass4>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Mass in UP_ Subvolumes (kg)"
    AUTOSCALE
    PRINT TO FILE "UP_masses.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    ############################################################
    # calculate total UP mass
    ############################################################
    #
    CALC "<UP_TotMass>=<UP_mass1>+<UP_mass2>+\
                      <UP_mass3>+<UP_mass4>"
    #
    PLOTVAR "<UP_TotMass>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Total UP Mass (kg)"
    AUTOSCALE
    PRINT TO FILE "UP_TotMass.ps"
    HARDCOPY
    FLUSH
    #
    ############################################################
    # Normalize Total Mass to IC
    ############################################################
    #
    CALC "<clip> = newSet(-20,0,10,1.0,1.0)"
    CALC "<UP_TotMass_clip> = <UP_TotMass> * <clip>"
    CALC "UP_TotMass_IC = meanval(<UP_TotMass_clip>)"
    CALC "<UP_TotMass_Norm> = <UP_TotMass> / UP_TotMass_IC"
    #
    PLOTVAR "<UP_TotMass_Norm>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Normalized UP_ Mass"
    AUTOSCALE
    PRINT TO FILE "NormUP_Mass.ps"
    HARDCOPY
    FLUSH
    #
    ############################################################
    # calculate Tsat(P)
    ############################################################
    #
    CALC "<UP_Tsat> = T_Px(N0_(PE280A-PV)*1.e6, 1.0)"
    #
    # define band along Tsat for saturated approximation ######
    #
    CALC "<UP_TL> = <UP_Tsat> - 5.00"
    CALC "<UP_TU> = <UP_Tsat> + 5.00"
    #
    # plot Tsat, TU, TL
    #
    PLOTVAR "<UP_Tsat>"
    PLOTVAR "<UP_TL>"
    PLOTVAR "<UP_TU>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Tsat,TU, and TL (K)"
    AUTOSCALE
    PRINT TO FILE "UP_Tbounds.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    ############################################################
    # Determine if local Temp is within sat. band #############
    # sat# = 1 if in band; 0 if not in band
    ############################################################
    #
    CALC "<UP_sat1> = (N0_(TE-E049F-PV) > <UP_TL>) && \
                      (N0_(TE-E049F-PV) < <UP_TU>)"
    CALC "<UP_sat2> = (N0_(TE-E049F-PV) > <UP_TL>) && \
                      (N0_(TE-E049F-PV) < <UP_TU>)"
    CALC "<UP_sat3> = (N0_(TE-E060F-PV) > <UP_TL>) && \
                      (N0_(TE-E060F-PV) < <UP_TU>)"
    CALC "<UP_sat4> = (N0_(TE-E060F-PV) > <UP_TL>) && \
                      (N0_(TE-E060F-PV) < <UP_TU>)"
    #
    CALC "<UP_nosat1> = (N0_(TE-E049F-PV) < <UP_TL>) || \
                        (N0_(TE-E049F-PV) > <UP_TU>)"
    CALC "<UP_nosat2> = (N0_(TE-E049F-PV) < <UP_TL>) || \
                        (N0_(TE-E049F-PV) > <UP_TU>)"
    CALC "<UP_nosat3> = (N0_(TE-E060F-PV) < <UP_TL>) || \
                        (N0_(TE-E060F-PV) > <UP_TU>)"
    CALC "<UP_nosat4> = (N0_(TE-E060F-PV) < <UP_TL>) || \
                        (N0_(TE-E060F-PV) > <UP_TU>)"
    #
    PLOTVAR "<UP_sat1>"
    PLOTVAR "<UP_nosat1>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Boolean"
    AUTOSCALE
    PRINT TO FILE "UP_satno1.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    PLOTVAR "<UP_sat2>"
    PLOTVAR "<UP_nosat2>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Boolean"
    AUTOSCALE
    PRINT TO FILE "UP_satno2.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    PLOTVAR "<UP_sat3>"
    PLOTVAR "<UP_nosat3>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Boolean"
    AUTOSCALE
    PRINT TO FILE "UP_satno3.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    PLOTVAR "<UP_sat4>"
    PLOTVAR "<UP_nosat4>"
    title "ROSA AP-CL-03"
    xaxis  label "Time (s)"
    yaxis  label "Boolean"
    AUTOSCALE
    PRINT TO FILE "UP_satno4.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    ############################################################
    # calculate energy in each subvolume
    ############################################################
    #
    CALC "<UP_U1>=<UP_nosat1>*<UP_mass1>*u_PT(N0_(PE280A-PV)\
                   *1.e6,N0_(TE-E049F-PV))+\
                   <UP_sat1> * <UP_mf1> * uf_Px(N0_(PE280A-PV)\
                   *1.e6,0.0) +\
                   <UP_sat1> * <UP_mg1> * ug_Px(N0_(PE280A-PV)\
                   *1.e6,1.0)"
    CALC "<UP_U2>=<UP_nosat2>*<UP_mass2>*u_PT(N0_(PE280A-PV)\
                   *1.e6,N0_(TE-E049F-PV)) +\
                   <UP_sat2> * <UP_mf2> * uf_Px(N0_(PE280A-PV)\
                   *1.e6,0.0) +\
                   <UP_sat2> * <UP_mg2> * ug_Px(N0_(PE280A-PV)\
                   *1.e6,1.0)"
    CALC "<UP_U3>=<UP_nosat3>*<UP_mass3>*u_PT(N0_(PE280A-PV)\
                   *1.e6,N0_(TE-E060F-PV)) +\
                   <UP_sat3> * <UP_mf3> * uf_Px(N0_(PE280A-PV)\
                   *1.e6,0.0) +\
                   <UP_sat3> * <UP_mg3> * ug_Px(N0_(PE280A-PV)\
                   *1.e6,1.0)"
    CALC "<UP_U4>=<UP_nosat4>*<UP_mass4>*u_PT(N0_(PE280A-PV)\
                   *1.e6,N0_(TE-E060F-PV)) +\
                   <UP_sat4> * <UP_mf4> * uf_Px(N0_(PE280A-PV)\
                   *1.e6,0.0) +\
                   <UP_sat4> * <UP_mg4> * ug_Px(N0_(PE280A-PV)\
                   *1.e6,1.0)"
    #
    PLOTVAR "<UP_U1>"
    PLOTVAR "<UP_U2>"
    PLOTVAR "<UP_U3>"
    PLOTVAR "<UP_U4>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Energy in UP_ Subvolumes (J)"
    AUTOSCALE
    PRINT TO FILE "UP_U.ps"
    HARDCOPY
    FLUSH
    GETP "rosa.par"
    #
    ############################################################
    # calculate total fluid energy in core
    ############################################################
    #
    CALC "<UP_Utot> = <UP_U1> + <UP_U2> + <UP_U3> + <UP_U4>"
    #
    PLOTVAR "<UP_Utot>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Total UP Fluid Energy (J)"
    AUTOSCALE
    PRINT TO FILE "UP_TotEnergy.ps"
    HARDCOPY
    FLUSH
    #
    ############################################################
    # Normalize Q to IC
    ############################################################
    #
    CALC "<clip> = newSet(-20,0,20,1.0,1.0)"
    CALC "<UP_Utot_clip> = <UP_Utot> * <clip>"
    CALC "UP_Utot_IC = meanval(<UP_Utot_clip>)"
    CALC "<UP_Utot_Norm> = <UP_Utot> / UP_Utot_IC"
    #
    PLOTVAR "<UP_Utot_Norm>"
    title "ROSA AP-CL-03"
    world xmin -500
    world xmax 7500
    xaxis  label "Time (s)"
    yaxis  label "Normalized UP Fluid Energy"
    AUTOSCALE
    PRINT TO FILE "NormUP_Energy.ps"
    HARDCOPY
    FLUSH
    ############################################################

    AcGrace NRC Extensions - 30 July 01