Skip to content
Snippets Groups Projects
Commit 18f21b81 authored by Roman Winter's avatar Roman Winter Committed by Timo Koch
Browse files

[doc] Add parameters.md as doxygen page and remove from handbook

parent 6eef252c
No related branches found
No related tags found
1 merge request!3568[doc] Add handbook Chapter 2.3 parameters to doxygen
...@@ -13,6 +13,7 @@ SPDX-License-Identifier: GPL-3.0-or-later ...@@ -13,6 +13,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<!-- We manually create the navigation hierarchy of the pages --> <!-- We manually create the navigation hierarchy of the pages -->
<tab type="user" url="@ref installation" visible="yes" title="Installation" intro=""/> <tab type="user" url="@ref installation" visible="yes" title="Installation" intro=""/>
<tab type="user" url="@ref getting-started" visible="yes" title="Getting started" intro=""/> <tab type="user" url="@ref getting-started" visible="yes" title="Getting started" intro=""/>
<tab type="user" url="@ref runtime-parameters" visible="yes" title="Runtime Parameters" intro=""/>
<!-- This is how to create a hierarchy (can be removed once we have an example) --> <!-- This is how to create a hierarchy (can be removed once we have an example) -->
<!-- <tab type="usergroup" title="My Group"> <!-- <tab type="usergroup" title="My Group">
<tab type="user" url="@ref mysubpage" title="My Page"/> <tab type="user" url="@ref mysubpage" title="My Page"/>
......
% SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder # Runtime Parameters
% SPDX-License-Identifier: CC-BY-4.0
\section{Parameters in \Dumux}
\label{sc_parameterfiles}
Simulation parameters can be parsed to the program via a parameter file or via the command line. Simulation parameters can be parsed to the program via a parameter file or via the command line.
After having run the example application from the getting started guide you will After having run the example application from the getting started guide you will get the following output at the end of the simulation run. If you did not get the output, call Dumux::Parameters::print() in your main file.
get the following output at the end of the simulation run
\footnote{If you did not get the output, add \texttt{Parameters::print();} to your main file.}: ```bash
\begin{lstlisting}[style=Bash]
# Runtime-specified parameters used: # Runtime-specified parameters used:
[ Grid ] [ Grid ]
Cells = "48 32" Cells = "48 32"
...@@ -58,44 +54,43 @@ AddVelocity = "false" ...@@ -58,44 +54,43 @@ AddVelocity = "false"
# Unused parameters: # Unused parameters:
Grid.LowerLeft = "0 0" Grid.LowerLeft = "0 0"
\end{lstlisting} ```
A number of things can be learned: A number of things can be learned:
\begin{itemize}
\item \emph{run-time} parameters can be changed without re-compiling
\item \emph{default parameters} are set by default
\item \emph{unused} parameters are not used by the simulation (maybe typo or wrong group in input file)
\end{itemize}
* run-time parameters can be changed without re-compiling
* default parameters are set by default
* unused parameters are not used by the simulation (maybe typo or wrong group in input file)
\subsection{Parameter Values} ## Parameter Values
To get the value of an input parameter please use: To get the value of an input parameter please use:
\begin{lstlisting}[name=propsyscars,style=DumuxCode]
```c++
static const TYPE paramname = getParam<TYPE>("GROUPNAME.PARAMNAME"); static const TYPE paramname = getParam<TYPE>("GROUPNAME.PARAMNAME");
\end{lstlisting} ```
If you also want to set a default value for a parameter, just add it like this: If you also want to set a default value for a parameter, just add it like this:
\begin{lstlisting}[name=propsyscars,style=DumuxCode] ```c++
static const TYPE paramname = getParam<TYPE>("GROUPNAME.PARAMNAME", default); static const TYPE paramname = getParam<TYPE>("GROUPNAME.PARAMNAME", default);
\end{lstlisting} ```
As this function call is relatively expensive, the respective variables should always be \texttt{static} (e.g., if used in a loop). When dealing with multiple group names, e.g., in the context of coupled models, the following methods might be more convenient: As this function call is relatively expensive, the respective variables should always be `static` (e.g., if used in a loop). When dealing with multiple group names, e.g., in the context of coupled models, the following methods might be more convenient:
\begin{lstlisting}[name=propsyscars,style=DumuxCode] ```c++
auto modelParamGroup0 = "Model0"; auto modelParamGroup0 = "Model0";
static const TYPE paramname0 = getParamFromGroup<TYPE>(modelParamGroup0, "GROUPNAME.PARAMNAME"); static const TYPE paramname0 = getParamFromGroup<TYPE>(modelParamGroup0, "GROUPNAME.PARAMNAME");
auto modelParamGroup1 = "Model1"; auto modelParamGroup1 = "Model1";
static const TYPE paramname1 = getParamFromGroup<TYPE>(modelParamGroup1, "GROUPNAME.PARAMNAME"); static const TYPE paramname1 = getParamFromGroup<TYPE>(modelParamGroup1, "GROUPNAME.PARAMNAME");
\end{lstlisting} ```
The \texttt{FVProblem} class provides a convenience function \texttt{paramGroup()}. The Dumux::FVProblem class provides a convenience function Dumux::FVProblem::paramGroup.
The parameters can then be specified in the input file: The parameters can then be specified in the input file:
\begin{lstlisting}[style=Bash] ```ini
[ Model0.Grid ] [ Model0.Grid ]
File = file0.dgf File = file0.dgf
[ Model1.Grid ] [ Model1.Grid ]
File = file1.dgf File = file1.dgf
\end{lstlisting} ```
...@@ -125,7 +125,6 @@ Further, it presents useful external tools (\ref{sc_externaltools}) and basic ...@@ -125,7 +125,6 @@ Further, it presents useful external tools (\ref{sc_externaltools}) and basic
concepts (\ref{sc_linearsystem}). concepts (\ref{sc_linearsystem}).
\input{5_structure} \input{5_structure}
\input{5_newfoldersetup} \input{5_newfoldersetup}
\input{5_parameterfiles}
\input{5_restartsimulations} \input{5_restartsimulations}
\input{5_developingdumux} \input{5_developingdumux}
\input{5_externaltools} \input{5_externaltools}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment