<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\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.}:
\begin{lstlisting}[style=Bash]
# Runtime-specified parameters used:
[ Grid ]
Cells = "48 32"
UpperRight = "6 4"
[ Problem ]
EnableGravity = "true"
Name = "2p"
[ SpatialParams ]
LensLowerLeft = "1.0 2.0"
LensUpperRight = "4.0 3.0"
[ TimeLoop ]
DtInitial = "250"
TEnd = "3000"

# Default parameters used:
[ Assembly ]
NumericDifferenceMethod = "1"
[ Flux ]
UpwindWeight = "1.0"
[ LinearSolver ]
MaxIterations = "250"
PreconditionerIterations = "1"
PreconditionerRelaxation = "1.0"
ResidualReduction = "1e-13"
Verbosity = "0"
[ Newton ]
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"
[ Vtk ]
AddProcessRank = "true"
AddVelocity = "false"

# Unused parameters:
Grid.LowerLeft = "0 0"
\end{lstlisting}

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}


\subsection{Parameter Values}
To get the value of an input parameter please use:
\begin{lstlisting}[name=propsyscars,style=DumuxCode]
static const TYPE paramname = getParam&lt;TYPE&gt;("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&lt;TYPE&gt;("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 fowolling methods might be more convenient:

\begin{lstlisting}[name=propsyscars,style=DumuxCode]
auto modelParamGroup0 = "Model0";
static const TYPE paramname0 = getParamFromGroup&lt;TYPE&gt;(modelParamGroup0, "GROUPNAME.PARAMNAME");
auto modelParamGroup1 = "Model1";
static const TYPE paramname1 = getParamFromGroup&lt;TYPE&gt;(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.

</pre></body></html>