Skip to content
Snippets Groups Projects
4_parameterfiles.tex 2.61 KiB
Newer Older
Thomas Fetzer's avatar
Thomas Fetzer committed
\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}.
Thomas Fetzer's avatar
Thomas Fetzer committed

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, restart the application the following way:
\texttt{./test{\_}2p{\_}incompressible{\_}tpfa test{\_}2p.input -PrintParameters true},
Thomas Fetzer's avatar
Thomas Fetzer committed
this will print the parameters once your simulation is finished}:
Thomas Fetzer's avatar
Thomas Fetzer committed
\begin{lstlisting}[style=Bash]
# Runtime-specified parameters used:
Thomas Fetzer's avatar
Thomas Fetzer committed
[ Grid ]
Cells = "48 32"
UpperRight = "6 4"
Thomas Fetzer's avatar
Thomas Fetzer committed
[ Problem ]
EnableGravity = "true"
Name = "2p"
Thomas Fetzer's avatar
Thomas Fetzer committed
[ SpatialParams ]
LensLowerLeft = "1.0 2.0"
LensUpperRight = "4.0 3.0"
[ TimeLoop ]
Thomas Fetzer's avatar
Thomas Fetzer committed
DtInitial = "250"
TEnd = "3000"

# Default parameters used:
Thomas Fetzer's avatar
Thomas Fetzer committed
[ Implicit ]
NumericDifferenceMethod = "1"
UpwindWeight = "1.0"
Thomas Fetzer's avatar
Thomas Fetzer committed
[ LinearSolver ]
MaxIterations = "250"
PreconditionerIterations = "1"
PreconditionerRelaxation = "1.0"
ResidualReduction = "1e-13"
Thomas Fetzer's avatar
Thomas Fetzer committed
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"
Thomas Fetzer's avatar
Thomas Fetzer committed
[ Vtk ]
AddProcessRank = "true"
AddVelocity = "false"

# Unused parameters:
Grid.LowerLeft = "0 0"
Thomas Fetzer's avatar
Thomas Fetzer committed
\end{lstlisting}

Thomas Fetzer's avatar
Thomas Fetzer committed
A number of things can be learned:
Thomas Fetzer's avatar
Thomas Fetzer committed
\begin{itemize}
Thomas Fetzer's avatar
Thomas Fetzer committed
  \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)
Thomas Fetzer's avatar
Thomas Fetzer committed
\end{itemize}


\subsection{Parameter Values}
If you want to get the value of a parameter please use:
\begin{lstlisting}[name=propsyscars,style=DumuxCode]
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]
paramname_ = getParam<TYPE>("GROUPNAME.PARAMNAME", default);
\end{lstlisting}

For further information you can also look at the \Dumux tutorial, especially exercise 1. 

Thomas Fetzer's avatar
Thomas Fetzer committed
All applications have a help message which you can read by giving
Thomas Fetzer's avatar
Thomas Fetzer committed
\texttt{--help} as a command line argument to the application.
For further details, please have a look at \texttt{Dune::ParameterTree}
Thomas Fetzer's avatar
Thomas Fetzer committed
in the \Dune documentation.