1 
\begin{figure} 
2 
\includegraphics[width=\textwidth]{figures/FaultSystem2D} 
3 
\caption{\label{FAULTSYSTEM2D}Two dimensional fault system with one fault named `t` in the $(x\hackscore{0},x\hackscore{1})$ and its parametrization in the 
4 
$w\hackscore{0}$ space. The fault has three segments.} 
5 
\end{figure} 
6 

7 
\section{Fault System} 
8 
The \class{FaultSystem} is an easy to use interface to handle 2D and 3D fault systems \index{faults} as used for instance in simulating fault ruptures. The main purpose of the class is to provide a parametrization of an individual fault in the system of fault. In case of a 2D fault the fault is parametrized by a single value $w\hackscore{0}$ and in the case of a 3D fault two parameters $w\hackscore{0}$ and $w\hackscore{1}$ are used. Thsi parametrization can be used 
9 
to impose data (e.g. a slip distribution) onto the fault. It can also be a useful tool to visualize or analyse the results on the fault if the fault is not straight. 
10 

11 
A fault $t$ in the fault system is represented by two polygons $(V^{ti})$ and $(v^{ti})$ 
12 
defining the top and bottom line of the fault $t$. 
13 
$V^{ti}$ defines the $i$th fault vertex at the top of the fault (typically at the surface of the Earth) and 
14 
$v^{ti}$ defines the $i$th fault vertex at the bottom of the fault. Both polygons need to contain the same number of 
15 
vertices. For the 2D case the polygon $(v^{ti})$ for the bottom edge of the fault is dropped. 
16 
The patch with the vertices 
17 
$V^{t(i1)}$, $V^{ti}$ 
18 
$v^{t(i1)}$, and $v^{ti}$ 
19 
is called the $i$th segment of the fault `t`. In 2D the the line with the start point $V^{t(i1)}$ 
20 
and the end point $V^{ti}$ is called the $i$th segment, see Figure~\ref{FAULTSYSTEM2D}. 
21 

22 
In general a fault does not define a plane surface (or a straight line in 2D). In order to simplify working on 
23 
a fault in a fault system a parametrization $P^t: (w\hackscore{0},w\hackscore{1}) \rightarrow (x\hackscore{0},x\hackscore{1},x\hackscore{2})$ over a rectangular domain is introduced such that 
24 
\begin{equation} 
25 
0\le w\hackscore{0} \le w^t\hackscore{0 max} \mbox{ and } w^t\hackscore{1max}\le w\hackscore{1} \le 0 
26 
\label{eq:fault 1} 
27 
\end{equation} 
28 
with positive if numbers $w^t\hackscore{0 max}$ and $w^t\hackscore{1 max}$. Typically one chooses 
29 
$w^t\hackscore{0 max}$ to be the unrolled length of the fault 
30 
$w^t\hackscore{1 max}$ to be the mean value of segment depth. Moreover we have 
31 
\begin{equation} 
32 
P^t(W^{ti})=V^{ti}\mbox{ and } P^t(w^{ti})=v^{ti}\ 
33 
\label{eq:fault 2} 
34 
\end{equation} 
35 
where 
36 
\begin{equation} 
37 
W^{ti}=(d^{ti},0) \mbox{ and } w^{ti}=(d^{ti},w^t\hackscore{1 max}) 
38 
\label{eq:fault 3} 
39 
\end{equation} 
40 
and $d^{ti}$ is the unrolled distance of $W^{ti}$ from $W^{t0}$. In the 2D case $w^t\hackscore{1 max}$ is set to zero and therefore the second component is dropped, see Figure~\ref{FAULTSYSTEM2D}. 
41 

42 
In the case of 2D the parametrization $P^t$ is constructed as follows: 
43 
The line connecting $V^{t(i1)}$ and $V^{ti}$ is given by 
44 
\begin{equation} 
45 
x=V^{t(i1)} + s \cdot (V^{ti}V^{t(i1)}) 
46 
\label{eq:2D line 1} 
47 
\end{equation} 
48 
where $s$ is between $0$ and $1$. The point $x$ is on $i$th fault segement if and only if 
49 
such an $s$ esxists. If assume $x$ is on the fault one can calculate $s$ as 
50 
\begin{equation} 
51 
s = \frac{ (x V^{t(i1)})^t \cdot (V^{ti}V^{t(i1)}) }{\V^{ti}V^{t(i1)}\^2} 
52 
\label{eq:2D line 1b} 
53 
\end{equation} 
54 
We then can set 
55 
\begin{equation} 
56 
w\hackscore{0}=d^{ti}+s \cdot (d^{ti}d^{t(i1)}) 
57 
\label{eq:2D line 2} 
58 
\end{equation} 
59 
to get $P^t(w\hackscore{0})=x$. 
60 
It remains the question if the given $x$ is actual on the segment $i$ of fault $t$. To test this $s$ is restricted 
61 
between $0$ and $1$ (so if $s<0$ $s$ is set to $0$ and if $s>1$ $s$ is set to $1$) and the we check the 
62 
residual of equation~\ref{eq:2D line 1}, ie. $x$ is been accepted to be in the segement if 
63 
\begin{equation} 
64 
\xV^{t(i1)}  s \cdot (V^{ti}V^{t(i1)}) \ \le tol \cdot max(\V^{ti}V^{t(i1)}\, \xV^{t(i1)} \) 
65 
\label{eq:2D line 3} 
66 
\end{equation} 
67 
where $tol$ is a given tolerance. 
68 

69 
ADD DISCRIPTION FOR 3D case. 
70 

71 
\subsection{Functions} 
72 

73 
\begin{classdesc}{FaultSystem}{ 
74 
\optional{dim =3}} 
75 
Creates a fault system in the \var{dim} dimensional space. 
76 
\end{classdesc} 
77 

78 

79 

80 
\begin{methoddesc}[FaultSystem]{getDim}{} 
81 
returns the spatial dimension 
82 
\end{methoddesc} 
83 
\begin{methoddesc}[FaultSystem]{getLength}{tag} 
84 
returns the unrolled length of fault \var{tag}. 
85 
\end{methoddesc} 
86 

87 
\begin{methoddesc}[FaultSystem]{getDepth}{tag} 
88 
returns the medium depth of fault \var{tag}. 
89 
\end{methoddesc} 
90 

91 
\begin{methoddesc}[FaultSystem]{getTags}{} 
92 
returns a list of the tags used by the fault system 
93 
\end{methoddesc} 
94 

95 
\begin{methoddesc}[FaultSystem]{getW0Range}{tag} 
96 
returns the range of the parameterization in $w\hackscore{0}$. 
97 
For tag $t$ this is the pair $(d^{t0},d^{tn})$ where $n$ is the number of segments in the fault. 
98 
In most cases one has $(d^{t0},d^{tn})=(0,w^t\hackscore{0 max})$. 
99 
\end{methoddesc} 
100 

101 
\begin{methoddesc}[FaultSystem]{getW1Range}{tag} 
102 
returns the range of the parameterization in $w\hackscore{1}$. 
103 
For tag $t$ this is the pair $(w^t\hackscore{1max},0)$. 
104 
\end{methoddesc} 
105 

106 
\begin{methoddesc}[FaultSystem]{getW0Offsets}{tag} 
107 
returns the offsets for the parametrization of fault \var{tag}. 
108 
For tag \var{tag}=$t$ this is the list $[d^{ti}]$. 
109 
\end{methoddesc} 
110 

111 

112 
\begin{methoddesc}[FaultSystem]{getFaultSegments}{tag} 
113 
returns the polygons used to describe fault \var{tag}. For \var{tag}=$t$ this is the list of the vertices 
114 
$[V^{ti}]$ for the 2D and the pair of lists of the top vertices $[V^{ti}]$ and the bottom vertices $[v^{ti}]$ in 3D. 
115 
Note that the coordinates are represented as \numpyNDA objects. 
116 
\end{methoddesc} 
117 

118 
\begin{methoddesc}[FaultSystem]{getCenterOnSurface}{} 
119 
returns the center point of the fault system at the surfaces. In 3D the calculation of the center is 
120 
considering the top edge of the faults and projects the edge to the surface (the $x\hackscore{2}$ component is assumed to be 0). An \numpyNDA object is returned. 
121 
\end{methoddesc} 
122 

123 
\begin{methoddesc}[FaultSystem]{getOrientationOnSurface}{} 
124 
returns the orientation of the fault system in RAD on the surface ($x\hackscore{2}=0$ plane) around the fault system center. 
125 
\end{methoddesc} 
126 
\begin{methoddesc}[FaultSystem]{transform}{\optional{rot=0, \optional{shift=numpy.zeros((3,)}}} 
127 
applies a shift \var{shift} and a consecutive rotation in the $x\hackscore{2}=0$ plane. 
128 
\var{rot} is a float number and \var{shift} an \numpyNDA object. 
129 
\end{methoddesc} 
130 

131 
\begin{methoddesc}[FaultSystem]{addFault}{top, tag \optional{, bottom=None \optional{, w0_offsets=None\optional{, w1_max=None}}}} 
132 
adds the fault \var{tag} to the fault system. 
133 

134 
\var{top} is the list of the vertices defing the top of the fault 
135 
while \var{bottom} is the list of the vertices defing the bottom of the fault. 
136 
In the case of 2D \var{bottom} must not be present. Both list, if present, must have the same length. 
137 
\var{w1_max} defines the range of the $w\hackscore{1}$. If not present the mean value over the depth of 
138 
all segement edges in the fault is used. 
139 
\var{w0_offsets} sets the offsets $d^{ti}$. If not present it i schoosen such that $d^{ti}d^{t(i1)}$ is the length of the $i$th segment. In some cases, eg. when kinks in the fault are relevant, it can be useful 
140 
to explicitly specify the offsets in order to simplify the signamnt of values. 
141 
\end{methoddesc} 
142 

143 
\begin{methoddesc}[FaultSystem]{getMaxValue}{f\optional{, tol=1.e8}} 
144 
returns the maximum value of \var{f}, the fault wher the maximum is found and the location on the fault in fault coordinates. \var{f} must be a \Scalar. When the maximum is calculated only \DataSamplePoints are considered 
145 
which are on a fault in the fault system in the sense of condition~\label{eq:2D line 3} or \label{eq:3D line 3}, respectively. In the case no \DataSamplePoints is found the returned tag is \var{None} and 
146 
the maximum value as well as the location of the maximum value are undefined. 
147 
\end{methoddesc} 
148 

149 
\begin{methoddesc}[FaultSystem]{getParametrization}{x,tag \optional{\optional{, tol=1.e8}, outsider=None}} 
150 
resturns the argument $w$ of the parameterization $P^t$ for \var{tag}=$t$ to provide \var{x} 
151 
together with a mask indicating where the given location if on a fault in the fault system by the value $1$ (otherwise the value is set to $0$). \var{x} needs to be \Vector or \numpyNDA object. \var{tol} defines the tolerance to decide if a given \DataSamplePoints is on fault \var{tag}. The value 
152 
\var{outside} is the value used as a replacement value for $w$ where the corresponding value in \var{x} is not 
153 
on a fault. If not \var{outside} is not present an appropriate value is used. 
154 
\end{methoddesc} 
155 

156 
\subsection{Example} 
157 
See section~\ref{Slip CHAP} 
158 

159 

160 

161 

162 

163 

164 

165 
