User Tools

Site Tools


Authoring Examples

This page consists of a series of authoring examples that can be used as a reference.

Extracting Data from Files

A powerful feature of an EASAP is its ability to dynamically update content available to users without modifying the EASAP. This task is accomplished by accessing a text file each time an EASAP is initiated and extracting out all necessary information from the file for the EASAP to use.

Once the files containing the desired information have been uploaded to the EASAP directory, information can be extracted from the files using EXTRACT in combination with FIND and REPEAT. This information can then be used as choices in a CHOICE LIST and as input data to the batch files of the underlying software applications.

Example 1: Material Property Database

In this example, the goal will be to extract a list of materials and their associated physical properties from a text file for use in a CHOICE LIST. The example material database file called material.txt is shown below.

The steps for accomplishing data extraction from a materials database in a text file are as follows:

  • Create an EXTRACT under the LIST branch of the DATA PROCESSING, and then set its File: parameter to material.txt.
  • Next, create a REPEAT as a Child to the EXTRACT.
  • Finally, edit the Child FIND under the REPEAT by setting its parameters as shown below.

  • Next, create a CHOICE LIST below the DATA PROCESSING created in Step 1, and set its parameters as shown below.

In addition to populating the choices of the example CHOICE LIST with the name data in ‘mname’, the extracted property data of ‘Ein’ and ‘muin’ can be used as input data for the underlying software applications of the EASAP. An example of how this data can be applied is provided in Example 4: Material Properties.

Example 2: Extracting Numbers from Output File

In this example, the goal will be to extract two numbers from an output text file, the minimum and maximum pressure values. Part of the output file, output.dat, is shown below with a black arrow pointing to the line containing the desired data.

The strategy will be to first locate a unique text string just above the line containing the desired data, and then extract the two numbers of interest. This two-step approach eliminates the possibility of finding the wrong match earlier in the file.

The steps for accomplishing this type of data extraction are as follows:

  1. Create a DATA PROCESSING under the OUTPUT branch.

  2. Under the LIST branch of the DATA PROCESSING above, create an EXTRACT, set its File: parameter set to output.dat

  3. Create a FIND as a Child to the EXTRACT in Step 2, and then set its Value: parameter to ‘Domain Name : elbow’. This step will find a match and stop at a place in the file just above where the desired data is located.

  4. Finally, create a second FIND, and then set its Value: and Type: parameters as shown below.


Note: Only single spaces are used between the different words and characters in the Value: parameter, even though there is actually more white space in the file as shown in the file example above.


The result of this example will be that the numbers, -23.8 and 44.5, will be stored under the object names, pmin and pmax. See Using the Extract Tool.

Example 3: Processing Columns of Numbers

In this second example, the goals will be to extract columns of node displacement data from an output file called plate.out and then to determine the maximum displacement value. The relevant section of this file is shown below.

The steps for accomplishing a multiple line data extraction are as follows:

  • Create a DATA PROCESSING under the OUTPUT branch.
  • Create an EXTRACT under the LIST branch of the DATA PROCESSING with its File: parameter set to plate.out.
  • Create a FIND as a Child to the EXTRACT in Step 2, and then set its Value: parameter to ‘JOINT DISPLACEMENTS’. This step will find a match and stop at a place in the file just above where the desired data is located.
  • Next, create a REPEAT, and then set its Stop When Value: parameter to ‘plate MOMENT’.
  • Now, create a FIND as a Child to the REPEAT created in Step 4, and then set its two parameters as shown in below.

  • Finally, create a STATISTICS under the SCALAR branch of the DATA PROCESSING created in Step 1, name it MaxDisp, and then set its List: parameter to ‘zd’ and its Function: parameter to ‘MAXIMUM’.

The result of this example will be that

  1. the REPEAT will cause its Child Find to find 121 different matches before stopping;
  2. the four columns of numbers will be stored in the LIST's named node, xd, yd and zd, and
  3. the maximum displacement in the z-direction will be found and stored in the STATISTICS named MaxDisp.

Manipulation of User Input Data

This section contains a few examples of typical scenarios in which you will need to manipulate user inputs. In these examples, you will see how the various DATA PROCESSING Child objects can be put to use to achieve the desired data manipulation.

Example 4: Material Properties

It is very likely that an EASAP may be analyzing something made out of some sort of material, and subsequently, software applications used in the analysis will need to have the material properties specified. Many software applications can pull this information from an existing database knowing only a material name, but many times software applications expect to receive the individual material properties as input.

From the users’ perspective, authors should avoid asking them for individual material properties and ask only for the material name. The author should then take on the responsibility for ‘mapping’ the material choice into the appropriate material property values.

This example is a continuation of Example 1: Material Property Database above, in which data extracted from a materials database file has been used to populate a CHOICE LIST.

The goal here is to determine the appropriate value for the Modulus of Elasticity and Poisson ratio for the material selected by the user.

The steps for accomplishing this type of data manipulation are as follows:

  • Create a MAP mapping the material choices from the CHOICE LIST mat into values for the modulus of elasticity. See figure below for the MAP definition.

  • Create a second MAP mapping the material choices from the CHOICE LIST mat, into values for the Poisson ratio. See the figure below for the MAP definition.

  • Use the values of the two MAP's as direct input into the template batch file for the structural analysis software.

Example 5: Dealing with Flags

To keep input file sizes smaller and to simplify reading of inputs, many software applications make use of ‘flags’ within their input files. Flags are typically integer numbers that represent a certain setting e.g. 1 for the first possible setting value, 2 for the second setting value, etc.

Here is another instance where users of an EASAP should not be asked to supply exactly what the underlying software requires. Instead, a more descriptive, literal set of choices should be provided to the user, and again the author should then map the choices to the appropriate flags expected by the software applications.

For this example, let’s say a structural analysis code needs to have the support conditions specified for a loading analysis of a beam or plate. The three possible conditions are ‘free’, ‘pinned’ or ‘fixed’, but the code uses flags to represent these settings in its input file. Namely, these flags are: 0 for free, 1 for pinned, and 2 for fixed. The steps for accomplishing the necessary data manipulation are as follows:

  1. Create a CHOICE LIST with the available support conditions. See first figure below for an example CHOICE LIST definition.

  2. Create a MAP mapping the support condition choices from Step 1 into the proper flag settings. See second figure below for the MAP definition.

  3. Use the MAP’s value as direct input into the template batch file for the structural analysis software.

Example 6: Handling Discretization of Dimensions

Any software applications that make use of finite difference, finite element, finite volume or similar numerical methods will need to somehow divide the geometry of the object or area being analyzed into smaller, discrete pieces. This discretization of a whole into a sum of smaller pieces is also known as gridding or meshing. These types of software applications will require inputs defining how the meshing or gridding process should take place.

In general, authors should avoid requesting gridding or meshing specific inputs from users. One of the benefits of an EASAP should be the capturing of best practices, and EASAP authors are expected to be expert users of the underlying software applications. Therefore, where possible, authors should make the determination of how the meshing of a particular problem should be performed. Users should only be asked for geometric information and maybe in addition an indication of their accuracy and turn around time expectations. From this information, an author can then determine the settings for the meshing performed in the underlying software applications.

For this example, we’ll look at the analysis of a flat rectangular plate. The analysis software expects two inputs per side of the rectangle to govern the meshing process: 1) the number of elements along a side, and 2) the uniform element size along a side. It does not expect the full dimension of the side. However, the full dimensions of the rectangle are exactly what the user should be asked to supply. The steps for accomplishing the necessary data manipulation are as follows:

  • Create a REALBOX requesting the width of the plate, W. See first figure below for an example Realbox object definition.
  • Create a COMPUTE that computes the uniform element size along the width of the plate. The expression used for the COMPUTE’s Value: parameter takes the width of the plate and divides by the number of elements that have been determined to be adequate for the analysis. In this case, 10 elements have been deemed to be adequate. See second figure below for the example COMPUTE definition.

  • Fix the number of divisions to 10 in the template batch file, and then use the COMPUTE’s value as direct input into the template batch file for the uniform element size.

Example 7: Regime Selection

Often in analysis software applications, certain assumptions must be specified up front about the problem to be analyzed in order for the application to produce sensible results. A common situation that results in assumptions being made is when there are multiple ‘regimes’ governing the mathematics or physics of a problem.

Examples of these regimes are for instance in structural analysis, elastic vs. plastic deformation, and in fluid flow analysis, laminar vs. turbulent flow or incompressible vs. compressible flow. Typically, software applications need to have a single regime specified at the outset of the analysis in the input files.

Following the common theme of not exposing the needs of the underlying software applications to the user, authors should avoid asking the user to specify a regime for the analysis performed by an EASAP. There are two ways to avoid the regime question:

  1. Pick a single regime that the EASAP will operate within, and then design the data entry objects and any bounds checking on these objects such that user’s inputs can only specify a problem within the chosen regime.

  2. Determine the regime to be analyzed based on user inputs and vary the regime specification in the template batch files accordingly.

The example of regime selection to be provided below uses the second method, in which the regime is determined based on user inputs. In this example, the problem to be analyzed involves fluid flow in a pipe, and the regime selection is between laminar or turbulent flow. The regime will be determined from the user inputs of pipe diameter, fluid type, and volumetric flow rate. The procedure for the required data manipulation is as follows:

  1. Create a REALBOX named ‘D’ requesting the pipe diameter.

  2. Create a CHOICE LIST for the fluid type selection.

  3. Create a REALBOX named ‘Q’ requesting the volumetric flow rate.

  4. Create a MAP named ‘rho’ that sets the value for the fluid density based on the fluid type selection defined in Step 2.

  5. Create a MAP named ‘mu’ that sets the value for the fluid molecular viscosity based on the fluid type selection defined in Step 2.

  6. Create a COMPUTE named ‘A’ that computes the pipe inlet area using the expression: 0.25*pi*D^2

  7. Create a COMPUTE named ‘U’ that computes the inlet fluid velocity using the expression: Q/A

  8. Create a COMPUTE named ‘Re’ that computes the inlet flow Reynolds number using the expression: rho*D*U/mu

  9. Create a COMPUTE named ‘turbflag’ using the following logical expression: 'Re>2300.'

  10. Create a series of EXPAND's that contain the various command lines needed for both laminar and turbulent flow within the fluid flow analysis software application.

  11. Create a series of MAP's that map the value of ‘turbflag’ into the laminar or turbulent command lines using the EXPAND's created in Step 10. If ‘turbflag’ equals 0.0, then map to the EXPAND's containing the laminar commands. Conversely, if ‘turbflag’ equals 1.0, then map to the EXPAND's containing the turbulent commands. See Figure D.14 for an example of the parameters settings for this type of MAP.

  12. Now, the values of ‘rho’, ‘mu’, ‘D’ and the series of MAP's created in Step 11 can be inserted directly into the input files for the fluid flow analysis software.


Note: An alternative to performing steps 10 and 11 in Example 7 would be to have two separate input files created, one set up for laminar flow and the other set up for turbulent flow. Then, all you would need to do is use the Run if: parameter in the separate PROCESS's.