[Commits] [svn:einsteintoolkit] Workshop_Summer_2013/et_intro_details/ (Rev. 21)

rhaas at tapir.caltech.edu rhaas at tapir.caltech.edu
Fri Jul 26 10:53:04 CDT 2013


User: rhaas
Date: 2013/07/26 10:53 AM

Modified:
 /et_intro_details/
  et_intro_details.tex

Log:
 work on et intro details

File Changes:

Directory: /et_intro_details/
=============================

File [modified]: et_intro_details.tex
Delta lines: +194 -3
===================================================================
--- et_intro_details/et_intro_details.tex	2013-07-26 15:52:55 UTC (rev 20)
+++ et_intro_details/et_intro_details.tex	2013-07-26 15:53:04 UTC (rev 21)
@@ -222,7 +222,197 @@
     More on \texttt{Simfactory} in the hands-on session.
 \end{frame}
 
-\begin{frame} \frametitle{Example: solving scalar wave equation}
+\begin{frame} \frametitle{Cactus thorn writing: Cactus concepts}
+\begin{description}
+\item[thorn] Cactus module providing physics or infrastructure capabilities
+\item[grid function] discrete representation of function eg. density
+$\rho(x,y,z)$ on the numerical grid, eg. $\mathtt{rho}_{i,j,k}$
+\item[grid scalar] single number (or set of numbers) managed by Cactus, eg.
+total mass
+\item[schedule] order in which Cactus calls user supplied routines, defined
+through orderign relations ``SCHEDULE \texttt{compute\_rho} BEFORE
+\texttt{compute\_mass}''
+\item[parameter] user specifyable option controlling simulation. Used for
+example to provide central density in TOV stars, give final time of
+simulation, specify type of equation of state
+\item[parameter file] set of parameter values used in a single simulation run,
+key---value pairs
+\end{description}
+\end{frame}
+
+\begin{frame}[containsverbatim] \frametitle{Cactus thorn writing: anatomy of a
+thorn}
+ Directory structure:
+ \begin{alltt}
+GRhydro/
+|-- COPYRIGHT
+|-- README
+|-- configuration.ccl
+|-- doc
+|   `-- documentation.tex
+|-- interface.ccl
+|-- schedule.ccl
+|-- param.ccl
+`-- src
+    |-- GRHydro\_Startup.F90, \ldots
+    `-- make.code.defn
+\end{alltt}
+\end{frame}
+
+\frame[containsverbatim]{\frametitle{configuration.ccl}
+\begin{block}{configuration.ccl}
+\small\begin{alltt}
+# Configuration definition for thorn GRHydro
+
+REQUIRES EOS_Omni Boundary CartGrid3D SpaceMask ADMMacros
+
+OPTIONAL_IFACTIVE Carpet
+\{
+\}
+\end{alltt}
+\end{block}
+%\includegraphics[width=6in]{config}
+
+List the thorns without which yours will not compile.  Popular choices include
+external libraries ({\tt GSL/LAPACK/LORENE/HDF5}, etc.), {\tt EOS\_Omni} for
+matter.
+}
+
+\frame[containsverbatim]{\frametitle{interface.ccl}
+\begin{block}{interface.ccl}
+\small\begin{alltt}
+implements: GRHydro
+inherits: ADMBase, SpaceMask, Tmunubase, HydroBase
+
+USES INCLUDE HEADER: carpet.hh
+
+void FUNCTION SpatialDet(CCTK_REAL IN gxx, CCTK_REAL IN gxy, \textbackslash
+                         CCTK_REAL IN gxz, CCTK_REAL IN gyy, \textbackslash
+                         CCTK_REAL IN gyz, CCTK_REAL IN gzz, \textbackslash
+                         CCTK_REAL OUT det)
+PROVIDES FUNCTION SpatialDet WITH SpatialDeterminant LANG Fortran
+
+public:
+real dens type = GF Timelevels = 3 \textbackslash
+  tensortypealias="Scalar" interpolator="matter"' \textbackslash
+  "generalized particle number"
+\end{alltt}
+\end{block}
+}
+
+\frame[containsverbatim]{\frametitle{param.ccl}
+\begin{block}{param.ccl}
+\begin{alltt}
+REAL rho\_abs\_min "A minimum rho below which evolution is \textbackslash
+  turned off (atmosphere)." STEERABLE=recover
+\{
+  -1.0   :: "use relative minimum"
+   0.0:* :: "reset rho when it falls below"
+\} -1.0
+
+SHARES: HydroBase
+USES CCTK\_INT timelevels
+EXTENDS KEYWORD evolution\_method
+\{
+  "GRHydro" :: "Use GRHydro to evolve the hydro variables"
+\}
+\end{alltt}
+\end{block}
+Parameters are typically set at startup, not during execution.
+
+%\includegraphics[width=5.5in]{param1}
+}
+
+\frame[containsverbatim]{\frametitle{schedule.ccl}
+\begin{block}{schedule.ccl---storage}
+\begin{alltt}
+STORAGE: dens[timelevels]
+
+if(CCTK\_Equals(Bvec\_evolution\_method,"GRHydro"))
+\{
+  STORAGE: HydroBase::Bvec[timelevels]	
+  STORAGE: GRHydro::Bcons[timelevels]	
+  STORAGE: Bconsrhs
+\}
+\end{alltt}
+\end{block}
+{\tt schedule.ccl} handles global storage control.
+}
+
+\frame[containsverbatim]{\frametitle{schedule.ccl}
+\begin{block}{schedule.ccl---scheduling}
+\begin{alltt}
+schedule Conservative2Primitive IN HydroBase\_Con2Prim
+\{
+  LANG: Fortran
+\} "Convert back to primitive variables (general)"
+
+schedule GRHydro\_Boundaries IN HydroBase\_Select\_Boundaries \textbackslash
+  AS GRHydro\_Bound
+\{
+   LANG: Fortran
+   OPTIONS: LEVEL
+   SYNC: dens
+   SYNC: HydroBase::Bvec
+\} "Select GRHydro boundary conditions"
+\end{alltt}
+\end{block}
+{\tt schedule.ccl} handles subroutine scheduling.
+}
+
+\frame[containsverbatim]{\frametitle{schedule.ccl cont'd}
+\begin{block}{schedule.ccl---scheduling}
+\begin{alltt}
+schedule group GRHydroRHS IN HydroBase\_RHS
+\{
+  STORAGE: GRHydro\_scalars
+\} "Calculate the update terms"
+
+schedule SourceTerms IN GRHydroRHS BEFORE FluxTerms
+\{
+  LANG: Fortran
+\} "Source term calculation"
+
+schedule UpdateAtmosphereMask IN GRHydroRHS AFTER FluxTerms
+\{
+  LANG: Fortran
+\} "Alter the update terms if inside the atmosphere region"
+
+\end{alltt}
+\end{block}
+group routines so that group can be reused
+}
+
+\frame[containsverbatim]{\frametitle{make.code.defn}
+\begin{block}{files to compile}
+\begin{alltt}
+# Source files in this directory
+
+SRCS = 	GRHydro_Source.F90 \textbackslash
+	GRHydro_UpdateMask.F90 \textbackslash
+        GRHydro_Prim2Con.c \textbackslash
+	GRHydro_Boundaries.F90
+
+SUBDIRS =
+\end{alltt}
+\end{block}
+{\tt make.code.defn} 
+}
+
+\frame{\frametitle{Final tips}
+\begin{itemize}
+\item \emph{Plagiarize and copy liberally, especially at first!!!}
+
+\item Consider compilation time when you write your thorn.  You want a
+thornlist that is as small as possible, but not smaller.
+
+\item Get version control running first!
+
+\item Learn how to output.  It is a huge timesaver for debugging/running.
+\end{itemize}
+}
+
+\begin{frame} \frametitle{Worked out example: solving scalar wave equation}
  For a given source function $S(x,y,t)$ find a scalar wave
  field $\varphi(x,y,t)$ inside the domain $\mathcal{D}$
  with a boundary condition:
@@ -502,6 +692,7 @@
               (0,0)   grid (3.0cm,2.6cm);
          \draw[xstep=.6cm,ystep=.4cm,gray,dashed,xshift=0.05cm,yshift=0.05cm] 
               (2.4,0) grid (5.4cm,2.6cm);
+         \draw[above=2pt] (5.9,0.7) node {\small $t=0$};
        }%
        \uncover<5>{
          \scope[color=red,thick,fill=white]
@@ -520,8 +711,8 @@
           \draw[xshift=2.45cm,yshift=0.05cm] (0cm,-1pt) grid (3.0cm,1pt);         
           \draw[xshift=0cm,yshift=0.4cm]     (0cm,-1pt) grid (3.0cm,1pt);
           \draw[xshift=2.45cm,yshift=0.45cm] (0cm,-1pt) grid (3.0cm,1pt);         
-          \draw[xshift=0cm,yshift=0.8cm,color=black]     (0cm,-1pt) grid (3.0cm,1pt);
-          \draw[xshift=2.45cm,yshift=0.85cm,color=black] (0cm,-1pt) grid (3.0cm,1pt);         
+          \draw[xshift=0cm,yshift=0.8cm]     (0cm,-1pt) grid (3.0cm,1pt);
+          \draw[xshift=2.45cm,yshift=0.85cm] (0cm,-1pt) grid (3.0cm,1pt);         
          \endscope
          \scope[color=blue]
            \draw (-0.5,0.4) node[anchor=east] {\small phi\_p};



More information about the Commits mailing list