Skip to content
Snippets Groups Projects
Forked from agnumpde / dune-tectonic
139 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
2d-dip-contours-performance.tikz 2.95 KiB
\pgfplotsarraynew\heights{%
  -40\\-20\\-10\\-5\\-2.5\\%
  0\\%
  2.5\\5\\10\\20\\40\\%
}
\def\fnamebase{2d-dip-contours}
\def\fname{rfpitol=100e-7}

\newread\threequakesminread
\openin\threequakesminread=generated/timeframe:min:threequakes:\fname.tex
\read\threequakesminread to \threequakesmin
\closein\threequakesminread

\newread\threequakesmaxread
\openin\threequakesmaxread=generated/timeframe:max:threequakes:\fname.tex
\read\threequakesmaxread to \threequakesmax
\closein\threequakesmaxread

\begin{tikzpicture}[trim axis group left, trim axis group right]
  \begin{groupplot}[
    xmin=\threequakesmin, xmax=\threequakesmax, max space between ticks=40pt,
    x tick label style={ /pgf/number format/1000 sep={} },
    tick label style={font=\footnotesize},
    label style={font=\small},
    group style={
      x descriptions at = edge bottom,
      group size=1 by 4,
      vertical sep=0cm
    },
    width=12cm,
    enlargelimits=false]
    \nextgroupplot[
    semithick,
    height = 6.5cm,
    /pgf/number format/1000 sep={},
    ymax=0.7,
    colormap/jet,
    y tick label style={
      /pgf/number format/.cd,
      fixed, fixed zerofill, precision=2,
      /tikz/.cd
    },
    tick label style={font=\footnotesize},
    label style={font=\small},
    legend style={font=\small,
                  at={(1.05,1)},
                  anchor=north west,
                  fill=none},
    ylabel = distance from trench, y unit = m,
    legend cell align=right,
    contour/labels=false,
    contour prepared]
    \pgfplotsinvokeforeach{1,...,9} { % level 0 and 10 are empty
      \pgfplotscolormapaccess[0:10]{#1}{jet}
      \def\TEMP{\definecolor{mycolor#1}{rgb}}
      \expandafter\TEMP\expandafter{\pgfmathresult}
      \def\fnameX{generated/\fnamebase:\fname:level:%
        \pgfplotsarrayvalueofelem#1\of\heights.tex}
      \addplot[contour prepared={draw color=mycolor#1}, forget plot] table \fnameX;
      \addlegendimage{line legend,color=mycolor#1}
      \addlegendentry{%
         \SI{\pgfplotsarrayvalueofelem#1\of\heights}{\micro\meter}}
    };
    \nextgroupplot[
    semithick,
    height = 3.5cm,
    ylabel style={align=center}, ylabel = time step\\size, y unit = s,
    ytick={1e-3,1e-2,1e-1},
    ymax = 1, ymin = 1e-4,
    ymode = log]
    \addplot[const plot, mark=none] table[col sep=comma, y=timeIncrement]
    {generated/2d-performance:\fname.csv};
    \nextgroupplot[
    semithick,
    height = 3.5cm,
    ylabel style={align=center}, ylabel=fixed-point\\iterations,
    ytick={2,4,6,8},
    ymin=0, ymax=10]
    \addplot[const plot, mark=none] table[col sep=comma, y=fixedPointIterations]
    {generated/2d-performance:\fname.csv};
    \nextgroupplot[
    semithick,
    height = 3.5cm,
    xlabel = time, x unit = s,
    ylabel style={align=center}, ylabel=multigrid\\iterations,
    ytick={5,10,15,20},
    ymin=0, ymax=25]
    \addplot[const plot, mark=none] table[col sep=comma, y=multiGridIterations]
    {generated/2d-performance:\fname.csv};
  \end{groupplot}
\end{tikzpicture}