Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • podlesny/dune-tectonic
  • agnumpde/dune-tectonic
2 results
Show changes
Commits on Source (139)
Showing
with 761 additions and 1 deletion
......@@ -17,7 +17,7 @@ include(DuneMacros)
# start a dune project with information from dune.module
dune_project()
dune_enable_all_packages()
find_package(HDF5 COMPONENTS C REQUIRED)
add_subdirectory("src")
......
\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}
\def\fnamebase{dip-single-points}
\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 left, trim axis right]
\begin{axis}[
xmin=\threequakesmin, xmax=\threequakesmax, max space between ticks=40pt,
/pgf/number format/1000 sep={},
x tick label style={
/pgf/number format/.cd,
1000 sep={},
/tikz/.cd
},
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},
legend entries={
\SI{15}{\centi\meter},
\SI{30}{\centi\meter},
\SI{45}{\centi\meter}
},
ylabel style={align=center}, ylabel=vertical surface\\displacement, y unit = m,
change y base, y SI prefix=micro,
xlabel = time, x unit=s,
width = 12cm,
height = 4cm,
semithick]
\addplot[width=2pt] table[col sep=comma, x index = 0, y index=1]
{generated/\fnamebase:\fname.csv};
\addplot[width=2pt, dashed] table[col sep=comma, x index = 0, y index=2]
{generated/\fnamebase:\fname.csv};
\addplot[width=2pt, dotted] table[col sep=comma, x index = 0, y index=3]
{generated/\fnamebase:\fname.csv};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[trim axis left, trim axis right]
\begin{axis}[
semithick,
width = 12cm,
height = 4cm,
xmode=log,
%ymin = 0,
% scaled y ticks=base 10:0,
xlabel = fixed point tolerance,
ylabel style={align=center}, ylabel = multigrid\\iterations, % (multigrid steps)
extra x ticks = 1e-5,
extra x tick labels = { time-stepping\\tolerance },
extra x tick style = { align=center, grid = major, ticklabel pos=right }
]
\addplot[mark=+] table[col sep=comma, y=mg] {generated/fpi-data.csv};
\end{axis}
\end{tikzpicture}
\pgfplotsarraynew\contourlevels{%
1\\3\\
10\\30\\
100\\300\\
1000\\3000\\
}
\def\fname{threequakes:rfpitol=100e-7}
\newread\threequakesminread
\openin\threequakesminread=generated/timeframe:min:\fname.tex
\read\threequakesminread to \threequakesmin
\closein\threequakesminread
\newread\threequakesmaxread
\openin\threequakesmaxread=generated/timeframe:max:\fname.tex
\read\threequakesmaxread to \threequakesmax
\closein\threequakesmaxread
\begin{tikzpicture}[trim axis left, trim axis right]
\begin{axis}[
xmin=\threequakesmin, xmax=\threequakesmax, max space between ticks=40pt,
ymax=0.85,
colormap/jet,
x tick label style={
/pgf/number format/.cd,
1000 sep={},
/tikz/.cd
},
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,
xlabel = time, x unit=s,
width = 12cm, height = 6.5cm,
legend cell align=right,
contour/labels=false,
enlargelimits=false,
semithick]
\pgfplotsinvokeforeach{0,2,4,6} {
\pgfplotscolormapaccess[0:7]{#1}{jet}
\def\TEMP{\definecolor{mycolor#1}{rgb}}
\expandafter\TEMP\expandafter{\pgfmathresult}
\def\fnameX{generated/2d-velocity-contours:\fname:level:%
\pgfplotsarrayvalueofelem#1\of\contourlevels.tex}
\addplot[contour prepared={draw color=mycolor#1}, forget plot] table \fnameX;
\addlegendimage{line legend,color=mycolor#1}
\addlegendentry{%
\SI{\pgfplotsarrayvalueofelem#1\of\contourlevels}{\micro\meter/\second}}
};
\end{axis}
\end{tikzpicture}
\pgfplotsarraynew\contourlevels{%
1\\3\\
10\\30\\
100\\300\\
1000\\3000\\
}
\def\fname{zoom:rfpitol=100e-7}
\begin{tikzpicture}[trim axis left, trim axis right]
\begin{axis}[
max space between ticks=40pt,
ymax=0.7,
colormap/jet,
x tick label style={
/pgf/number format/.cd,
fixed, fixed zerofill, precision=2,
1000 sep={},
/tikz/.cd
},
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,
xlabel = time, x unit=s,
width = 12cm, height = 6.5cm,
legend cell align=right,
enlargelimits=false,
contour/labels=false,
semithick]
\pgfplotsinvokeforeach{0,...,6} { % level 7 is empty
\pgfplotscolormapaccess[0:7]{#1}{jet}
\def\TEMP{\definecolor{mycolor#1}{rgb}}
\expandafter\TEMP\expandafter{\pgfmathresult}
\def\fnameX{generated/2d-velocity-contours:\fname:level:%
\pgfplotsarrayvalueofelem#1\of\contourlevels.tex}
\addplot[contour prepared={draw color=mycolor#1}, forget plot] table \fnameX;
\addlegendimage{line legend,color=mycolor#1}
\addlegendentry{%
\SI{\pgfplotsarrayvalueofelem#1\of\contourlevels}{\micro\meter/\second}}
};
\end{axis}
\end{tikzpicture}
\def\fname{rtol=1e-5_diam=1e-2}
\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/.cd,
1000 sep={},
/tikz/.cd
},
tick label style={font=\footnotesize},
label style={font=\small},
group style={
x descriptions at = edge bottom,
group size=1 by 3,
vertical sep=0cm
},
height=3.5cm, width=12cm,
enlargelimits=false]
\nextgroupplot[
semithick,
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/3d-performance:\fname.csv};
\nextgroupplot[
semithick,
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/3d-performance:\fname.csv};
\nextgroupplot[
semithick,
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/3d-performance:\fname.csv};
\end{groupplot}
\end{tikzpicture}
\def\fname{generated/3d-velocity-contours:rtol=1e-5_diam=1e-2}
\pgfplotstableread[col sep=comma]{\fname:times.csv}\myloadedtable
\pgfplotsarraynew\contourlevels{%
1\\2\\3\\5\\%
10\\20\\30\\50\\%
100\\200\\300\\500\\%
1000\\
}
\begin{tikzpicture}[trim axis group left, trim axis group right]
\begin{groupplot}[
group style={
y descriptions at = edge left,
group size=6 by 1,
horizontal sep=0cm
},
ymin=-0.30, ymax= 0.30,
enlarge x limits=false,
colormap/jet,
y tick label style={
/pgf/number format/.cd,
fixed, fixed zerofill, precision=2,
/tikz/.cd
},
ytick = {-0.30,-0.20,-0.10,0.00,0.10,0.20,0.30},
tick label style={font=\footnotesize},
label style={font=\small},
width = 3.5cm, height = 6cm,
enlargelimits=false,
contour/labels=false,
%
groupplot xlabel={distance from trench [\si{\meter}]},
]
\nextgroupplot[semithick, xlabel = {
\pgfplotstablegetelem{0}{times}\of\myloadedtable%
$t_0 \approx
\SI[round-mode=places,round-precision=0]{\pgfplotsretval}{\second}$
},
ylabel = width, y unit = m]
\draw[color=gray!20] (0.162533,-0.30) -- (0.162533,+0.30); % X
\draw[color=gray!20] (0.362533+0.05,-0.30) -- (0.362533-0.05,+0.30); % Y
\pgfplotsinvokeforeach{0,...,12} {
\pgfplotscolormapaccess[0:14]{#1}{jet}
\def\TEMP{\definecolor{mycolor#1}{rgb}}
\expandafter\TEMP\expandafter{\pgfmathresult}
\pgfplotstablegetelem{0}{timeSteps}\of\myloadedtable
\edef\fnameX{\fname:%
step:\pgfplotsretval:%
level:\pgfplotsarrayvalueofelem#1\of\contourlevels.tex}
\addplot[contour prepared={draw color=mycolor#1}] table \fnameX;
};
\nextgroupplot[semithick, xlabel = {
\pgfplotstablegetelem{1}{timeOffsets}\of\myloadedtable%
$t_0 +
\SI[round-mode=places,round-precision=2]{\pgfplotsretval}{\second}$
}]
\draw[color=gray!20] (0.162533,-0.30) -- (0.162533,+0.30); % X
\draw[color=gray!20] (0.362533+0.05,-0.30) -- (0.362533-0.05,+0.30); % Y
\pgfplotsinvokeforeach{0,...,12} { % level 13 and 14 are empty
\pgfplotscolormapaccess[0:14]{#1}{jet}
\def\TEMP{\definecolor{mycolor#1}{rgb}}
\expandafter\TEMP\expandafter{\pgfmathresult}
\pgfplotstablegetelem{1}{timeSteps}\of\myloadedtable
\edef\fnameX{\fname:%
step:\pgfplotsretval:%
level:\pgfplotsarrayvalueofelem#1\of\contourlevels.tex}
\addplot[contour prepared={draw color=mycolor#1}] table \fnameX;
};
\nextgroupplot[semithick, xlabel = {
\pgfplotstablegetelem{2}{timeOffsets}\of\myloadedtable%
$t_0 +
\SI[round-mode=places,round-precision=2]{\pgfplotsretval}{\second}$
}]
\draw[color=gray!20] (0.162533,-0.30) -- (0.162533,+0.30); % X
\draw[color=gray!20] (0.362533+0.05,-0.30) -- (0.362533-0.05,+0.30); % Y
\pgfplotsinvokeforeach{0,...,12} { % level 13 and 14 are empty
\pgfplotscolormapaccess[0:14]{#1}{jet}
\def\TEMP{\definecolor{mycolor#1}{rgb}}
\expandafter\TEMP\expandafter{\pgfmathresult}
\pgfplotstablegetelem{2}{timeSteps}\of\myloadedtable
\edef\fnameX{\fname:%
step:\pgfplotsretval:%
level:\pgfplotsarrayvalueofelem#1\of\contourlevels.tex}
\addplot[contour prepared={draw color=mycolor#1}] table \fnameX;
};
\nextgroupplot[semithick, xlabel = {
\pgfplotstablegetelem{3}{timeOffsets}\of\myloadedtable%
$t_0 +
\SI[round-mode=places,round-precision=2]{\pgfplotsretval}{\second}$
},
legend columns=4,
legend cell align=right,
legend style={font=\small,
at={(0,1.05)},
anchor=south,
fill=none},
]
\draw[color=gray!20] (0.162533,-0.30) -- (0.162533,+0.30); % X
\draw[color=gray!20] (0.362533+0.05,-0.30) -- (0.362533-0.05,+0.30); % Y
\pgfplotsinvokeforeach{0,...,12} { % level 13 and 14 are empty
\pgfplotscolormapaccess[0:14]{#1}{jet}
\def\TEMP{\definecolor{mycolor#1}{rgb}}
\expandafter\TEMP\expandafter{\pgfmathresult}
\pgfplotstablegetelem{3}{timeSteps}\of\myloadedtable
\edef\fnameX{\fname:%
step:\pgfplotsretval:%
level:\pgfplotsarrayvalueofelem#1\of\contourlevels.tex}
\addplot[contour prepared={draw color=mycolor#1}, forget plot] table \fnameX;
\addlegendimage{line legend,color=mycolor#1}
\addlegendentry{%
\SI{\pgfplotsarrayvalueofelem#1\of\contourlevels}{\micro\meter/\second}}
};
\nextgroupplot[semithick, xlabel = {
\pgfplotstablegetelem{4}{timeOffsets}\of\myloadedtable%
$t_0 +
\SI[round-mode=places,round-precision=2]{\pgfplotsretval}{\second}$
}]
\draw[color=gray!20] (0.162533,-0.30) -- (0.162533,+0.30); % X
\draw[color=gray!20] (0.362533+0.05,-0.30) -- (0.362533-0.05,+0.30); % Y
\pgfplotsinvokeforeach{0,...,12} { % level 13 and 14 are empty
\pgfplotscolormapaccess[0:14]{#1}{jet}
\def\TEMP{\definecolor{mycolor#1}{rgb}}
\expandafter\TEMP\expandafter{\pgfmathresult}
\pgfplotstablegetelem{4}{timeSteps}\of\myloadedtable
\edef\fnameX{\fname:%
step:\pgfplotsretval:%
level:\pgfplotsarrayvalueofelem#1\of\contourlevels.tex}
\addplot[contour prepared={draw color=mycolor#1}] table \fnameX;
};
\nextgroupplot[semithick, xlabel = {
\pgfplotstablegetelem{5}{timeOffsets}\of\myloadedtable%
$t_0 +
\SI[round-mode=places,round-precision=2]{\pgfplotsretval}{\second}$
}]
\draw[color=gray!20] (0.162533,-0.30) -- (0.162533,+0.30); % X
\draw[color=gray!20] (0.362533+0.05,-0.30) -- (0.362533-0.05,+0.30); % Y
\pgfplotsinvokeforeach{0,...,12} { % level 13 and 14 are empty
\pgfplotscolormapaccess[0:14]{#1}{jet}
\def\TEMP{\definecolor{mycolor#1}{rgb}}
\expandafter\TEMP\expandafter{\pgfmathresult}
\pgfplotstablegetelem{5}{timeSteps}\of\myloadedtable
\edef\fnameX{\fname:%
step:\pgfplotsretval:%
level:\pgfplotsarrayvalueofelem#1\of\contourlevels.tex}
\addplot[contour prepared={draw color=mycolor#1}] table \fnameX;
};
\end{groupplot}
\end{tikzpicture}
\def\simulationtag{rfpitol=100e-7}
\begin{tikzpicture}[trim axis group left, trim axis group right]
\begin{groupplot}[
tick label style={font=\footnotesize},
label style={font=\small},
%
group style={
y descriptions at = edge left,
group size=3 by 1,
horizontal sep=0.75cm
},
height=4cm,
width=4.5cm,
%
ytick={1,2,3},
yticklabels={experiment, simulation}
]
%
\nextgroupplot[semithick, xlabel = recurrence time, x unit = s, xmode=log,
log ticks with fixed point, xtick={5,10,20,40}]
\addplot[mark=+, boxplot={ box extend = 0.5 }]
table[y index=0] {generated/boxplot-data:lab:recurrence.tex};
\addplot[mark=+, boxplot={ box extend = 0.5 }]
table[y index=0] {generated/boxplot-data:simulation:\simulationtag:recurrence.tex};
%
\nextgroupplot[semithick, xlabel = rupture width, x unit=m, xmin=0, xmax=0.4,
extra x ticks = 0.2,
extra x tick labels = ,
extra x tick style = { grid = major }
]
\addplot[mark=+, boxplot={ box extend = 0.5 }]
table[y index=0] {generated/boxplot-data:lab:ruptureWidth.tex};
\addplot[mark=+, boxplot={ box extend = 0.5 }]
table[y index=0] {generated/boxplot-data:simulation:\simulationtag:ruptureWidth.tex};
%
\nextgroupplot[semithick, xlabel = peak slip, x unit=mm, xmode=log, log ticks with fixed point,
xtick={0.03, 0.06, 0.12}]
\addplot[mark=+, boxplot={ box extend = 0.5 }]
table[y index=0] {generated/boxplot-data:lab:peakSlip.tex};
\addplot[mark=+, boxplot={ box extend = 0.5 }]
table[y index=0] {generated/boxplot-data:simulation:\simulationtag:peakSlip.tex};
\end{groupplot}
\end{tikzpicture}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11} % FIXME: 1.12 would be nice; debian:8.7 only has 1.11
\usepackage{pgfplotstable}
\usepgfplotslibrary{groupplots}
\usepgfplotslibrary{statistics}
\usepgfplotslibrary{units}
%% Typeset the mu from '[xy] SI prefix=micro' as an upright mu
%% From https://tex.stackexchange.com/a/224574
\pgfplotsset{
x SI prefix/micro/.style={/pgfplots/axis base prefix={axis x base 6 prefix \micro}},
y SI prefix/micro/.style={/pgfplots/axis base prefix={axis y base 6 prefix \micro}},
z SI prefix/micro/.style={/pgfplots/axis base prefix={axis z base 6 prefix \micro}},
unit code/.code 2 args={\si{#1#2}},
}
%% Add support for 'groupplot [xy]label'
%% From http://tex.stackexchange.com/a/117935/16940, see also
%% https://sourceforge.net/p/pgfplots/feature-requests/48/
\makeatletter
\pgfplotsset{
groupplot xlabel/.initial={},
every groupplot x label/.style={
at={($({\pgfplots@group@name\space c1r\pgfplots@group@rows.west}|-{\pgfplots@group@name\space c1r\pgfplots@group@rows.outer south})!0.5!({\pgfplots@group@name\space c\pgfplots@group@columns r\pgfplots@group@rows.east}|-{\pgfplots@group@name\space c\pgfplots@group@columns r\pgfplots@group@rows.outer south})$)},
anchor=north,
},
groupplot ylabel/.initial={},
every groupplot y label/.style={
rotate=90,
at={($({\pgfplots@group@name\space c1r1.north}-|{\pgfplots@group@name\space c1r1.outer
west})!0.5!({\pgfplots@group@name\space c1r\pgfplots@group@rows.south}-|{\pgfplots@group@name\space c1r\pgfplots@group@rows.outer west})$)},
anchor=south
},
execute at end groupplot/.code={%
\node [/pgfplots/every groupplot x label]
{\pgfkeysvalueof{/pgfplots/groupplot xlabel}};
\node [/pgfplots/every groupplot y label]
{\pgfkeysvalueof{/pgfplots/groupplot ylabel}};
}
}
\def\endpgfplots@environment@groupplot{%
\endpgfplots@environment@opt%
\pgfkeys{/pgfplots/execute at end groupplot}%
\endgroup%
}
\makeatother
%% Have \includegraphics{} support tikz files
\usepackage{tikzscale}
\ No newline at end of file
\documentclass[border={3cm 0cm}]{standalone}
\usepackage{siunitx}
\input{includes}
\begin{document}
\includegraphics{2d-dip-contours-performance.tikz}
\end{document}
\documentclass[border={3cm 0cm}]{standalone}
\usepackage{siunitx}
\input{includes}
\begin{document}
\includegraphics{2d-dip-single-points.tikz}
\end{document}
\documentclass[border={3cm 0cm}]{standalone}
\usepackage{siunitx}
\input{includes}
\begin{document}
\includegraphics{2d-effort-over-tolerance.tikz}
\end{document}
\documentclass[border={3cm 0cm}]{standalone}
\usepackage{siunitx}
\input{includes}
\begin{document}
\includegraphics{2d-velocity-contours-threequakes}
\end{document}
\documentclass[border={3cm 0cm}]{standalone}
\usepackage{siunitx}
\input{includes}
\begin{document}
\includegraphics{2d-velocity-contours-zoom}
\end{document}
\documentclass[border={3cm 0cm}]{standalone}
\usepackage{siunitx}
\input{includes}
\begin{document}
\includegraphics{3d-performance.tikz}
\end{document}
\documentclass[border={3cm 0cm}]{standalone}
\usepackage{siunitx}
\input{includes}
\begin{document}
\includegraphics{3d-velocity-contours.tikz}
\end{document}
PDFs=\
2d-dip-contours-performance.pdf \
2d-dip-single-points.pdf \
2d-effort-over-tolerance.pdf \
2d-velocity-contours-threequakes.pdf \
2d-velocity-contours-zoom.pdf \
3d-performance.pdf \
3d-velocity-contours.pdf \
boxplot.pdf
PNGs=$(PDFs:.pdf=.png)
pdf: $(PDFs)
%.pdf: standalone/%.tex
latexmk -pdf $<
png: $(PNGs)
%.png: %.pdf
convert -density 300 $< -quality 100 $@
\documentclass[border={3cm 0cm}]{standalone}
\usepackage{siunitx}
\input{includes}
\begin{document}
\input{boxplot.tikz}
\end{document}
source('tools/support/findQuakes.R')
source('tools/support/writeContours.R')
Rcpp::sourceCpp('tools/support/trapezoidal.cpp')
finalTime <- 1000 # s
specialTrenchDistances <- c(0.15,0.30,0.45) # m
convergenceVelocity <- 5e-5 # m/s
last <- function(x) x[[length(x)]]
paste. <- function(...) paste(..., sep='.')
pasteColon<- function(...) paste(..., sep=':')
directories <- ini::read.ini('config.ini')$directories
dir.create(directories[['output']], recursive=TRUE, showWarnings=FALSE)
for (basedir in c("rfpitol=100e-7")) {
dir <- file.path(directories[['simulation']],
'2d-lab-fpi-tolerance', basedir)
h5file <- h5::h5file(file.path(dir, 'output.h5'), 'r')
relativeTime <- h5file['relativeTime'][]
realTime <- finalTime * relativeTime
calcMask <- relativeTime >= 0.7
calcTime <- realTime[calcMask]
calcDuration <- last(calcTime) - calcTime[[1]]
calcRange <- range(which(calcMask))
calcLength <- sum(calcMask)
## We are interested in an enlarged time range around actual events here,
## (and no other quantities!) hence we pass a very low velocity here.
quakes <- findQuakes(1e-6 + convergenceVelocity,
h5file['/frictionalBoundary/velocity'][,,],
indices = calcRange[1]:calcRange[2])
quakes$beginning <- realTime[quakes$beginningIndex]
quakes$ending <- realTime[quakes$endingIndex]
quakes$duration <- quakes$ending - quakes$beginning
numQuakes <- nrow(quakes)
relaxedTime <- extendrange(c(quakes[[numQuakes-2,'beginning']],
quakes[[numQuakes, 'ending']]), f=0.02)
threeQuakeTimeMask <- (realTime > relaxedTime[[1]]) & (realTime < relaxedTime[[2]])
plotMask <- threeQuakeTimeMask
plotTime <- realTime[plotMask]
plotRange <- range(which(plotMask))
plotLength <- sum(plotMask)
write(relaxedTime[[1]],
file.path(directories[['output']],
paste.(pasteColon('timeframe', 'min', 'threequakes', basedir),
'tex')))
write(relaxedTime[[2]],
file.path(directories[['output']],
paste.(pasteColon('timeframe', 'max', 'threequakes', basedir),
'tex')))
surfaceCoordinates <- h5file['/surface/coordinates'][]
surfaceTrenchDistance <- surfaceCoordinates[,1] / cos(atan(.27))
perm <- order(surfaceTrenchDistance)
displacement <- h5file['/surface/displacement']
# This is the displacement imposed through the Dirichlet condition at the last node
displacementOffset <- displacement[calcRange[1]:calcRange[2],last(perm),1]
balancedSurfaceDisplacement <- matrix(nrow = plotLength, ncol = displacement@dim[2])
for (k in 1:displacement@dim[2]) {
d <- displacement[calcRange[1]:calcRange[2],k,1:2]
d[,,1] <- d[,,1] - displacementOffset
# We're in a tilted coordinate system
dv <- -sin(atan(.27))*d[,,1] + cos(atan(.27))*d[,,2]
meanVertSurfaceDisplacement <- trapezoidal(calcTime, dv) / calcDuration
balancedSurfaceDisplacement[,k] <- (dv - meanVertSurfaceDisplacement)[
(plotRange[1] - calcRange[1] + 1):(plotRange[2] - calcRange[1] + 1)
]
}
## Interpolate velocity to special points from surrounding velocities
{
data <- matrix(nrow=plotLength, ncol=1+length(specialTrenchDistances))
data[,1] <- plotTime
for (k in seq(plotLength)) {
interpolant <- approxfun(surfaceTrenchDistance[perm],
balancedSurfaceDisplacement[k,perm])
for (i in seq(specialTrenchDistances)) {
specialTrenchDistance <- specialTrenchDistances[[i]]
data[k,i+1] <- interpolant(specialTrenchDistance)
}
}
singleDataName <- file.path(directories[['output']],
paste.(pasteColon('dip-single-points', basedir),
'csv'))
write.csv(data, singleDataName, row.names = FALSE)
}
h5::h5close(h5file)
printlevels <- c('-40','-20','-10','-5','-2.5','0','2.5','5','10','20','40')
levels <- as.numeric(printlevels) * 1e-6
ret <- contourLines(plotTime,
surfaceTrenchDistance[perm],
balancedSurfaceDisplacement[,perm],
levels=levels)
for (i in seq(printlevels))
writeContours(ret, levels[[i]],
file.path(directories[['output']],
paste.(pasteColon('2d-dip-contours', basedir,
'level', printlevels[[i]]),
'tex')))
}