Skip to content

Commit

Permalink
Merge pull request #2119 from idaholab/aalfonsi/subgrid_basicStatistics
Browse files Browse the repository at this point in the history
Subdomain basic statistics .
  • Loading branch information
mandd authored May 25, 2023
2 parents a0283bc + 6297969 commit 2295f8f
Show file tree
Hide file tree
Showing 19 changed files with 1,061 additions and 71 deletions.
14 changes: 11 additions & 3 deletions doc/user_manual/PostProcessors/BasicStatistics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ \subsubsection{BasicStatistics}
\textit{\textbf{Interfaced}} post-processor of type \textbf{HistorySetSync}).
\end{itemize}
%
\ppType{BasicStatistics post-processor}{BasicStatistics}

\newcommand{\basicStatisticsBody}
{
\begin{itemize}
\item \xmlNode{"metric"}, \xmlDesc{comma separated string or node list, required field},
specifications for the metric to be calculated. The name of each node is the requested metric. There are
Expand Down Expand Up @@ -123,7 +125,7 @@ \subsubsection{BasicStatistics}
computed and stored in the given \textbf{DataSet}, and the users do not need to specify these quantities in their RAVEN input files.
%
\item \xmlNode{pivotParameter}, \xmlDesc{string, optional field}, name of the parameter that needs
to be used for the computation of the Dynamic BasicStatistics (e.g. time). This node needs to
to be used for the computation of the Dynamic statistics (e.g. time). This node needs to
be inputted just in case an \textbf{HistorySet} is used as Input. It represents the reference
monotonic variable based on which the statistics is going to be computed (e.g. time-dependent
statistical moments).
Expand All @@ -146,7 +148,7 @@ \subsubsection{BasicStatistics}
\item vector metrics, such as \xmlNode{covariance} and \xmlNode{sensitivity}, are requested, the index variables
\xmlString{targets} and \xmlString{features} will be required.
\item If \xmlNode{percentile} is requested, an additional index variable \xmlString{percent} should be added.
\item when dynamic BasicStatistics (e.g. time) is requested, the index variable \xmlString{time} will be required.
\item when dynamic statistics (e.g. time) is requested, the index variable \xmlString{time} will be required.
\end{itemize}
\default{False}
%
Expand All @@ -164,6 +166,12 @@ \subsubsection{BasicStatistics}
\textbf{Example (Static Statistics):} This example demonstrates how to request the expected value of
\xmlString{x01} and \xmlString{x02}, along with the sensitivity of both \xmlString{x01} and \xmlString{x02} to
\xmlString{a} and \xmlString{b}.
}

% in the following we have the description of the statistics
\ppType{BasicStatistics post-processor}{BasicStatistics}
\basicStatisticsBody

\begin{lstlisting}[style=XML,morekeywords={name,subType,debug}]
<Simulation>
...
Expand Down
112 changes: 112 additions & 0 deletions doc/user_manual/PostProcessors/SubdomainBasicStatistics.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
\subsubsection{SubdomainBasicStatistics}
\label{SubdomainBasicStatistics}
The \textbf{SubdomainBasicStatistics} post-processor is aimed to allow the \textbf{BasicStatistics}
post-processor to be used on subdomains of the sampling space. This post-processor fully leverages
the \textbf{BasicStatistics} post-processor and, consequentially, computes many of the most important statistical quantities on
a mesh/grid (subdomains).
Similarly to the \textbf{BasicStatistics}, the post-processor can accept as input both \textit{\textbf{PointSet}}
and \textit{\textbf{HistorySet}}.

\ppType{SubdomainBasicStatistics post-processor}{SubdomainBasicStatistics}

\begin{itemize}
\item \xmlNode{"subdomain"}, \xmlDesc{XML node, required parameter}, definition of the subdomain grid. This node
can specify the following XML node:
\begin{itemize}
\item \xmlNode{variable}, \xmlDesc{XML node, required parameter} can specify the \xmlAttr{name} attribute, which is \xmlDesc{required string attribute} and specifies the user-defined name of this variable.
\variableChildrenIntro
\begin{itemize}
\item \gridDescriptionNoCDF
\end{itemize}
\end{itemize}
\end{itemize}

Based on the definition above, the post-processor will compute \textbf{BasicStatistics} on each ``cell'' defined
by the discretization grid. The results will be exported as function of the variables used
in the definition of the grid (see below for a detailed example).

In addition to the subdomain grid defined above, the same nodes/settings available for \textbf{BasicStatistics}
are available:

\basicStatisticsBody

\textbf{Example (Static Subdomain Statistics):}
\begin{lstlisting}[style=XML,morekeywords={name,subType,debug}]
<Simulation>
...
<Models>
...
<PostProcessor name='aUserDefinedName' subType='SubdomainBasicStatistics' verbosity='debug'>
<subdomain>
<variable name="a">
<grid construction="equal" steps="2" type="value">10 100</grid>
</variable>
<variable name="b">
<grid construction="equal" steps="1" type="value">10 50</grid>
</variable>
</subdomain>
<expectedValue prefix='mean'>x01,x02</expectedValue>
<sensitivity prefix='sen'>
<targets>x01,x02</targets>
<features>a,b</features>
</sensitivity>
</PostProcessor>
...
</Models>
...
<PointSet name='statsOut'>
<Input>
a,b
</Input>
<Output>
mean_x01,mean_x02,
sen_x01_a, sen_x01_b,
sen_x02_a, sen_x02_b
</Output>
</PointSet>
</Simulation>
\end{lstlisting}

In this case, the RAVEN variables ``mean\_x01, mean\_x02, sen\_x01\_a, sen\_x02\_a, sen\_x01\_b, sen\_x02\_b''
will be computed for each cell defined above (2 cells in this case).
The results will be associated to the mid-point of each cell. For the example above:
\begin{itemize}
\item $(a=32.5,b=30.0)$
\item $(a=77.5,b=30.0)$
\end{itemize}
The results will be then accessible for the RAVEN entities \textbf{DataObjects} and \textbf{OutStreams}.

\textbf{Example (Dynamic Subdomain Statistics):}

\begin{lstlisting}[style=XML,morekeywords={name,subType,debug}]
<Simulation>
...
<Models>
...
<PostProcessor name='aUserDefinedNameForDynamicPP' subType='BasicStatistics' verbosity='debug'>
<expectedValue prefix='mean'>x01,x02</expectedValue>
<sensitivity prefix='sen'>
<targets>x01,x02</targets>
<features>a,b</features>
</sensitivity>
<pivotParameter>time</pivotParameter>
</PostProcessor>
...
</Models>
...
<HistorySet name='basicStatHistorySet'>
<Input>
a,b
</Input>
<Output>
mean_x01,mean_x02,
sen_x01_a, sen_x01_b,
sen_x02_a, sen_x02_b
</Output>
<options>
<pivotParameter>time</pivotParameter>
</options>
</HistorySet>
</Simulation>
\end{lstlisting}

49 changes: 49 additions & 0 deletions doc/user_manual/postprocessor.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
\subsection{PostProcessor}
\label{sec:models_postProcessor}

\newcommand{\constructionNoCDF}
{
Based on the \xmlAttr{construction} type, the content of the \xmlNode{grid}
XML node and the requirements for other attributes change:
\begin{itemize}
\item \xmlAttr{construction}\textbf{\texttt{=}}\xmlString{equal}.
The grid is going to be constructed equally-spaced
(\xmlAttr{type}\textbf{\texttt{=}}\xmlString{value}).
This construction type requires the definition of additional attributes:
\begin{itemize}
\item \xmlAttr{steps}, \xmlDesc{required integer attribute}, number
of equally spaced/probable discretization steps.
\end{itemize}
This construction type requires that the content of the \xmlNode{grid}
node represents the lower and upper bounds (either
in probability or value). Two values need to be specified; the lowest one
will be considered as the $lowerBound$, the largest, the $upperBound$.
The $stepSize$ is determined as follows:
\\ $stepSize=(upperBound - lowerBound)/steps$
\item \xmlAttr{construction}\textbf{\texttt{=}}\xmlString{custom}.
The grid will be directly specified by the user.
No additional attributes are needed.
This construction type requires that the \xmlNode{grid} node contains
the actual mesh bins.
For example, if the grid \xmlAttr{type} is \xmlString{value}, in the body
of \xmlNode{grid}, the user will specify the values representing the nodes of the grid.
\end{itemize}
}

\newcommand{\gridDescriptionNoCDF}
{
\xmlNode{grid}, \xmlDesc{space separated floats, required
field}, the content of this XML node allows for a type of the grid only:
\begin{itemize}
\itemsep0em
\item \xmlAttr{type}, \xmlDesc{required string attribute}, user-defined
discretization metric type: 1) \xmlString{value}, the grid will be provided
using variable values.
\item \xmlAttr{construction}, \xmlDesc{required string attribute}, how
the grid needs to be constructed, independent of its type.
\end{itemize}
\constructionNoCDF
}

A Post-Processor (PP) can be considered as an action performed on a set of data
or other type of objects.
%
Expand All @@ -12,6 +57,7 @@ \subsection{PostProcessor}
\begin{itemize}
\itemsep0em
\item \textbf{BasicStatistics}
\item \textbf{SubdomainBasicStatistics}
\item \textbf{ComparisonStatistics}
\item \textbf{ImportanceRank}
\item \textbf{SafestPoint}
Expand Down Expand Up @@ -69,6 +115,9 @@ \subsection{PostProcessor}
%%%%% PP BasicStatistics %%%%%%%
\input{PostProcessors/BasicStatistics.tex}

%%%%% PP SubdomainBasicStatistics %%%%%%%
\input{PostProcessors/SubdomainBasicStatistics.tex}

%%%%% PP ComparisonStatistics %%%%%%%
\input{PostProcessors/ComparisonStatistics.tex}

Expand Down
13 changes: 13 additions & 0 deletions doc/user_manual/raven_user_manual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@

\usepackage{listings}

% the following allows for 8 levels list nesting
\usepackage{enumitem}
\setlistdepth{8}
\setlist[itemize,1]{label=$\bullet$}
\setlist[itemize,2]{label=$\bullet$}
\setlist[itemize,3]{label=$\bullet$}
\setlist[itemize,4]{label=$\bullet$}
\setlist[itemize,5]{label=$\bullet$}
\setlist[itemize,6]{label=$\bullet$}
\setlist[itemize,7]{label=$\bullet$}
\setlist[itemize,8]{label=$\bullet$}
\renewlist{itemize}{itemize}{8}

% Python style for highlighting
\newcommand\pythonstyle{\lstset{
language=Python,
Expand Down
7 changes: 2 additions & 5 deletions doc/user_manual/sampler.tex
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ \section{Samplers}
code will raise an error.
\end{itemize}
}

\newcommand{\variableDescription}
{
\xmlNode{variable}, \xmlDesc{XML node, required parameter} can specify the following attribute:
Expand Down Expand Up @@ -175,6 +176,7 @@ \section{Samplers}
the attribute \xmlAttr{dim} is required. \nb{Alternatively, this node must be omitted
if the \xmlNode{function} node is supplied.}
}

\newcommand{\functionDescription}
{
\xmlNode{function}, \xmlDesc{string, required field}, name of the function that
Expand All @@ -185,9 +187,6 @@ \section{Samplers}
if the \xmlNode{distribution} node is supplied.}
}




\newcommand{\gridDescriptionOnlyCustom}
{
\xmlNode{grid}, \xmlDesc{space separated floats, required
Expand All @@ -210,8 +209,6 @@ \section{Samplers}
information is requested.}
}



\newcommand{\gridDescription}
{
\xmlNode{grid}, \xmlDesc{space separated floats, required
Expand Down
Loading

0 comments on commit 2295f8f

Please sign in to comment.