Newer
Older
\section{Parameters in \Dumux}
\label{sc_parameterfiles}
Simulation parameters can be parsed to the program via a parameter file or the command line.
A list of all available parameters is provided in the Doxygen documentation: \texttt{Parameter List}.
After having run the example application from section \ref{quick-start-guide} you will
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.}:
LensLowerLeft = "1.0 2.0"
LensUpperRight = "4.0 3.0"
[ TimeLoop ]
PreconditionerIterations = "1"
PreconditionerRelaxation = "1.0"
ResidualReduction = "1e-13"
EnableAbsoluteResidualCriterion = "false"
EnableResidualCriterion = "false"
EnableShiftCriterion = "true"
MaxAbsoluteResidual = "1e-5"
MaxRelativeShift = "1e-8"
MaxSteps = "18"
ResidualReduction = "1e-5"
SatisfyResidualAndShiftCriterion = "false"
TargetSteps = "10"
UseLineSearch = "false"
[ TimeLoop ]
MaxTimeStepDivisions = "10"
MaxTimeStepSize = "1e300"
AddProcessRank = "true"
AddVelocity = "false"
# Unused parameters:
Grid.LowerLeft = "0 0"
\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)
\subsection{Parameter Values}
To get the value of an input parameter please use:
\begin{lstlisting}[name=propsyscars,style=DumuxCode]
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:
\begin{lstlisting}[name=propsyscars,style=DumuxCode]
static const TYPE paramname = getParam<TYPE>("GROUPNAME.PARAMNAME", default);
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 fowolling methods might be more convenient:
\begin{lstlisting}[name=propsyscars,style=DumuxCode]
auto modelParamGroup0 = "Model0";
static const TYPE paramname0 = getParamFromGroup<TYPE>(modelParamGroup0, "GROUPNAME.PARAMNAME");
auto modelParamGroup1 = "Model1";
static const TYPE paramname1 = getParamFromGroup<TYPE>(modelParamGroup1, "GROUPNAME.PARAMNAME");
\end{lstlisting}
The \texttt{FVProblem} class provides a convenience function \texttt{paramGroup()}.\\
The parameters can then be specified in the input file:
\begin{lstlisting}[style=Bash]
[ Model0.Grid ]
File = file0.dgf
[ Model1.Grid ]
File = file1.dgf
\end{lstlisting}
For further details, please have a look at the \Dumux tutorial, especially exercise 1.