We are interested in the simulation of heat transfer and fluid mechanics, from both a control volume (integral) approach, as well as a continuum mechanics approach. The control volume approach has been historically called thermal-network or fluid-network analysis/simulation. Broadly, a continuum mechanics approach utilizes a grid generation step, followed by the application of a discretization method. These methods can include (certainly not limited to) finite difference, finite volume or finite element approaches. The initial effort is to provide guidance and tools for sensitivity analysis and uncertainty quantification and propagation. Sensitivity analysis (local and global) is used to provide insight into how variations in the input parameters to a model affect the output parameters of the simulation. Uncertainty quantification and propagation is concerned with the determination of the uncertainty characteristics of model input parameters and then propagating them through the simulation to provide uncertainty estimates of the output.
Date | Lecture Topic | Notes | Remarks | Homework | Due Date | Office Hours |
---|---|---|---|---|---|---|
Mon, May 15 | Introduction to Dakota | Dakota Overview | ||||
Wed, May 17 | Dakota Installation | Installation Procedure | ||||
Fri, May 19 | Centered Parameter Study with Dakota | Dakota Model Characterization | Cantilever Math Model | Write MATLAB program for cannon | Mon, May 22 | |
Mon, May 22 | Review cannon.m program and the Dakota interface process. | Text based input and output files from simulation program. | Add air resistance to your cannon MATLAB program (call it cannon2.m). Write out the math model, which is two ODE's: x-direction motion and y-direction motion. Solve these using the ode45 function in MATLAB. Call the program cannon2.m. | Wed, May 24 | 10-11:30 AM in MEB 215 | |
Wed, May 24 | Sensitivity Sampling Study with Dakota |
Dakota Sensitivity and Uncertainty Quantification Latest Dakota Sensitivity Analysis |
LHS Study of Cantilever Math Model | Run Centered Parameter Study with Dakota and your cannon2.m MATLAB program with air resistance. Plot the variation in the response to the input parameters. What are your conclusions? | Fri May 26 | 10-11:30 AM in MEB 215 |
Fri, May 26 | Uncertainty Analysis with Dakota |
Dakota Uncertainty Quantification See Chapter 6 in Simulation Credibility NASA/TP-2016-219422 UQ: Specifying Uncertainty in Dakota (Revised June 2) |
Probability Distribution Functions | Run LHS Study with Dakota and your cannon2.m MATLAB program with air resistance. Add the resistance parameter, k, to the input file and study the uncertainty. Use a nominal value of k such that kV_0^2 = mg. Plot bar graphs of correlation and scatter plots with regressions. What are your conclusions? | Wed May 31 | 10-11:30 AM in MEB 259 |
Mon, May 29 | Holiday | |||||
Wed, May 31 | Surrogate Models/Variance-based Decomposition/Sobol Indices | Global Sensitivity Analysis: The Primer, Saltelli, et al., 2008 Notes on VBD/Sobol' Indices Dakota Training VBD SA Dakota Training VBD UQ |
Global Sensitivity Analysis | Start your project for the final (sooner would be better). | Wed Jun 7 2:30-4:30 PM | 10:30-11:30 AM in MEB 259 |
Fri, June 2 | Model Parameter Distribution Fitting | Fitting Distributions with R Notes on Fitting Distributions Dakota Summary |
Utilizing R | 9:30-11:30 AM in MEB 219 | ||
Wed, June 7 | Final - Project Presentations | 2:30 to 4:30 PM |
Dakota is normally used on a Linux OS computer at Sandia. The following open source tools are required for using Dakota on a Windows OS computer. Since Dakota runs from the command line you will need to open a command window as administrator. At the command prompt, execute the following commands:
The following installation will be required in the future:
The cannon projectile problem is building off of HW 5. In order to use Dakota, your MATLAB program will need to open a text input file and write the result (distance) to a text output file. Using MATLAB and the referenced code snippet, write a MATLAB program (and test it) to solve the cannon projectile problem.
There are four items you will need to run a Dakota study with cannon2.m:
A detailed checklist for the centered parameter study of the cannon problem can be found here.
A zip file of the Dakota input files, cannon2.m program and cannon.template is cannon2_solution.zip
You may choose for your project any simulation that can be solved using a program written in a language you are proficient at. You have Dakota interfaces for python, MATLAB/Octave and R. If you want to use a compiled and linked language, such as C, C++ or Fortran, that can also be accommodated with Dakota.
Examples include, cooling of a body (lumped capacity) with free or forced convection using a correlation from a heat transfer text book, a one-dimensional conduction problem with convective boundary conditions described by values of h (convection coefficient), a chemical reaction problem, etc. In other words an extension of the Cannon2 program for a problem that is of interest to you.
Nominally, you should perform a LHS study with Dakota that includes a sensitivity analysis and an uncertainty quantification and propagation. The use of a surrogate model and generation of Sobol indices, is encouraged.
An example of the math model specification that I put together for the cannon problem can be found here: cannon_model.pdf.
Prepare a 15 minute presentation of your study. Include a description of the math model, conclusions from a sensitivity analysis and conclusions from an uncertainty quantification and propagation analysis. The presentations will take place on Wednesday, June 7, from 2:30 to 4:30 PM.
@echo off SETLOCAL ENABLEEXTENSIONS REM What is the directory that I am currently in for use with simulation REM program execution of the model SET curdir=%cd% REM Process the simulation input template file with dprepro to produce REM an input file for the simulation program C:\ME498\perl\bin\perl.exe c:\me498\dakota\bin\dprepro %1 cannon.template cannon.inp REM Run the simulation program with the current input file C:\ME498\octave\bin\octave-cli --silent --path %curdir% --eval "cannon2('cannon.inp');" > NUL 2>&1 REM Post-process the simulation output to provide the repsonses to Dakota MOVE cannon.out %2 > NUL 2>&1
@echo off SETLOCAL ENABLEEXTENSIONS REM What is the directory that I am currently in for use with simulation REM program execution of the model SET curdir=%cd% REM Process the simulation input template file with dprepro to produce REM an input file for the simulation program C:\ME498\perl\bin\perl.exe c:\me498\dakota\bin\dprepro %1 cannon.template cannon.inp REM Run the simulation program with the current input file "C:\Program Files\MATLAB\R2014b\bin\matlab" -wait -nojvm -nosplash -nodesktop -minimize -logfile MATLAB.log -r "addpath('%curdir%');cannon2('cannon.inp');exit;" REM Post-process the simulation output to provide the repsonses to Dakota MOVE cannon.out %2 > NUL 2>&1
Note: execute the MATLAB command matlabroot to determine the path to your MATLAB installation. It will be different than the one shown here (since this is the path on my computer).
@echo off SETLOCAL ENABLEEXTENSIONS REM What is the directory that I am currently in for use with simulation REM program execution of the model SET curdir=%cd% REM Process the simulation input template file with dprepro to produce REM an input file for the simulation program C:\ME498\perl\bin\perl.exe C:\ME498\dakota\bin\dprepro %1 cantilever.template cantilever.i REM Run the simulation program with the current input file C:\ME498\python\python.exe cantilever.py cantilever.i > cantilever.log REM Post-process the simulation output to provide the repsonses to Dakota C:\ME498\gnuwin32\bin\tail -15 cantilever.log | C:\ME498\gnuwin32\bin\head -1 | C:\ME498\gnuwin32\bin\awk "{print $1}" > %2 C:\ME498\gnuwin32\bin\tail -11 cantilever.log | C:\ME498\gnuwin32\bin\head -1 | C:\ME498\gnuwin32\bin\awk "{print $1}" >> %2 C:\ME498\gnuwin32\bin\tail -7 cantilever.log | C:\ME498\gnuwin32\bin\head -1 | C:\ME498\gnuwin32\bin\awk "{print $1}" >> %2
@echo off SETLOCAL ENABLEEXTENSIONS REM What is the directory that I am currently in for use with simulation REM program execution of the model SET curdir=%cd% REM Process the simulation input template file with dprepro to produce REM an input file for the simulation program C:\ME498\perl\bin\perl.exe c:\me498\dakota\bin\dprepro %1 cannon.template cannon.inp REM Run the simulation program with the current input file C:\ME498\R\bin\Rscript cannon2.R REM Post-process the simulation output to provide the repsonses to Dakota MOVE cannon.out %2 > NUL 2>&1
#!/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 cantilever.template cantilever.i ############################################################################### ## ## Execution Phase -- Run your simulation ## ############################################################################### octave --no-gui --silent --path ~/ME498/mcantilever --eval "cantilever('cantilever.i')" ############################################################################### ## ## 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
#!/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 cantilever.template cantilever.i ############################################################################### ## ## Execution Phase -- Run your simulation ## ############################################################################### ./cantilever cantilever.i > cantilever.log ############################################################################### ## ## Post-processing Phase -- Extract (or calculate) quantities of interest ## from your simulation's output and write them to a properly-formatted ## Dakota results file. ## ############################################################################### mass=$(tail -15 cantilever.log | head -1 | awk '{print $1}') stress=$(tail -11 cantilever.log | head -1 | awk '{print $1}') displacement=$(tail -7 cantilever.log | head -1 | awk '{print $1}') echo "$mass mass" > $results echo "$stress stress" >> $results echo "$displacement displacement" >> $results
#!/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 cantilever.template cantilever.i ############################################################################### ## ## Execution Phase -- Run your simulation ## ############################################################################### Rscript cannon2.R ############################################################################### ## ## 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
For multicore computers (such as the Intel i7) do not specify more than the number of threads that are supported. For the snippet shown here it is an i7/4 core machine with 8 threads, so no more than 8 for the evaluation_concurrency. On my Windows machine at the command prompt:
> WMIC CPU Get DeviceID,NumberOfCores,NumberOfLogicalProcessors DeviceID NumberOfCores NumberOfLogicalProcessors CPU0 4 8
will return the number of physical cores and the number of threads that the CPU has. See Dakota Training: Parallelism and the associated video, as well as Chapter 17 in the Dakota User's Manual.
interface fork analysis_drivers = 'mdriver.cmd' # MATLAB/Octave program driver script for Windows parameters_file = 'params.in' results_file = 'results.out' # file_save asynchronous evaluation_concurrency = 8 work_directory named = 'rundir' directory_tag copy_files = 'cannon.template' 'cannon2.m' 'mdriver.cmd' # directory_save
The associated mdriver.cmd script is:
@echo off SETLOCAL ENABLEEXTENSIONS REM What is the directory that I am currently in for use with simulation REM program execution of the model SET curdir=%cd% REM Process the simulation input template file with dprepro to produce REM an input file for the simulation program C:\ME498\perl\bin\perl.exe c:\me498\dakota\bin\dprepro %1 cannon.template cannon.inp REM Run the simulation program with the current input file C:\ME498\octave\bin\octave-cli --silent --path %curdir% --eval "cannon2('cannon.inp');" > NUL 2>&1 REM Post-process the simulation output to provide the repsonses to Dakota MOVE cannon.out %2 > NUL 2>&1
Note: the use of the SET curdir=%cd% command to set the path for executing Octave. Dakota will create a working directory, then cd into it to execute the simulation script. Hence, the need to copy the files needed to run your simulation into each working directory (see copy_files) and the dynamic detection of the current directory that Dakota is using to execute your program.
Last Modified by Bob Cochran, on June 1, 2017