## Variables

Variables are named objects defined with arithmetic combinations of other variables and numbers. They, or expressions containing variables, can be used instead of simple numbers in surface and solid body coefficients. Variable usage for other items, such as material number and cell densities, will be added. The variable window contains a list of all variables and fields for defining and editing them. The surface and solid body dialogs use a distinctive style for coefficients defined with variables (known as a variable reference) and buttons for defining and editing references for each coefficient.

Moritz can include variable definitions and references when writing geometry in MCNP format. Such files cannot be read by MCNP or MCNPX; instead they must be read by Moritz and the model written in standard MCNP format. Variables are included if Write Variables is checked on the MCNP Output property page. Moritz can also read solid body geometry models in MORSE format containing Sabrina’s User Symbols. These symbols are the same as variables except for the use of a dollar sign (‘$’) as a symbol designator rather than the percent sign (‘%’).

Defining a geometry with variables permits the rapid generation of new models with different dimensions. Consider a wall with 2 layers perpendicular to the X axis defined in MCNP surface geometry. Three coefficients specifying the X value of the surfaces are required. Instead of absolute numbers, one could use variables such as:

The percent sign (‘%’) immediately precedes each variable name. The latter two values can be entered as arithmetic expressions, as shown, or as single variables that are defined separately:`1 PX %InWallX`

2 PX %InWallX+%ThickA

3 PX %InWallX+%ThickA+%ThickB

The values of the wall position and thickness dimensions are specified separately either as a single value:`%MidWallX = %InWallX + %ThickA`

or in terms of other variables:`%InWallX = 80`

Because multiple components often share the same dimensions, such as the four (or more) walls of a room, defining the surface positions with variables provides an easy method to change a layer thickness throughout the model.`%InWallX = %CenterX - %Offset`

When a number of similar geometry models or a number of variations in a single model will be needed, the small amount of additional effort needed to define variables and use them for surface or solid body coefficients and other parameters will result in significant savings in setup time beyond the first model. Meaningful variable names and detailed comments help to document the model.

White Rock Science http://www.whiterockscience.com/wrs.html 505 672 1105 |