Skip to content

Commit

Permalink
initiated a new chaper for sensitivity analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
vohramanav authored and dmcdougall committed Nov 19, 2016
1 parent fc3e05d commit dd4ba59
Show file tree
Hide file tree
Showing 8 changed files with 499 additions and 4 deletions.
Binary file added manual/users/rawfigs/sensitivity_plot.pdf
Binary file not shown.
71 changes: 71 additions & 0 deletions manual/users/sensitivity_mc.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include <cmath>
#include <fstream>
#include <iomanip> // for setprecision

#include <queso/GslVector.h>
#include <queso/GslMatrix.h>
#include <sensitivity_mc.h>

template<class P_V, class P_M, class Q_V, class Q_M>
Qoi_mc<P_V, P_M, Q_V, Q_M>::Qoi_mc(const char * prefix,
const QUESO::VectorSet<P_V, P_M> & domainSet,
const QUESO::VectorSet<Q_V, Q_M> & imageSet)
: QUESO::BaseVectorFunction<P_V, P_M, Q_V, Q_M>(prefix, domainSet, imageSet),
x_loc(3)
{
}

template<class P_V, class P_M, class Q_V, class Q_M>
Qoi_mc<P_V, P_M, Q_V, Q_M>::~Qoi_mc()
{
// Deconstruct here
}

template<class P_V, class P_M, class Q_V, class Q_M>
void
Qoi_mc<P_V, P_M, Q_V, Q_M>::compute(const P_V & domainVector,
const P_V * domainDirection,
Q_V & imageVector, QUESO::DistArray<P_V *> * gradVectors,
QUESO::DistArray<P_M *> * hessianMatrices,
QUESO::DistArray<P_V *> * hessianEffects) const
{
if (domainVector.sizeLocal() != 2) {
queso_error_msg("domainVector does not have size 2");
}
if (imageVector.sizeLocal() != 1) {
queso_error_msg("imageVector does not have size 1");
}

qoi_samples.open ("c_qoi_samplesAi.txt", std::fstream::in | std::fstream::out | std::fstream::app);

// ----Generate Qoi using samples from a text files -------------
count++;
samples.open ("./files_sense/c_samples_Ai.txt", std::fstream::in | std::fstream::out | std::fstream::app);

int cou = 1;

while (samples >> mf >> cf){
if (cou == count){
m = mf;
c = cf;
break;
}
cou++;
}

// ------- Generate Qoi using pseudo-random MC samples ------------
// std::cout << "m = " << domainVector[0] << std::endl;
// m = domainVector[0]; // Sample of the RV 'line slope'
// c = domainVector[1]; // Sample of the RV 'y-intercept'
double y_obs = 0.0;
y_obs = m*x_loc + c;

qoi_samples << std::setprecision(4) << y_obs << "\t\t" << m << "\t\t" << c << std::endl;

imageVector[0] = y_obs;
qoi_samples.close();
samples.close();
}

template class Qoi_mc<QUESO::GslVector, QUESO::GslMatrix, QUESO::GslVector,
QUESO::GslMatrix>;
30 changes: 30 additions & 0 deletions manual/users/sensitivity_mc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef QUESO_EXAMPLE_SENSITIVITY_MC_H
#define QUESO_EXAMPLE_SENSITIVITY_MC_H

#include <queso/VectorFunction.h>
#include <queso/DistArray.h>
#include <fstream>

template<class P_V = QUESO::GslVector, class P_M = QUESO::GslMatrix,
class Q_V = QUESO::GslVector, class Q_M = QUESO::GslMatrix>
class Qoi_mc : public QUESO::BaseVectorFunction<P_V, P_M, Q_V, Q_M>
{
public:
Qoi_mc(const char * prefix, const QUESO::VectorSet<P_V, P_M> & domainSet,
const QUESO::VectorSet<Q_V, Q_M> & imageSet);
virtual ~Qoi_mc();
virtual void compute(const P_V & domainVector, const P_V * domainDirection,
Q_V & imageVector, QUESO::DistArray<P_V *> * gradVectors,
QUESO::DistArray<P_M *> * hessianMatrices,
QUESO::DistArray<P_V *> * hessianEffects) const;

private:
double x_loc;
mutable double m,c,mf,cf,count;
mutable std::fstream qoi_samples;
mutable std::fstream samples;

};

#endif

119 changes: 119 additions & 0 deletions manual/users/uq.bib
Original file line number Diff line number Diff line change
Expand Up @@ -1112,3 +1112,122 @@ @Misc{wiki:ablation
OPTkeywords = {},
}

@article{Cukier:1973,
title={Study of the sensitivity of coupled reaction systems to uncertainties in rate coefficients. {I} Theory},
author={Cukier, R.I. and Fortuin, C.M. and Shuler, K.E. and Petschek, A.G. and Schaibly, J.H.},
journal={The Journal of chemical physics},
volume={59},
number={8},
pages={3873--3878},
year={1973},
publisher={AIP Publishing}
}

@article{Sobol:1990,
title={On sensitivity estimation for nonlinear mathematical models},
author={Sobol', I.M.},
journal={Matematicheskoe Modelirovanie},
volume={2},
number={1},
pages={112--118},
year={1990},
publisher={Russian Academy of Sciences, Branch of Mathematical Sciences}
}

@book{Saltelli:2008,
title={Global sensitivity analysis: the primer},
author={Saltelli, A. and Ratto, M. and Andres, T. and Campolongo, F. and Cariboni, J. and Gatelli, D. and Saisana, M. and Tarantola, S.},
year={2008},
publisher={John Wiley \& Sons}
}

@article{Xiu:2002,
title={The Wiener--Askey polynomial chaos for stochastic differential equations},
author={Xiu, D. and Karniadakis, G.E.},
journal={SIAM journal on scientific computing},
volume={24},
number={2},
pages={619--644},
year={2002},
publisher={SIAM}
}

@book{Ghanem:2003,
title={Stochastic finite elements: a spectral approach},
author={Ghanem, R.G. and Spanos, P.D.},
year={2003},
publisher={Courier Corporation}
}

@article{Gutmann:2001,
title={A radial basis function method for global optimization},
author={Gutmann, H-M},
journal={Journal of Global Optimization},
volume={19},
number={3},
pages={201--227},
year={2001},
publisher={Springer}
}

@article{Saltelli:2010,
title={Variance based sensitivity analysis of model output. Design and estimator for the total sensitivity index},
author={Saltelli, A. and Annoni, P. and Azzini, I. and Campolongo, F. and Ratto, M. and Tarantola, S.},
journal={Computer Physics Communications},
volume={181},
number={2},
pages={259--270},
year={2010},
publisher={Elsevier}
}

@article{Jansen:1999,
title={Analysis of variance designs for model output},
author={Jansen, M.J.W.},
journal={Computer Physics Communications},
volume={117},
number={1},
pages={35--43},
year={1999},
publisher={Elsevier}
}

@article{Homma:1996,
title={Importance measures in global sensitivity analysis of nonlinear models},
author={Homma, T. and Saltelli, A.},
journal={Reliability Engineering \& System Safety},
volume={52},
number={1},
pages={1--17},
year={1996},
publisher={Elsevier}
}

@article{Sobol:2007,
title={Global sensitivity indices for the investigation of nonlinear mathematical models},
author={Sobol', I.M.},
journal={Matematicheskoe Modelirovanie},
volume={19},
number={11},
pages={23--24},
year={2007},
publisher={Russian Academy of Sciences, Branch of Mathematical Sciences}
}

@article{Vohra:2014,
title={Development of a reduced model of formation reactions in Zr-Al nanolaminates},
author={Vohra, M. and Winokur, J. and Overdeep, K.R. and Marcello, P. and Weihs, T.P. and Knio, O.M.},
journal={Journal of Applied Physics},
volume={116},
number={23},
pages={233501},
year={2014},
publisher={AIP Publishing}
}

@article{Vohra:2016,
title={Design Analysis for Optimal Calibration of Diffusivity in Reactive Multilayers},
author={Vohra, M. and Huan, X. and Weihs, T.P. and Knio, O.M.},
journal={arXiv preprint arXiv:1610.02558},
year={2016}
}
18 changes: 17 additions & 1 deletion manual/users/users.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
\usepackage{rotating}
\usepackage{color}
\usepackage{url}
\usepackage{bm}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amsmath,amssymb}
\usepackage{fancyvrb}
\usepackage{subfig}
\usepackage{wrapfig}
Expand All @@ -20,8 +26,10 @@
\usepackage{geometry}
\geometry{top=1.00in, bottom=1.00in, left=1.00in, right=1.00in}
\usepackage{enumerate}
\usepackage[algoruled,vlined,linesnumbered,english]{algorithm2e}
\usepackage[algoruled,vlined,linesnumbered,english,algo2e]{algorithm2e}
\SetAlFnt{\footnotesize}
\DeclareMathOperator{\E}{\mathbb{E}}
\DeclareMathOperator{\V}{\mathbb{V}}

\usepackage{titlesec}
\titleformat{\section}{\LARGE\sffamily}{\thesection}{1em}{}
Expand Down Expand Up @@ -76,6 +84,8 @@
\newcommand{\post}{\text{posterior}}
\newcommand{\prior}{\text{prior}}
\newcommand{\D}{ {\bf D}}
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\myverb}[1]{ \indent{ \begin{verbatim} #1 \end{verbatim} } }
\newcommand{\QUESOversion}{0.51.0}
Expand Down Expand Up @@ -131,6 +141,10 @@
%\newcommand{\new}[1]{\reversemarginpar{\color{red}\tiny\raggedright\textsf{\hspace{-30pt}\vspace{-25pt} NEW}} \begin{leftbar} #1 \end{leftbar}}
\newcommand{\new}[1]{#1}
\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\makeatother
\begin{document}
\setlength{\unitlength}{1.0in}
Expand All @@ -155,6 +169,8 @@
\include{users_4_remarks}
\include{users_gsa}
\include{users_5_examples}
Expand Down
1 change: 1 addition & 0 deletions manual/users/users_3_classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ \subsection{Multilevel Solver (and Options)}\label{sec:ML}

%\clearpage
\subsection{Statistical Forward Problem (and Options)}
\label{sub:SFP}

A SFP in QUESO also has two input entities, the input (parameter) RV and a QoI function, and one output entity, the QoI RV.
The SIP is represented through the templated class \verb+StatisticalForwardProblem<P_V,P_M,Q_V,Q_M >+, which diagram is presented in Figure \ref{fig-sfp-class}. Again, the types \verb+P_V+ and \verb+Q_V+ of vectors and types \verb+P_M+ and \verb+Q_M+ of matrices, where \verb+P_+ stands for 'parameter' and \verb+Q_+ stands for 'quantities of interest'.
Expand Down
6 changes: 3 additions & 3 deletions manual/users/users_5a_example_sip.tex
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ \subsection{Example Code}\label{sec:sip-code}

\lstinputlisting[caption=File \texttt{example\_likelihood.h}., label={fig-like-h}, linerange={25-1000}]{../../examples/simpleStatisticalInverseProblem/src/example_likelihood.h}

\newpage
%\newpage

\lstinputlisting[caption=File \texttt{example\_likelihood.C}., label={fig-like-c}, linerange={25-1000}]{../../examples/simpleStatisticalInverseProblem/src/example_likelihood.C}

\newpage
%\newpage

\lstinputlisting[caption=File \texttt{example\_compute.h.}, label={code:sip-compute-h}, linerange={25-1000}]{../../examples/simpleStatisticalInverseProblem/src/example_compute.h}

Expand Down Expand Up @@ -350,7 +350,7 @@ \subsubsection{Covariance and Correlation Matrices}

Listing \ref{matlab:cov_matrix} presents the Matlab steps for calculating the covariance and correlation matrices for the parameters $\theta_1$ and $\theta_2$.

\newpage
%\newpage

\begin{lstlisting}[label=matlab:ip_cov_matrix,caption={Matlab code for finding covariance and correlation matrices.}]
% inside Matlab
Expand Down
Loading

0 comments on commit dd4ba59

Please sign in to comment.