AcGrace - Overview
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 descendent 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:
- Additions to the Interactive Interface that provide direct access to RELAP5, TRAC, MELCOR, FRAPCON, VICTORIA and NRC Databank files.
- Additions to the Command Interpreter (Batch Interface):
- An Equation Interpreter that performs calculations using a combination of:
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.
Summary of Updates and Bug Fixes
AcGrace 5.1.19B
- Added support for parsing TRACE Variables that do not end in the "-num" syntax.
- Changed TRAC labels in menu items and dialogs to TRACE.
- Fixed the Edit->Variables... dialog to ensure it updates with changes to the variable list.
AcGrace 5.1.19A
- Upgraded to Grace Version 5.1.19.
- Added support for the Purdue Advanced Reactor Core Simulator (PARCS) code.
- Added support for the TRACE sub component identifier to the batch interface.
- Modified the ASCII WRITEVARS export format to make it easier for external programs to parse.
- Updated RELAP5 engineering units per update from Glen Mortensen.
- Fixed a problem in the Windows Pre-Built Executable that caused the application to hang while writting jpegs.
AcGrace 5.1.18C
- Corrected engineering units for TRACE XTV files written in English units (IOGRF=1).
- Added the sub component identifier to the TRACE data channel naming convention.
AcGrace 5.1.18B
- Added large file support (>2GB) for TRACE plot files to AcGrace and xtv2dmx.
- Updated to new TRACE data channel naming convention.
- Added ability to read RELAP5 RSTPLT files on 32-bit OS that were created using 64-bit ints.
AcGrace 5.1.18A
- Upgraded to Grace Version 5.1.18.
- Added demultiplexed data format for COBRA plot files along with cobra2dmx utility.
- Increased maximum and default memory limits for RELAP5, TRAC and TRACE demultipler utilities.
- Updated RELAP5 rstplt input routine per update submitted by Tim Haste, PSI.
AcGrace 5.1.17A
- Upgraded to Grace Version 5.1.17.
- Removed unused CORBA interfaces. SNAP has been modified to use a piped connection to AcGrace.
AcGrace 5.1.12F:
- Fixed problem with elevation option using demultiplexed TRACE files.
- Fixed error reading F103 variables from CONTAIN plot files.
AcGrace 5.1.12E:
- Fixed disappearing scroll bar on RELAP5 data selection dialog.
- Added ability to control the size of the TRACE data selection dialog. The following two lines may be added to your ~/.Xdefaults file to control the number of components and data channels displayed in the dialog respectively:
XMgrace*numTraceCompShown: 5
XMgrace*numTraceChanShown: 6
AcGrace 5.1.12D:
- Modified the elevation interpolation routines for TRACE to handle fine-mesh channel data.
- Modified CONTAIN file selector to retain last file opened.
AcGrace 5.1.12C:
- Fixed WRITEVARS batch command.
- Added additional NRC Databank Unit types.
- Updated SNAP interface routines.
AcGrace 5.1.12B:
- Added capability to read TRACE XTV graphics files written in English units.
- Improved error handling for CONTAIN plot files that were not properly closed.
- Fixed the elevation interpolation routines for TRACE fine-mesh data channels.
- Fixed an error in the equation interpreter that occurs when parentheses are used under cygnus.
AcGrace 5.1.12A:
- Upgraded to Grace Version 5.1.12.
- Added -nomifframe command line option. This option prevents frames from being generated for MIF files.
- Added support for MAC OS X.
AcGrace 5.1.9D:
- Fixed error reading CONTAN 805 data blocks.
AcGrace 5.1.9C:
- Added support for CONTAIN plot files.
- Fixed TRAC channel selection dialog to prevent deselection of the trac component for each plot.
- Increased default and maximum memory buffers in r2dmx and xtv2dmx to 64MB and 512MB respectively to improve demultiplexing performance when working with large data files.
AcGrace 5.1.9B:
- Fixed NRC Databank temperature conversions for differential temperatures.
AcGrace 5.1.9A:
- Upgraded to Grace Version 5.1.9.
- Modified TRAC XTV routines to improve performance for large models.
AcGrace 5.1.8A:
- Upgraded to Grace Version 5.1.8.
- Fixed dialog placement problems for all channel selection dialogs.
- Upgraded SNAP Calculation Server interface.
Initial Version AcGrace 5.1.4A:
- Migrated Xmgr5 version 4.1.2I modifications to Grace Version 5.1.4.
- Updated TRAC data channel selection dialog. The component list was changed to display 6 components in alphabetical order. The data channel list was modified to include the channel description.
- Upgraded to SNAP Database version 14 interface and the latest SNAP Calculation Server interface.
Additions to the Interactive Interface
The File menu has been extended to include options to open graphics files generated by several analysis codes and experimental data contained in the NRC Databank. The Data menu has also been extended allow data channels to be selected from these files and data connections.
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 naming convention is employed for TRACE variables:
| Dimen. | Variable | c | ii | jj | kk |
| 0D | var-c | component number | nonexistent | nonexistent | nonexistence |
| 1D | var-cAii | component number | axial index | ||
| 2D | var-cAiiRjj | component number | axial index | radial index | |
| 3D | var-cAiiRjjTkk | component number | axial index | radial index | theta index |
- Axial, radial and azimuthal indexes less than 10 contain a leading 0.
- An elevation value may be supplied for heat structure and fuel rod variables that contain an axial index. This will be used to calculate the value of the variable at a fixed elevation as TRACE performs coarse/fine re-nodalization of the model. In this case, an axial index value of 01 must be specified. The elevation may be specified in the batch interface by adding a "@elev" to the end of the variable name.
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:
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.
The following naming convention is used to represent VICTORIA data channels:
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.
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.*
*Please 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.*
units_type = si Convert to SI units (default).
british Convert to british units.
done Process RELAP5 data channels.
*Please Note: the channel name must be in quotes.
Specifying the units_type without a RELAP5 channel name will change the default units type. For example:
RREAD british
Specifying the units_type following the RELAP5 channel name will change the units type for that channel only. For example:
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.*
*Please 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.*
units_type = si Convert to SI units (default).
british Convert to british units.
done Process MELCOR data channels.
*Please Note: the channel name must be in quotes.
Specifying the units_type without a MELCOR channel name will change the default units type. For example:
MREAD british
Specifying the units_type following the MELCOR channel name will change the units type for that channel only. For example:
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.*
*Please 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.*
units_type = si Convert to SI units. (default)
british Convert to british units.
done Process MELCOR data channels.
*Please Note: The channel name must be in quotes.
Specifying the units_type without a TRAC channel name will change the default units type. For example:
TREAD british
Specifying the units_type following the TRAC channel name will change the units type for that channel only. For example:
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.
*Please 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.*
units_type = si Convert to SI units. (default)
british Convert to british units.
done Process FRAPCON data channels.
*Please Note: the file name must be in quotes.
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.*
*Please 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.*
units_type = si Convert to SI units. (default)
british Convert to british units.
done Process VICTORIA data channels.
*Please Note: the file name must be in quotes.
Specifying the units_type without a VICTORIA channel name will change the default units type. For example:
VREAD british
Specifying the units_type following the VICTORIA channel name will change the units type for that channel only. For example:
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.*
*Please 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.*
units_type = si Convert to SI units. (default)
british Convert to british units.
done Process COBRA-TF data channels.
*Please Note: the channel name must be in quotes.
Specifying the units_type without a COBRA-TF channel name will change the default units type. For example:
COBRAREAD british
Specifying the units_type following the COBRA-TF channel name will change the units type for that channel only. For example:
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 datahannel. (default = 10000)
Connection 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.*
*Please Note: the file name must be in quotes.
CONTAINREAD [fileno] ["channel"] [units_type]
Change the active SNAP data source number.
Where:
fileno = Integer value between 0 and 9 identifying the file number.
channel = CONTAIN data channel.*
units_type = si Convert to SI units. (default)
british Convert to british units.
done Process CONTAIN data channels.
*Please Note: the channel name must be in quotes.
Specifying the units_type without a CONTAIN channel name will change the default units type. For example:
CONTAINREAD british
Specifying the units_type following the CONTAIN channel name will change the units type for that channel only. For example:
CONTAIN "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.
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.*
*Please 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.*
units_type = si Convert to SI units. (default)
british Convert to british units.
done Process RELAP5 data channels.
*Please Note: the file name must be in quotes.
Specifying the units_type without a data channel name will change the default units type. For example:
NREAD british
Specifying the units_type following the NRC Databank channel name will change the units type for that channel only. For example:
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.*
end = the end time.*
step = the size of a time step. (A value of 0.0 will turn off this option.)*
*Please Note: these values must be entered in seconds.
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.)
For example: 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.)
For example: 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:
- Data from external sources must first be read into either a data set or one of four fixed length scratch arrays. The data is then manipulated by referring to the set number associated with the data. For example, to plot the difference between two RELAP5 data channels, the data is first read into data sets, then a new set is created containing the results of the calculation. The original two data sets are then eliminated and the result contained in set 2 is plotted. This is illustrated by the following AcGrace input:
RREAD 0 restart "rstplt"
RREAD 0 "p-10102000"
RREAD 0 "p-10103000" done
s2.x = s1.x
s2.y = s0.y - s1.y
KILL s0
KILL s1
REDRAWWhile this approach works well for small calculations, it becomes cumbersome for more complex calculations that may involve well over 30 data channels. The user is limited to a maximum of 30 data sets at any given time, and must keep track of what information is contained in each data set.
- No interpolation is performed when operations are performed between data sets. This prevents performing operations between sets unless the x-axis values are aligned between the two sets. In many cases, it is desirable to perform calculations using a combination of data that is based on different x-axis values.
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:
- Equations can be written using RELAP5 or NRC Databank channel names directly.
- Variables can be created with user defined names that can provide indication of their contents. There is no upper limit set on the number of user defined variables that may be created. Variables can be created to represent either scalar values or channels.
- Interpolation is automatically performed whenever an operator acts on two channels 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.
- Several convenience functions are provided to create user defined channels, to combine channels, to extract points from a channel and to insert points into a channel.
- Steam table functions are provided.
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).
- 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.
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.
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"
Please 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.*
*Please Note, the channel variable must be in quotes.
For example:
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.*
*Please Note, the variable name 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.*
*Please Note: the variable name 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.*
*Please Note: the variable name 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.*
*Please 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.*
*Please 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 of x |
| tan(x) | tangent of x |
| asin(x) | arcsin(x) |
| acos(x) | arccos(x) |
| atan(x) | arctan(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 ***ERROR?*** |
| 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. |
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. |
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 |
| h | Enthalpy |
| s | Entropy |
| 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:
outvar = convFunc( invar )
Where:
outvar is the scalar or channel variable that will contain the result.
invar is the scalar or channel variable that will be converted.
convFunc is the Conversion Function identified in Table 6.
Table 6: Conversion Functions
| Property | Conversion Function | Description |
| Pressure | Pa2psia | Convert Pa to psia. |
| psia2Pa | Convert psia to Pa. | |
| Temperature | K2C | Convert deg K to deg C |
| K2F | Convert deg K to deg F | |
| K2R | Convert deg K to deg R | |
| C2K | Convert deg C to deg K | |
| C2F | Convert deg C to deg F | |
| C2R | Convert deg C to deg R | |
| F2K | Convert deg F to deg K | |
| F2C | Convert deg F to deg C | |
| F2R | Convert deg F to deg R | |
| R2K | Convert deg R to deg K | |
| R2C | Convert deg R to deg C | |
| R2F | Convert deg R to deg F | |
| Sp. volume | CMpKG2CFpLBM | Convert m3/kg to ft3/lbm. |
| CFpLBM2CMpKG | Convert ft3/lbm to m3/kg. | |
| Int. Energy | JpKG2BTUpLBM | Convert J/kg to BTU/lbm. |
| BTUpLBM2JpKG | Convert BTU/lbm to J/kg. | |
| Mass Flux | KGpSM2LBMpSFT | Convert kg/m2 to lbm/ft2. |
| LBMpSFT2KGpSM | Convert lbm/ft2 to kg/m2. |
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
cobra2dmx - COBRA file demultiplexer
Syntax:
cobra2dmx [ options ]
Options:
-r : specify COBRA plot file (default: cobra.grf)
-d : specify Demultiplexed file (default: cobra.dmx)
-m : buffer size in MB used to hold COBRA data
1>N>512 (default: 64)
-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 pib file to be compressed
outfile is the compressed pib file. (default: <infile>.PIB)
Options:
-v : verbose mode
-h : print help message
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
############################################################
