Checklist for a Dakota Study
- There are four items required for any study
- Dakota input file
- Template for your simulation program input file
- the
variables
defined in the Dakota input file using descriptors
are placed in the template file, inside braces {}, at the appropriate locations
- Your simulation program
- Your simulation program must run from the command line
- A script that does three things:
- Runs
dprepro
to process your input file template to generate an input file for your simulation program
- Runs your simulation program from the command line
- Process the simulation program output file to extract the response data and place it in a file for Dakota
The Cannon Centered Parameter Study
- The cannon model studied here is the no air resistance version cannon.m.
- The cannon input file (named
cannon.inp
) is the velocity on the first line, followed by the angle:
10.0
23.5
{velocity}
{angle}
# Cannon problem - centered parameter study
environment
tabular_data
tabular_data_file = 'cannon_centered_tabular.dat'
method
centered_parameter_study
steps_per_variable = 4
# 'velocity' 'angle'
step_vector = 2.0 5.0
variables
active all
continuous_design = 2
descriptors = 'velocity' 'angle'
initial_point = 10.0 23.5
interface
fork
analysis_drivers = 'mdriver.cmd' # MATLAB/Octave program driver script for Windows
# analysis_drivers = 'driver.sh' # MATLAB/Octave program driver script for Linux/Mac OS X
parameters_file = 'params.in'
results_file = 'results.out'
# file_save
responses
response_functions = 1
descriptors = 'distance'
no_gradients
no_hessians
- The two variables
velocity
and angle
are defined in the variables
block and given nominal values using initial_point
- The number of steps
steps_per_variable
and the size of the steps step_vector
are defined in the method
block
- number of evaluations = (2 X
steps_per_variable
X number of variables
) + 1
- number of evaluations = (2 X 4 X 2) + 1 = 17
- velocity will vary as: 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 18.0
- angle will vary as: 3.5 8.5 13.5 18.5 23.5 28.5 33.5 38.5 43.5
- The Windows cmd script which executes
dprepro
, then the cannon.m program using Octave and post processes the output, is called mdriver.cmd:
@echo off
rem Process the simulation program input file template with dprepro to
rem generate the input file for the simulation program using the first
rem script argument, %1, as the variable values input file to dprepro
C:\ME498\perl\bin\perl.exe C:\ME498\dakota\bin\dprepro %1 cannon.template cannon.inp
rem Run the simulation program using the input file from the previous
rem command
C:\ME498\octave\bin\octave-cli --silent --path c:/me498/cannon --eval "cannon('cannon.inp');" > NUL 2>&1
rem Post-process the simulation results to produce the response data for
rem input to dakota using the second script argument, %2, as the file name
rem used by Dakota
move cannon.out %2 > NUL 2>&1
- The Linux/Mac OS X bash shell script which which executes
dprepro
, then the cannon.m program using Octave and post processes the output, is called driver.sh:
#!/bin/bash
# $1 and $2 are special variables in bash that contain the 1st and 2nd
# command line arguments to the script, which are the names of the
# Dakota parameters and results files, respectively.
params=$1
results=$2
###############################################################################
##
## Pre-processing Phase -- Generate/configure an input file for your simulation
## by substiting in parameter values from the Dakota paramters file.
##
###############################################################################
dprepro $params cannon.template cannon.inp
###############################################################################
##
## Execution Phase -- Run your simulation
##
###############################################################################
octave --no-gui --silent --path ~/ME498/cannon --eval "cannon('cannon.inp')"
###############################################################################
##
## Post-processing Phase -- Extract (or calculate) quantities of interest
## from your simulation's output and write them to a properly-formatted
## Dakota results file.
##
###############################################################################
mv cannon.out $results
- Note that the name of the input file (
cannon.inp
) to your simulation program (the last argument used when executing dprepro
) must match the name given in the Octave --eval
argument: "cannon('cannon.inp');"
- Note that the
path
to your study directory/folder needs to be set to the path you are launching the Dakota study in
- Make sure you use forward slashes / in the
path
when executing Octave on Windows
- Note that the %1 argument (to
mdriver.cmd
) will be the parameters_file
and the %2 argument will be the results_file
named in the interface
block of the Dakota input file
- If you uncomment (delete # at the beginning of the line) the
file_save
command in the interface
block, Dakota will leave all of the parameter and results files generated during the study. It is useful to try this to check the input to dprepro
, as well as your post processing to results effort.
- Post-process the study
- Import the tabular data file into a spreadsheet program and look at the response variation to the variables
- Plot the tabular data file using the MATLAB/Octave functions readtabular.m and plotcentered.m
- A sample script using these two functions is plot_cannon.m
- Uncomment the print lines in plotcentered.m if you want to save the plots for later presentation


Back to ME498/599 Home Page