Computer Simulations
Sensitivity Analysis
Carrying out analysis with Arcadia
symbolic names
job files
building the run file
data flow in Arcadia
Other Facilities
Equations in Buffer Model
A Sample Input
sample output

ARCADIA PRIMER

Introduction for first users of ARCADIA


Chapter 1.
COMPUTER SIMULATIONS

Most engineers nowadays are using computer models to simulate events in nature, in society or in man-made structures. Well-known are packages like STRUDL or NASTRAN used in structural engineering, but similar packages are found in other branches of engineering.

Many engineering problems require large numbers of computer runs with one or more computer models to arrive at the information required; ARCADIA is a system that helps to carry out such series of runs and in addition to interpret the results.

As an example we discuss the use of ARCADIA in connection with a simple model that simulates the motion of the water in a closed conduit from a reservoir to a power station. At the power station the flow is controlled; the valve controlling the flow can be closed in case of repair, it can be opened later; it also controls the flow which can be increased or reduced to follow the fluctuations in the demand of energy. To diminish corresponding pressure peaks in the closed conduit a storage tower is built at the side of the power station. A diagram illustrating the principle of the structure is given in figure 1.

Figure 1. Definition sketch of a system consisting of
a closed conduit connecting a reservoir and a power station.
 

For those interested in equations, see appendix A. Here it suffices to describe the process in words: Assume that the water is initially at rest. Now the downstream valve (at the power station) is opened and the water will start to flow out of the tower, thereby lowering the level in the tower; the difference in level between the reservoir and the tower will accelerate the water in the conduit, and after some oscillations an equilibrium state is reached in which the flow in the conduit is equal to the outflow at the power station. A corresponding train of events take place if the valve is closed.

For the design of an actual system like this, a simulation model may be helpful, because it can tell the engineer how large the pressure drop from the reservoir to the tower will be, how high the level in the tower may rise and how deep it will sink during oscillations. To simulate this process we have a simple computer model, called BUFMOD. It is based on the equations in appendix A. This model, as any other computer model, needs a number of data that describe a particular situation, in order to compute the time history for the chosen situation. We can distinguish two types of input data for the model: model coefficients, i.e. numbers that describe the permanent properties of the actual system, and the boundary conditions, i.e. quantities that describe outside influences on the system and that usually may vary from day to day (see figure 2). In the model BUFMOD the model coefficients are the length of the conduit, its diameter and its friction coefficient (a measure for the resistance that the flow experiences in the conduit), and the dimensions of the storage tower. Boundary conditions (e.g. daily operating conditions) are the water level in the reservoir and the flow at the power station. With these input data given the model will be able to compute the state of the system. The state of the system is described by a set of state variables. In the case of the model BUFMOD the state variables are the flow in the conduit and the water level in the storage tower, both of which are functions of time. The program can write the values of these state variables to paper output, or to secondary memory in the computer.

Figure 2. Data flow in the model

For certain given model coefficients and boundary conditions BUFMOD will produce results such as shown in the figures 3 and 4.

Figure 3. Water level and discharge in the pipe
and in the outflow valve as function of time;
situation: closing off after a period of constant flow.
green dashed line: (given) outflow,
blue dash-dot line: flow rate in the conduit;
continuous line: water level in the buffer tower


Figure 4. Water level and discharge in the pipe
and in the outflow valve as function of time;
situation: from a state of no flow to constant flow.
 

In order to get the computer to produce the data we want, we have to submit a file, telling it to run BUFMOD, and giving numbers for the various input data. Furthermore we must indicate how we want the computation to be carried out, what results we want and where they must be written to. These instructions are found in the input file to BUFMOD which may read:

    5000., 1.2, 0.004, 14.
    0.2, 0.8, 0., 60.
    10., 1200., 'OUT.DAT', 20.
Figure 5. Computer input to run BUFMOD

The user of the model instructs the computer to run the BUFMOD model with the above input data; on a PC he would give the (DOS) command:

       BUFMOD  <INPUT.DAT

This command tells the computer to load the model BUFMOD into its memory and start executing it using the file INPUT.DAT as input (this file has the contents shown in figure 5). Unfortunately commands like this look different on different operating systems, so we use here the MS-DOS operating system as an example. The input to BUFMOD on the other hand is specific for BUFMOD, and it will look the same on all computers, because BUFMOD is written in a generally accepted programming language, Fortran-77. The first line of the BUFMOD input contains the model coefficients, the second line the boundary conditions, and the third line gives the computational time step, the length of the simulation period, the name of the file on which we want the results (level and flow as function of time), and the time interval with which the results are written to that file.

Chapter 2.
SENSITIVITY ANALYSIS

If we want to design an actual system, we may be able to make a first guess of the dimensions of the various parts of the system, based on education or experience. Once a design has been decided upon it is very well possible to restrict the number of computations to a small number. Only one or a few computer runs simulating the behaviour of the system are carried out in order to verify whether the system functions properly under various combinations of boundary conditions. However, if we are to optimize the design, a further analysis is needed. For instance if we want to optimize the design of the storage tower, it is necessary to know how much the maximum and the minimum water level in the tower can vary in daily operating conditions. These levels depend on the values of the various input data, such as the water level in the reservoir, the friction in the conduit, the flow in the system etc.. To assess which of these input variables dominates the behaviour of the system a sensitivity analysis is required. When these variables are identified, the optimization can concentrate on these variables. A sensitivity analysis consists of a set of simulations in which the input data are perturbed, and corresponding output data are determined. For a given range of input data values the corresponding range of the output data is determined, and it will become clear which of the input data have a large influence on the output data, and which have a small influence. A sensitivity analysis can also be useful if we want to plan a measurement campaign. If there are a number of locations where measurements can be carried out, and a number of quantities that can be measured, a sensitivity analysis can tell us which of these locations and quantities are the most sensitive to the value of the parameter that must be measured.

Chapter 3.
CARRYING OUT A SENSITIVITY ANALYSIS WITH ARCADIA

How are we going to carry out a sensitivity analysis? The traditional approach is to make one computation with a set of probable values for the input parameters and then perturb each of the input parameters, make a computation for each perturbation and see how much the results (state variables) will change due to these perturbations. Here the system ARCADIA can assist in two ways, 1: it helps in preparing the set of input files needed to make the various computer runs, and 2: it helps in analysing the results of the runs.

When using ARCADIA the user prepares one model input in which each input parameter that must be varied, is replaced by a name enclosed in square brackets. Then the generation module of ARCADIA (ARCADIA-GENER) will copy the model input as often as needed while substituting the necessary numerical values. In the model input for BUFMOD (see example in figure 5) the numbers 1.2, 0.004, and 14. have been replaced by names chosen by the user (who in this case used names indicating their physical meaning):

    5000., [DIAM], [FRIC], [CROSS-SECT]
    [RES-LEVEL], [FLOW], 0., [TRANS-TIME]
    10., 1200., 'OUT.DAT', 20.
Figure 6. Input file to be processed by ARCADIA
 

It is seen that the symbolic names are enclosed in square brackets; these are recognized by ARCADIA-GENER as names to be substituted by numerical values. ARCADIA-GENER also has to know what values have to be substituted. The instructions for this are to be provided by the user in a command file. The commands are described in the ARCADIA user manual. The variable input parameters for instance are defined under the command PAR; under this command the name of the parameter appears and its basic value (i.e. its most likely value estimated from experience or as an educated guess), and its possible deviation. This deviation is interpreted here as the largest deviation from its basic value, that the parameter may show in practice. To see the complete set of commands as used in this example, see appendix B. The complete command input also contains commands, e.g. commands that control the data exchange between the model and the modules of ARCADIA, ARCCOL and ARCEVAL.

The information concerning the model coefficients is given in the following commands:

    PARAM  'FRIC' 0.004, pos 0.002
    PARAM  'CROSS-SECT' 10.,  pos  5.
    CONST  'DIAM' 1.
    PARAM  'TRANS-TIME' 40., pos 20.
    PARAM  'FL-BEG' 0.5,  pos  0.2
    CONST  'FL-END' 0.
    PARAM  'RES-LEVEL' 0., real  0.5
Figure 7. Instructions to ARCADIA
 

It is not sufficient to prepare the input files for the runs; also a file is prepared which starts the computer program as many times as needed for the sensitivity analysis. In order to be able to prepare such a file ARCADIA needs as input the so-called jobfile. It may read in our case:

    if exist arcerr del arcerr
    ##
    BUFMOD.EXE  <[INPUTDATA]
    ARCCOL.EXE
    IF EXIST ARCERR. GOTO ERRGEN
    ##
    COPY PRINT. BUF.CPT
    ARCEVAL.EXE
    COPY PRINT. BUF.EPT
    GOTO FINISH
    :ERRGEN
    TYPE ARCERR.
    :FINISH
Figure 8. Jobfile used as input to ARCADIA

The first line of the jobfile contains any instructions that have to be executed just once at the beginning of the series of computations. It may for instance contain accounting information; on a PC accounting information is irrelevant; here we only see a statement that deletes the file on which error messages will be writted by the Collect module (see further dow). The initial instructions are separated from the lines that must be repeatedly copied by ARCADIA, by a separation mark, for which we often use ##. The part between two consecutive lines ## contains the instructions to run the computer program BUFMOD, and the Collect module. This so-called repeated part is separated again by a separation mark from the closure lines. The statement ARCEVAL.EXE instructs ARCADIA to carry out the computations for interpretation. The program names ARCCOL.EXE and ARCEVAL.EXE stand for ARCADIA-COLLECT and ARCADIA-EVAL, the collect and the evaluation module resp..

ARCADIA-GENER will generate a file in which the part of the jobfile between ## is repeatedly copied, and which is ready for execution by the computer. This file is called the Runfile; on a PC we usually use the name RUN.BAT for this file. If this file is generated correctly, all the user has to do is ask the computer to carry out the instructions, this is done by a DOS command: RUN or RUN.BAT.
The Runfile thus generated by ARCADIA-GENER reads:

    if exist arcerr del arcerr
    BUFMOD.EXE  <B1.DAT
    ARCCOL.EXE
    IF EXIST ARCERR. GOTO ERRGEN
    BUFMOD.EXE  <B2.DAT
    ARCCOL.EXE
    IF EXIST ARCERR. GOTO ERRGEN
    BUFMOD.EXE  <B3.DAT
    ARCCOL.EXE
    IF EXIST ARCERR. GOTO ERRGEN
    ...
    COPY PRINT. BUF.CPT
    ARCEVAL.EXE
    COPY PRINT. BUF.EPT
    GOTO FINISH
    :ERRGEN
    TYPE ARCERR.
    :FINISH
Figure 9. Runfile generated by ARCADIA

In the Runfile the various input files for the buffer model are named B1.DAT, B2.DAT etc.; these file are also generated by ARCADIA. For instance the file B1.DAT reads:

    5000.,   0.1000E+01,   0.4001E-02,   0.1000E+02
    0.0000E+00,   0.5000E+00,   0.0000E+00,   0.4000E+02
    10., 1200., 'OUT.DAT', 20.
Figure 10. An input file generated by ARCADIA

ARCCOL will pick up data produced by the model in the result file and collect a selection of these into a file called the Collect file. Once the data from all model runs are available on the collect file, the module ARCEVAL starts to produce tables on printed output. These tables summarise the results: the basic values of the result variables and their deviations. Optionally also the contributions of the various input parameters to selected output variables are printed, this shows i.e. which input parameters have most influence on the output variables. The flow of data is sketched in figure 11.

In the above example the output values produced by each BUFMOD run appear on the file OUT.DAT, ARCCOL will read the data from this file and select some of these values, according to instructions by the user. These instructions are given by the user in the ARCADIA command file under the command RESULT (giving the structure and kind of data on the result file, OUT.DAT in our case). The command OBTAIN in the command file tells ARCCOL what data it must select from the result file, and copy to the collect file. The collect file is the transfer medium between ARCCOL and ARCEVAL. ARCEVAL can subsequently carry out some simple post-processing on the data collected on the collect file; for instance to determine in our case the maximum and minimum water levels in the tower in each time series computed by a BUFMOD run.

Figure 11. Data flow in the ARCADIA system.
A dark block denotes a process.
Yellow blocks denote sets of data.

Chapter 4.
OTHER FACILITIES OF ARCADIA

Apart from the sensitivity analysis mode there are three more modes of use in the ARCADIA system, viz. the dependency mode, the calibration mode and the probability transformation mode. Both types of computation require sometimes large number of model runs, a task for which ARCADIA is specially designed. The whole system works in these modes essentially the same way as with the sensitivity analysis mode.

The dependency mode can be considered as a different kind of sensitivity analysis. Here one model coefficient can be assigned a set of values and ARCADIA will generate a set of runs, and produce a table from which it can be seen how a certain (chosen) output quantity depends on this parameter. If desired ARCADIA can also assign random values to input parameters; a selection can be made among the results where a certain quantity reaches the largest value or set of values.

In the calibration mode the values of a number of input parameters (e.g. the friction coefficient in the above example of BUFMOD) is estimated from a set of measurements, e.g. the water level in the tower and the outflow. In the estimation process a penalty function, consisting of the sum of the squares of the differences between measurements and computed values, is minimized. In general, the quantities measured correspond to state variables computed by the model or related quantities.

In the probability transformation mode a number of stochastic input variables (usually boundary conditions as defined above, e.g. the initial flow in the conduit or the flow at the valve) are given, along with their probability density functions. After computations with all possible combinations of values of the input variables, the probability density functions of state variables selected by the user, is determined.

In these other options the operation of the module ARCADIA-COLLECT is exactly the same as in the sensitivity analysis mode; the module ARCADIA-EVAL is used differently; in the calibration mode it computes the minimum of a penalty function of the difference between computed and measured quantities, and in the probability mode it transforms probability density functions.

Appendix A.
Equations employed in BUFMOD

A number of assumptions are made in order to arrive at the equations in BUFMOD; to mention a few: the influence of pressure waves in the conduit is neglected, in other words the flow is the same everywhere in the conduit; energy losses due to inflow and outflow are neglected with respect to the friction losses in the conduit; the flow controlling valve is assumed to be immediately downstream of the tower, etc.

Let Q be the discharge in the conduit (cubic m per sec), and Qo the discharge at the downstream valve (cubic m per sec); let Hr be the water level in the reservoir with respect to a given datum, for which we take the average level in the reservoir (unit: m), H the water level in the tower (see figure 1). Q and H are state variables, Qo and Hr are boundary conditions. Model coefficients are L, the length of the conduit (m), R, the radius of the conduit (m), f, the friction coefficient (non-dimensional), and B the cross-sectional area of the tower (square m). Furthermore t is the time in seconds.

The equation of motion for the flow in the conduit is:
dQ/dt + f.|Q|Q/{A.Rh} - gA.(Hr - H)/L = 0
where A=πR2 and Rh=½R, the cross-section of the conduit and the hydraulic radius resp.. The continuity equation for the volume of water in the storage tower reads:
B.dH/dt = Q - Qo
Input to BUFMOD are the following data:

  1. Length of the conduit, diameter of the conduit, friction coefficient, cross-section of the storage tower,
  2. Water level in the reservoir, initial flow in the conduit, final flow in the conduit, transition time (see figure 12) between the initial flow and the final flow at the valve,
  3. Computational time step, total simulation time, name of the output file, time interval between moments at which output is made.

Figure 12. A given boundary condition: outflow in the conduit system as function of time

The output of BUFMOD consists of a table with 4 columns:

  • Time (s),
  • water level in the storage tower (m),
  • flow in the conduit (m3/s),
  • flow at the valve (m3/s).
This output is sent to the file whose name is given in the input (here OUT.DAT). This output looks like:

             T           Q          Qo           H
    0.0000E+00  0.5000E+00  0.5000E+00 -0.3296E+01
    0.2000E+02  0.4982E+00  0.2500E+00 -0.2923E+01
    0.4000E+02  0.4842E+00  0.0000E+00 -0.2070E+01
    0.6000E+02  0.4514E+00  0.0000E+00 -0.1149E+01
    0.8000E+02  0.4053E+00  0.0000E+00 -0.3140E+00
    0.1000E+03  0.3509E+00  0.0000E+00  0.4158E+00
    0.1200E+03  0.2911E+00  0.0000E+00  0.1028E+01
    0.1400E+03  0.2279E+00  0.0000E+00  0.1516E+01
    0.1600E+03  0.1626E+00  0.0000E+00  0.1874E+01
    0.1800E+03  0.9594E-01  0.0000E+00  0.2100E+01
    0.2000E+03  0.2860E-01  0.0000E+00  0.2190E+01
    0.2200E+03 -0.3885E-01  0.0000E+00  0.2146E+01
    0.2400E+03 -0.1019E+00  0.0000E+00  0.1973E+01
    0.2600E+03 -0.1541E+00  0.0000E+00  0.1689E+01
    ....
Figure 13. Output by the buffer model

Appendix B.
Sample input to ARCADIA

The sample problem is defined in two files, i.e. the jobfile and the command file. The jobfile is given in figure 6 of chapter 2; the command file is printed below. It can be interpreted by means of the ARCADIA user manual.

The command file reads:

  MODE S
  STRING [MODEL] IS 'BUFMOD'
  PROJECT 'TEST ARCADIA' 'BS2'
    'test of the Arcadia system with the model Bufmod'
    'Initial state is stationary flow'
    'Outflow valve is closed'
  $
  $     model coefficients varied in the analysis
  $
  PARAM  'FRIC' 0.004, pos 0.002
                  $ Friction coefficient
  PARAM  'CROSS-SECT' 10.,  pos  5.
                  $ Cross-section of storage tower
  CONST  'DIAM' 1.      $ Diameter of pipe
  PARAM  'TRANS-TIME' 40., pos 20.
                  $ Transition time for valve opening
  PARAM  'FL-BEG' 0.5,  pos  0.2  $ Outflow initial
  CONST  'FL-END' 0.
                  $ Outflow after transition time
  PARAM  'RES-LEVEL' 0., real  0.5
                  $ Reservoir level
  $
  $     Files: jobfile, runfile, collect file,
  $                         multiple input file
  $
  JOBFILE 'MOD.JBF'
  RUNFILE 'RUN.BAT'
  COLLECT 'BUFS2.COL'
  $
  MFILE  'B[RUNCOUNT].DAT' alias [INPUTDATA]  &
          contents '-------'
  5000., [DIAM], [FRIC], [CROSS-SECT]
  [RES-LEVEL], [FL-BEG], [FL-END], [TRANS-TIME]
  10., 1000., 'out.dat',  20.
  ----------------------------
  $
  $     processing of model output
  $
  RESULT 'OUT.DAT' 2, 50, 4
  OBTAIN 'H' 4    $ H is in 4th column of output table
  OBTAIN 'Q' 2    $ Q is in 2nd column of output table
  EVAL 'HMAX' MAX 'H'
  EVAL 'MINH' MULT  'MINUS' 'H'
  EVAL 'HMINA' MAX 'MINH'
  EVAL 'HMIN' MULT 'MINUS' 'HMINA'
  OUTPUT   SENS CONTRIB  'HMAX' 'HMIN'
  OUTPUT NOPR 'BUF.OUT' SENS CONTRIB  'HMAX'
  picture 'plfile' contrib  'HMAX' 1 'HMIN' 2
  STOP

The output produced by the Evaluation module of ARCADIA reads:

  DIGITAL HYDRAULICS HOLLAND                TEST ARCADIA     BS2
  ARCADIA/EVAL   30.13
  test of the Arcadia system with the model Bufmod

  Initial state is stationary flow

  Outflow valve is closed

  ----------------------------------------------------------------

  NAME                BASIC VALUE   DEVIATION

  HMAX                0.2190E+01    0.8878E+01
  HMIN               -0.3296E+01    0.1430E+01


           CONTRIBUTIONS OF INPUT PARAMETERS

                   HMAX    HMIN
  FRIC             0.0000 -0.0070
  CROSS-SECT      -0.8640  0.0000
  TRANS-TIME      -0.5001  0.0000
  FL-BEG           0.0158 -0.9369
  RES-LEVEL        0.0563  0.3496

The above output consists of two parts; the first gives the basic value and the deviation for each output variable that was mentioned in the command SENSITIVITY_ANAL of the command file. The basic value and deviation here have a similar meaning as discussed in relation to the input parameters. In the second part vertically all variable input parameters are found. The coefficients in the table indicate what part of the deviation of an output variable was due to the deviation of this input parameter. If the coefficient is negative, an increase of the input parameter results in a decrease of the output variable. The sum of the squares of the coefficients in one column must be 1.
It is seen here that Hmax can vary much, and that it depends most strongly on the variable CROSS-SECT (the cross-section of the buffer tower). Hmin varies much less; it depends mostly on the initial discharge FL-BEG (the discharge as it was before the power station closed).

  ©: Nico Booij (2012)