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 parameterization in the 
4 
$w\hackscore{0}$ space. The fault has three segments.} 
5 
\end{figure} 
6 

7 
\section{Fault System} 
8 
\label{Fault System} 
9 
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 parameterization of an individual fault in the system of fault. In case of a 2D fault the fault is parameterized 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. This parameterization can be used 
10 
to impose data (e.g. a slip distribution) onto the fault. It can also be a useful tool to visualize or analyze the results on the fault if the fault is not straight. 
11 

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

23 
In general a fault does not define a plane surface (or a straight line in 2D). In order to simplify working on 
24 
a fault in a fault system a parameterization $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 
25 
\begin{equation} 
26 
0\le w\hackscore{0} \le w^t\hackscore{0 max} \mbox{ and } w^t\hackscore{1max}\le w\hackscore{1} \le 0 
27 
\label{eq:fault 1} 
28 
\end{equation} 
29 
with positive if numbers $w^t\hackscore{0 max}$ and $w^t\hackscore{1 max}$. Typically one chooses 
30 
$w^t\hackscore{0 max}$ to be the unrolled length of the fault 
31 
$w^t\hackscore{1 max}$ to be the mean value of segment depth. Moreover we have 
32 
\begin{equation} 
33 
P^t(W^{ti})=V^{ti}\mbox{ and } P^t(w^{ti})=v^{ti}\ 
34 
\label{eq:fault 2} 
35 
\end{equation} 
36 
where 
37 
\begin{equation} 
38 
W^{ti}=(d^{ti},0) \mbox{ and } w^{ti}=(d^{ti},w^t\hackscore{1 max}) 
39 
\label{eq:fault 3} 
40 
\end{equation} 
41 
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}. 
42 

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

70 
ADD DISCRIPTION FOR 3D case. 
71 

72 
\subsection{Functions} 
73 

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

79 

80 

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

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

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

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

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

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

112 

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

119 
\begin{methoddesc}[FaultSystem]{getCenterOnSurface}{} 
120 
returns the center point of the fault system at the surfaces. In 3D the calculation of the center is 
121 
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. 
122 
\end{methoddesc} 
123 

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

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

135 
\var{top} is the list of the vertices defing the top of the fault 
136 
while \var{bottom} is the list of the vertices defing the bottom of the fault. 
137 
In the case of 2D \var{bottom} must not be present. Both list, if present, must have the same length. 
138 
\var{w1_max} defines the range of the $w\hackscore{1}$. If not present the mean value over the depth of 
139 
all segment edges in the fault is used. 
140 
\var{w0_offsets} sets the offsets $d^{ti}$. If not present it i chosen 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 
141 
to explicitly specify the offsets in order to simplify the assignment of values. 
142 
\end{methoddesc} 
143 

144 
\begin{methoddesc}[FaultSystem]{getMaxValue}{f\optional{, tol=1.e8}} 
145 
returns the maximum value of \var{f}, the fault where 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 
146 
which are on a fault in the fault system in the sense of condition~\ref{eq:2D line 3} or \ref{eq:3D line 3}, respectively. In the case no \DataSamplePoints is found the returned tag is \var{None} and 
147 
the maximum value as well as the location of the maximum value are undefined. 
148 
\end{methoddesc} 
149 

150 
\begin{methoddesc}[FaultSystem]{getParametrization}{x,tag \optional{\optional{, tol=1.e8}, outsider=None}} 
151 
returns the argument $w$ of the parameterization $P^t$ for \var{tag}=$t$ to provide \var{x} 
152 
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 
153 
\var{outside} is the value used as a replacement value for $w$ where the corresponding value in \var{x} is not 
154 
on a fault. If not \var{outside} is not present an appropriate value is used. 
155 
\end{methoddesc} 
156 

157 
\begin{methoddesc}[FaultSystem]{getSideAndDistance}{x,tag} 
158 
returns the side and the distance at locations \var{x} from the fault \var{tag}. 
159 
\var{x} needs to be \Vector or \numpyNDA object. Positive values for side means that the corresponding location is 
160 
to the right of the fault, a negative value means that the corresponding location is 
161 
to the left of the fault. The value zero means that the side is undefined. 
162 
\end{methoddesc} 
163 

164 
\subsection{Example} 
165 
See section~\ref{Slip CHAP} 
166 

167 

168 

169 

170 

171 

172 
