[cig-commits] [commit] master: Add links to a place where one can find the format of the muparser functions explained. (46bef60)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Tue Aug 5 06:35:27 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/9a8086507e7ed22ed2a4d13771930e4ae6bc3a7d...3fd3918150c21a91f28f33fdc39529f3a863c68b
>---------------------------------------------------------------
commit 46bef6097d91dc20a017b0832aca576a42f61bff
Author: Wolfgang Bangerth <bangerth at math.tamu.edu>
Date: Sat Aug 2 02:52:54 2014 -0500
Add links to a place where one can find the format of the muparser functions explained.
>---------------------------------------------------------------
46bef6097d91dc20a017b0832aca576a42f61bff
doc/manual/manual.tex | 30 ++++++++++++++++++++++
source/boundary_temperature/function.cc | 6 ++++-
.../compositional_initial_conditions/function.cc | 4 ++-
source/gravity_model/function.cc | 4 ++-
source/heating_model/function.cc | 4 ++-
source/initial_conditions/adiabatic.cc | 4 ++-
source/initial_conditions/function.cc | 5 +++-
.../mesh_refinement/maximum_refinement_function.cc | 6 ++++-
.../mesh_refinement/minimum_refinement_function.cc | 6 ++++-
source/velocity_boundary_conditions/function.cc | 4 ++-
10 files changed, 64 insertions(+), 9 deletions(-)
diff --git a/doc/manual/manual.tex b/doc/manual/manual.tex
index be42903..4438940 100644
--- a/doc/manual/manual.tex
+++ b/doc/manual/manual.tex
@@ -2619,6 +2619,35 @@ sections linked to above. Some of them will also be used in the cookbooks in
Section~\ref{sec:cookbooks}.
+\subsubsection{A note on the syntax of formulas in input files}
+\label{sec:muparser-format}
+
+Input files have different ways of describing certain things to \aspect{}. For
+example, you could select a plugin for the temperature initial values that
+prescribes a constant temperature, or a
+plugin that implements a particular formula for these initial conditions in
+C++ in the code of the plugin, or a
+plugin that allows you to describe this formula in a symbolic way in the input file
+(see Section~\ref{parameters:Initial_20conditions}). An example of this latter
+case is this snippet of code discussed in
+Section~\ref{sec:cookbooks-simple-box-3d}:
+%
+\lstinputlisting[language=prmfile]{cookbooks/convection-box-3d/initial.part.prm.out}
+%
+The formulas you can enter here need to use a syntax that is understood by the
+functions and classes that interpret what you write. Internally, this is done
+using the muparser library, see \url{http://muparser.beltoforion.de/}. The
+syntax is mostly self-explanatory in that it allows to use the usual symbols
+\texttt{x}, \texttt{y} and \texttt{z} to reference coordinates (unless a
+particular plugin uses different variables, such as the depth), the symbol
+\texttt{t} for time in many situations, and allows you to use all of the
+typical mathematical functions such as sine and cosine. Another common case is
+an if-statement that has the general form
+\texttt{if(condition,true-expression,false-expression)}. For more examples of
+the syntax understood, reference the documentation of the muparser library
+linked to above.
+
+
% now include a file that describes all currently available run-time parameters
\input{parameters}
@@ -3258,6 +3287,7 @@ limits the accuracy.
\subsubsection{Convection in a 3d box}
+\label{sec:cookbooks-simple-box-3d}
The world is not two-dimensional. While the previous section introduced a number
of the knobs one can play with with \aspect{}, things only really become
diff --git a/source/boundary_temperature/function.cc b/source/boundary_temperature/function.cc
index f5585de..ce99f35 100644
--- a/source/boundary_temperature/function.cc
+++ b/source/boundary_temperature/function.cc
@@ -158,6 +158,10 @@ namespace aspect
"postprocessing, this boundary temperature model "
"must therefore be told what the minimal and "
"maximal values on the boundary are. This is done "
- "using parameters set in section ``Boundary temperature model/Initial temperature''.")
+ "using parameters set in section ``Boundary temperature model/Initial temperature''."
+ "\n\n"
+ "The format of these "
+ "functions follows the syntax understood by the "
+ "muparser library, see Section~\\ref{sec:muparser-format}.")
}
}
diff --git a/source/compositional_initial_conditions/function.cc b/source/compositional_initial_conditions/function.cc
index a7acb6d..b766c12 100644
--- a/source/compositional_initial_conditions/function.cc
+++ b/source/compositional_initial_conditions/function.cc
@@ -99,6 +99,8 @@ namespace aspect
{
ASPECT_REGISTER_COMPOSITIONAL_INITIAL_CONDITIONS(Function,
"function",
- "Composition is given in terms of an explicit formula")
+ "Specify the composition in terms of an explicit formula. The format of these "
+ "functions follows the syntax understood by the "
+ "muparser library, see Section~\\ref{sec:muparser-format}.")
}
}
diff --git a/source/gravity_model/function.cc b/source/gravity_model/function.cc
index 86f68c6..256c0f1 100644
--- a/source/gravity_model/function.cc
+++ b/source/gravity_model/function.cc
@@ -94,6 +94,8 @@ namespace aspect
"function",
"Gravity is given in terms of an explicit formula "
"that is elaborated in the parameters in section "
- "``Gravity model|Function''.")
+ "``Gravity model|Function''. The format of these "
+ "functions follows the syntax understood by the "
+ "muparser library, see Section~\\ref{sec:muparser-format}.")
}
}
diff --git a/source/heating_model/function.cc b/source/heating_model/function.cc
index 88e3b67..c92d8b2 100644
--- a/source/heating_model/function.cc
+++ b/source/heating_model/function.cc
@@ -115,7 +115,9 @@ namespace aspect
"Implementation of a model in which the heating "
"rate is given in terms of an explicit formula "
"that is elaborated in the parameters in section "
- "``Heating model|Function''. "
+ "``Heating model|Function''. The format of these "
+ "functions follows the syntax understood by the "
+ "muparser library, see Section~\\ref{sec:muparser-format}."
"\n\n"
"The formula is interpreted as having units "
"W/kg."
diff --git a/source/initial_conditions/adiabatic.cc b/source/initial_conditions/adiabatic.cc
index 3d6acae..abb4b94 100644
--- a/source/initial_conditions/adiabatic.cc
+++ b/source/initial_conditions/adiabatic.cc
@@ -210,7 +210,9 @@ namespace aspect
"The function object in the Function subsection "
"represents the compositional fields that will be used as a reference "
"profile for calculating the thermal diffusivity. "
- "The function depends only on depth.");
+ "This function is one-dimensional and depends only on depth. The format of this "
+ "functions follows the syntax understood by the "
+ "muparser library, see Section~\\ref{sec:muparser-format}.");
prm.enter_subsection("Function");
{
Functions::ParsedFunction<1>::declare_parameters (prm, 1);
diff --git a/source/initial_conditions/function.cc b/source/initial_conditions/function.cc
index 840df78..4f86601 100644
--- a/source/initial_conditions/function.cc
+++ b/source/initial_conditions/function.cc
@@ -89,6 +89,9 @@ namespace aspect
{
ASPECT_REGISTER_INITIAL_CONDITIONS(Function,
"function",
- "Temperature is given in terms of an explicit formula")
+ "Specify the initial temperature in terms of an "
+ "explicit formula. The format of these "
+ "functions follows the syntax understood by the "
+ "muparser library, see Section~\\ref{sec:muparser-format}.")
}
}
diff --git a/source/mesh_refinement/maximum_refinement_function.cc b/source/mesh_refinement/maximum_refinement_function.cc
index 18a0aa4..13210cd 100644
--- a/source/mesh_refinement/maximum_refinement_function.cc
+++ b/source/mesh_refinement/maximum_refinement_function.cc
@@ -199,6 +199,10 @@ namespace aspect
"and not r,theta,phi, since this allows for "
"dimension independent expressions. "
"After evaluating the function, its values are "
- "rounded to the nearest integer.")
+ "rounded to the nearest integer."
+ "\n\n"
+ "The format of these "
+ "functions follows the syntax understood by the "
+ "muparser library, see Section~\\ref{sec:muparser-format}.")
}
}
diff --git a/source/mesh_refinement/minimum_refinement_function.cc b/source/mesh_refinement/minimum_refinement_function.cc
index 8c128de..d410a2b 100644
--- a/source/mesh_refinement/minimum_refinement_function.cc
+++ b/source/mesh_refinement/minimum_refinement_function.cc
@@ -199,6 +199,10 @@ namespace aspect
"and not r,theta,phi, since this allows for "
"dimension independent expressions. "
"After evaluating the function, its values are "
- "rounded to the nearest integer.")
+ "rounded to the nearest integer."
+ "\n\n"
+ "The format of these "
+ "functions follows the syntax understood by the "
+ "muparser library, see Section~\\ref{sec:muparser-format}.")
}
}
diff --git a/source/velocity_boundary_conditions/function.cc b/source/velocity_boundary_conditions/function.cc
index 6e6ab09..245025b 100644
--- a/source/velocity_boundary_conditions/function.cc
+++ b/source/velocity_boundary_conditions/function.cc
@@ -124,7 +124,9 @@ namespace aspect
"Implementation of a model in which the boundary "
"velocity is given in terms of an explicit formula "
"that is elaborated in the parameters in section "
- "``Boundary velocity model|Function''. "
+ "``Boundary velocity model|Function''. The format of these "
+ "functions follows the syntax understood by the "
+ "muparser library, see Section~\\ref{sec:muparser-format}."
"\n\n"
"The formula you describe in the mentioned "
"section is a semicolon separated list of velocities "
More information about the CIG-COMMITS
mailing list