A Simple Transient


  1. Introduce the SNAP Model Editor.
  2. Show you how to generate plots of results.
  3. Illustrate a limitation of numerical simulations.


 Repeat the steps given in Exercise 1 to start the calculation server. If you are working a  Windows rather than Linux computer operating system, you will also need to start an X Server, to support the plotting program (AcGrace).  In the ITS computer laboratories from the Programs item of the Start menu, look for Utilities, then cygwin, then the item to start Xwindows.  If you are on another computer with Cygwin installed look for an icon or Program menu item labeled “Cygwin”. Double-click the icon or select “Cygwin Bash Sell” from the “Cygwin” program submenu. In the window that opens, type “startxwin.sh &” or the long form "/usr/X11R6/bin/startxwin.sh &", then wait for it to open an X command window.  As another option, you can use the Exceed Xserver if it is installed.  Look for an icon or item in the Programs menu for “Exceed”, and start the Exceed X server by clicking the “Exceed” item in the Exceed submenu.

Be sure that you’ve created an “Exercise-2” subdirectory to store results from this work.

Problem Definition

Flow is through a 10 meter section of 0.25 m diameter circular pipe.  Initially, water flows into the test section at 1 m/s with a temperature of 300K. From 1 to 2 seconds into the transient, the inlet temperature increases linearly from 300K to 330K. The pressure at the exit is 2.0x105 Pa. For your model, divide the test section into 10 equal volumes. Run a transient simulation for 10 seconds with a time step size of 0.1s, and graph the temperature in the 6th volume (x=5.5m) as a function of time. How does the result compare to the exact answer for flow without turbulent diffusion?  


 As with any flow simulation, most of your work will be involved in setting up the initial and boundary conditions for the problem. You must first learn to use the Model Editor provided with the Symbolic Nuclear Analysis Package (SNAP), to provide input to TRACE. You will build input models through a combination of menu selections and keyboard entries. When you complete a keyboard entry in a box or table, be sure to hit the “Enter” (Return) key, or click in another box, before you click an “OK” button to close the dialog window. If you don’t your last entry may not register with SNAP. Begin by selecting “SNAP” from the “Programs” menu. You will see the options below. Select “Model Editor”.

The Model Editor window will appear on the screen, along with a Message window that allows you to select your starting point for the model.  We will be creating a new model.

Start selection


After clicking "OK", a small window appears in which you elect to generate a TRACE input.

Clicking the “OK” button opens three panes within the main SNAP window.  Upper left is a list of all major input model categories called the "Component Navigator".  Bottom left is space for detailed component descriptions.  The larger area to the right is called the "Default View" where you will graphically build your system model.  Later, when you check or export your input model, a fourth pane will appear at the bottom of the window containing messages .  If you prefer a format with separate windows for each of these panes, you can request that in the Preferences item of the Edit menu.

Main SNAP windo

  Look at the tool bar containing binoculars and padlock icons.  You should see a button with an arrowhead pointing down. If you hold your mouse cursor over the button without clicking, a label appears reading “Select component to insert.” Click this button, and a menu appears from which you should select “Hydraulic Components.” This generates a submenu on which you should click “Breaks” (pressure boundary condition).

 The menus disappear, and the first button in the second tool bar appears as depressed. This is your shortcut button for getting “Break” components, and can be used directly to bypass the steps to the “Hydraulic Components” menu. Your cursor should now appear as a cross in the workspace of the Default View. Select a position in the workspace and click the mouse once. A break icon will appear. At the same time, an entry for the new break should appear in your Component Navigator window and a Properties Dialog should appear associated with that window.  We will return to the properties shortly.

Return to the “Select component to insert” button twice more to add one “Fill” (flow boundary condition), and one “Pipe” component. In both cases note the button that depresses in the second tool bar to make your life easier later. After your selection of a pipe, its representation will appear along with a window asking for the number of cells in the pipe.   One strategy here is to figure out in advance how you are going to divide space into volumes for the calculation.  In that case I would enter "10".  However, that is normally the hard route.   I first think about the geometry of the flow path.  In this case I'm modeling a 10 meter long section with uniform flow area.  I enter "1" because the basic geometry doesn't vary over the length of the component.  If I was setting up the input for the pipe in Exercise 1, I would have entered "2" because it has two uniform regions.  Later we will split the pipe into more volumes to get better results from the flow equation solution.

Pipe Initialization Dialog

  Be very careful when in component selection mode. More than one click on the workspace will produce more than one copy of the currently selected component. You may want to take a minute to clean up the picture. Click the general selection button Select, and drag the Fill to the left of the Pipe and the Break to its right.    Right click on either the fill or break to obtain a menu option to adjust the orientation to something like I've got above.

 Next you must establish flow connections between your components. Select the “Connect two components” button . Click the modified cursor first on the marker at the right end of the pipe, and then click it again on diamond at the bottom edge of the break. A blue connecting line should appear. Repeat the process to connect the small circle on the tip of the Fill to the marker at the left edge of the pipe.  If at some point a small dialog box opens asking for a connection type select the Hydro Connection not the Leak Path.   

You’ve finished the basic layout of the system. This is a good time to save your work. Select “Save” from the “File” menu on the Model Editor’s
main menu bar, and navigate through the “Save in” dialog to drop the SNAP data file into your Exercise-2 folder.  The next job is to set the geometry and initial conditions for all of the components. Start by moving your mouse cursor into the Default View (screen shot above) then right click the picture of the pipe and select "Properties.  You can access the same dialog  by double clicking the pipe's entry in the Component Navigator.
Start in the Properties View by giving the pipe a short name, a description, and some relevant comments.  To make entries in the  Description and Comments fields you need to click the button to the right with the red E and diagonal arrow. 

 Now move on to the Component Geometry and again click the data expansion button . You will get a separate data entry window with tabs labeled "Cells" and "Edges".  First select Edges, ad check to see that the hydraulic diameter has automatically been set to  0.25.  If you need to make a change, click in the appropriate box, or drag your mouse across a series of boxes that will receive the new value, and type.  When you hit the Enter key that value should appear for both hydraulic diameters, and if the flow area was set to 'Unknown", then values of the flow area should be computed based on a circular cross-section.  If this were a rectangular duct or some other odd shape, you could overwrite the area values.

For this problem we are using a horizontal pipe so don't touch the Orientation for now.  You can play with that later if you have time.  In this problem the only noticeable difference orientation will make is in the calculated cell pressures during the transient.   Move on to the Cells tab.   Take a look at volume properties.  They should have been automatically calculated based on a straight cylindrical pipe with the hydraulic diameter that you specified when the pipe was first created.


Now go back to the general pipe properties dialog, and expand the Component Initial Conditions. Get values for the state variables from the Problem Description above.  The value that you enter for the vapor temperature won't matter, because there is no vapor in the system

Click the Close button and move on to the break properties dialog.   Standard guidelines for breaks and fills are to set the cell length and volume equal to the adjacent active fluid volume.  I know that I'm going to split the pipe into one meter long cells, so I set the break length to 1 meter, and multiply that by the pipe cross-sectional area to get the break volume.  Set the Pressure to 2.0e5 Pa, and Mixture Temperature to 300.0 K. Leave everything else unchanged. This is a very simple constant pressure boundary condition. 

Now double click the Fill representation in the Default View workspace. Do the Identity category as before and move on to the Options. The Fill Type should be set to “Generalized State Table”. The Cell Length and Cell Volume should match those in the first cell of the pipe. Set remaining properties to values appropriate for this problem. 

To finish the job you've got to setup the Fill Table.  We want a table that keeps liquid temperature constant from 0.0 to 1.0 seconds, increases it linearly to 330.0 between 1.0 and 2.0 seconds, and holds it constant for times greater than 2.0 s. Expand the Fill Table entry and select the independent variable to be the problem time.  This is your only choice, but more will be available when we create problems with signal variables and control blocks.  Next click the Add Row button.  The independent variable is time, and should start at 0.0.  The remaining state variables should be set according to the problem definition.  Click the Add Row button again. Set the Independent Variable to 1.0, and verify that all other entries match the first row. Click the Add Row button again. Set the Independent Variable to 2.0, the Liquid Temperature to 330.0, and verify that all other entries match the first row.  Click the Add Row button again. Set the Independent Variable to 10000.0 (big number), and verify that all other entries match the third row. 

File Table

Now we have the basic initial conditions, all that is left is to define some basic information describing the overall calculation. In the “Component Navigator” window, right click line labeled "Model Options", then click “Model Properties” in the drop-down menu. In the properties box, enter useful information for the Model Name, Title Cards, and Model Description.  The Title cards are actually read by TRACE and printed to its output file.  Set  "Transient Calculation" to  "Yes".   Accept defaults on other direct entries.

Move on to the “Timestep Data” and  expand it. You’ve been asked to run the calculation for 10 seconds, with time step sizes of 0.1 seconds. Set the “End Time” (tend)  to 10.0, and the “Maximum Size” (dtmax) to 0.1. You can leave the “Minimum Size” (dtmin) at 1.0e-6 if you like. When the code has trouble getting a solution, it can automatically reduce the time step size. If it tries to cut the time step below “Minimum Size”, the code quits. My experience is that anytime TRACE tries for a step below 1.0e-5 seconds, there is something wrong with TRACE that should be reported to code developers. If steps stay below 1.e-4 for a prolonged period the problem should also be studied by code developers.
  Set the ”Long Edit Interval” (edint) to 1.0 seconds to give a few detailed edits during the transient. Set the "Graphics Interval" (gfint) to 0.1 to give values in the graphics file (trcxtv) every tenth of a second. We will worry about other settings on this dialog later, for this exercise accept the defaults.

The last category that we need to change in the Model Options dialog is the Namelist data. This is often a mystery to beginning user’s even with the description in the TRACE Users’ Guide. Normally, you want the default settings. In the dialog’s table find the name “DTSTRT”. Without intervention, the code will start a calculation at the “Minimum Step”, and gradually build up to the “Maximum Step”. We’ve got a gentle enough calculation that it’s worth starting with a time step of 0.1 seconds. Check the active box before “DTSTRT”, set the Value box to 0.1, hit the Enter (Return) key, and click the OK button.


Save your project from the Model Editor file menu.   Now we in principle have a complete model description.  However, using one volume to represent the full pipe won't give much resolution of the thermal wave propagation.  Right click on the pipe's picture in the Default View or it's entry in the Component Navigator, select "Special" from the drop-down menu, and then select "Renodalize."  Click on the picture of the pipe so that it changes color, and the two Split buttons become active.

Click the "Split Uniform" button and tell it to split into 10 cells.  Close the window by clicking OK, then take a look at the pipe property dialog to see the change in cell geometry.

At this point, run the transient from the “Submit Job” item on the Model Editor “Tools” menu.  Turn on the Job Status tool to check the progress of the calculation and view data. To get a graphical view of temperature, select “Plot” from the Tools menu Job Status application. This will only work if you remembered to start your X server at the beginning of the session (not a problem for Linux users). 

To read the TRACE graphics file, go to the AcGrace  “File” menu, select “Read”, and on the resulting submenu select “TRAC data”. 

A dialog now appears that lets you locate your graphics file.


In the menu list above labeled "Directories" select the directory containing the results of your calculation (check the list of Job names in the Job Status window if you aren't certain).  Next click in the Filter button. At this point you should be able to find and double-click “trcxtv” in the “Files" list. Once the “Selection” box shows the full path to your graphics file, click the “OK” button, and the following dialog appears.


Select “pipe-021” in the first box with a single click, tln-021006 in the second box, and click the “Accept” button. You should see a plot of temperature versus time in the 6th cell. How does that compare to the correct answer? How would it affect conservatism of a thermal stress calculation?  

Another Way to Use Tables

Tables such as you entered for the fill are available in many other components for various purposes.   However, they are not always the best approach.  You probably noticed that most of the information in the fill table above was for state variables that remained constant.  In other components a more serious limitation exists when restarting a calculation.  For most complex simulations you will find yourself developing a full input model only to establish an initial steady state.  After that you pick up most of the system information from a restart file dumped by TRACE ( trcdmp or PREFIX.dmp), only changes necessary for a specific transient scenario are introduced in the ASCII restart input file created by the SNAP Model Editor (or by hand).  If you want to run a set of transients from the same steady state with different time histories for a valve area, it is more trouble than necessary to extract the entire state of the valve for inclusion in all transient inputs.  There is always a way to move the table information to a "function" control block, and only replace the control block at restart.

For most component tables this is just a question of picking a component option requiring a table, giving zero as the number of table entries, and supplying the identifier of the function control block for the component table's independent variable ID number.   However, within the Model Editor you will first need to create a function control block to drive the fill before dealing with the fill properties.

In the Component Navigator window right click the "Control Systems" item and select "Create View."  The Model Editor always gives you a signal variable for transient time, which you should see in this view.  You may want to use the View menu of the Control Systems View window to zoom things a little.  You should also see a button on this window's General Toolbar  with an arrowhead pointing down. If you hold your mouse cursor over the button without clicking, a label appears reading “Select component to insert.” Click this button, and a menu appears from which you should select “Control Systems.” This generates a series of two submenus  where you should select "Control Blocks" and "Arithmetic Blocks."  Position the cursor to the right of the Time signal variable, and click to initially display the control bloc, use the connection tool to connect the two. 

You will need to edit the  control block's Properties dialog, changing the type to "(102) Function" and adding documentation.

Finally expand the "Function Table" item, click the "First" button to enter the first and only independent variable, and enter the four times used in the previous fill table.

Click OK in the Edit window, then add each temperature in the column labeled "Y".

  Now you are ready to change the  fill to work through a different fill type.  Open the fill's "Properties View" and select a  Fill Type of 10 , then click the "+" next to the "State Controllers" line to expand its view. 

In this problem only the liquid temperature changes, so just click the selection button in the row labeled "Liquid Temperature Controller", and select the control block that you just created.

Finish by setting the flow rate for the fill.  A type 10 wants a mass flow rate rather than a velocity.  Look at the output from your first model to get the liquid density in the fill and the flow area.  Multiply the density, flow area  and liquid velocity (1 m/s) together (48.94 kg/s) and enter the result in the fill property view.  At the moment  the type 10 fill doesn't accept the mass flow, so you need to go to the  Model Editor window and from the File menu, select "Export", then "TRACE", then "ASCII Full", and finally provide a name for the input file.  Open that input file with jEdit, locate the  label "flowin", and change the number below it from 0.0 to 48.94 .  Run the problem  from jEdit, and compare your results to the first version of this model.  They should match.

This is all we are going to do with control blocks for a while.  You will get a chance to use this powerful feature in more depth later.

Other Lectures

Back to 470 Home Page


Created and Maintained by John Mahaffy : jhm@psu.edu ©2004