Browse Source

Added the documentation, altough it needs a lot.

master
Trevor Irons 8 years ago
parent
commit
a71156d5e1

+ 85
- 0
dox/book.tex View File

@@ -0,0 +1,85 @@
1
+%\documentclass[11pt]{article}
2
+%\documentclass[a4paper,11pt]{report}
3
+%\documentclass[11pt]{report}
4
+%\documentclass[a4paper,11pt]{scrartcl}
5
+\documentclass[a4paper,11pt]{scrreprt} %book}
6
+%\usepackage{times}
7
+\usepackage{fullpage,amsmath,placeins,graphicx,color,amssymb,setspace,listings,tikz,amsthm,yfonts,subfigure}
8
+\usepackage{natbib}
9
+
10
+\usepackage[linkbordercolor=white,citecolor={1 1 1}]{hyperref}
11
+
12
+\usepackage{amsthm} % theorem
13
+	
14
+\newcounter{proof}
15
+\stepcounter{proof}	
16
+\newtheorem{corollary}{Corollary}[proof]
17
+
18
+\definecolor{dkgreen}{rgb}{0,0.6,0}
19
+\definecolor{gray}{rgb}{0.5,0.5,0.5}
20
+
21
+%\lstset{language=c++,numbers=left,numberstyle=\tiny,showstringspaces=false,color=true}
22
+\lstset{language=c++,
23
+   keywords={real, VectorXd, SparseMatrix, string, this, default, exit, float, double,int, break, case,
24
+             catch,continue,else,elseif,end,for,function,Real,Complex,
25
+             global,if,otherwise,persistent,return,switch,try,while,long, unsigned, vector},
26
+   basicstyle=\ttfamily,
27
+   keywordstyle=\color{blue},
28
+   commentstyle=\color{red},
29
+   stringstyle=\color{dkgreen},
30
+   numbers=left,
31
+   numberstyle=\tiny\color{gray},
32
+   stepnumber=1,
33
+   numbersep=10pt,
34
+   backgroundcolor=\color{white},
35
+   tabsize=4,
36
+   showspaces=false,
37
+   showstringspaces=false}
38
+
39
+
40
+\def\LAPL#1{\nabla^2 {#1}}
41
+\def\VEC#1{\mathbf{#1}}
42
+\def\LBM{ \mathcal{L} ( \mathbb{R}^n ) }
43
+\def\LBO{ \mathcal{L} ( \mathbb{R}^1 ) }
44
+\def\LBT{ \mathcal{L} ( \mathbb{R}^2 ) }
45
+\def\REB{ \mathbb{R} }
46
+\def\REBN{ \mathbb{R}^n }
47
+\def\CENSECA{\alpha(U_{n+1}^m-2U_n^m+U_{n-1}^m)}
48
+%\def\DD#1{\frac{\partial}{\partial #1}}
49
+\def\DD#1{\frac{d}{d #1}}
50
+
51
+\author{Trevor Irons \\  
52
+        XRI Geophysics, LLC \\ 
53
+        Trevor.Irons@xrigeo.com   }
54
+
55
+\title{FEM4EllipticPDE}
56
+\subtitle{Lemma module v1.0}
57
+
58
+\begin{document}
59
+
60
+\maketitle
61
+
62
+\tableofcontents
63
+
64
+\renewcommand{\labelenumi}{(\Roman{enumi})}
65
+\renewcommand{\labelenumii}{(\arabic{enumii})}
66
+\renewcommand{\labelenumiii}{(\roman{enumiii})}
67
+
68
+\abstract
69
+	This Lemma module provides a Galerkin-style finite element solution to general elliptic problems. 
70
+	Lemma is an open source geophysical programming API that supports modular plug-ins, such as this one. 
71
+	Lemma may be freely downloaded from \href{http://lemmasoftware.org}{http://lemmasoftware.org}.
72
+	This module is currently closed source. Development of FEM4EllipticPDE started at the 
73
+	Center for Gravity Electrical and Magnetic Studies (CGEM) at the Colorado School of Mines. The modules  
74
+	was completed by XRI Geophysics, LLC. 
75
+
76
+\input{chapters/derivation}
77
+\input{chapters/usage}
78
+
79
+\input{chapters/magnetics}
80
+\input{chapters/examples}
81
+
82
+\bibliographystyle{seg}
83
+\bibliography{nmr}
84
+
85
+\end{document}

+ 269
- 0
dox/chapters/derivation.tex View File

@@ -0,0 +1,269 @@
1
+\chapter{Derivation}
2
+
3
+\section{Problem Statement}
4
+FEM4EllipticPDE is a Lemma module implementing a Galerkin finite element solution to a family of commonly encountered 
5
+elliptic  problems taking the form
6
+%Considering the uniformly elliptic Dirichlet BVP: 
7
+\begin{eqnarray}
8
+	\label{eq:scheme}
9
+	-\nabla \cdot \left( \sigma(\mathbf{r}) \nabla u(\mathbf{r}) \right) = g(\mathbf{r}) & \mathop{\forall}_{u \in \Omega} \\
10
+	u = 0                                            & \mathop{\forall}_{u \in \partial \Omega} 
11
+\end{eqnarray}
12
+
13
+Where $0 < \sigma_{min} \leq \sigma(\mathbf{r}) \leq \sigma_{max} \ll \infty $  and $\Omega \in \mathbb{R}^3$. When $\sigma \equiv 1$, this 
14
+reduces to Poisson's equation $\left( \nabla^2 u  = g \right)$. These types of problem arises in several areas of geophysics: gravitational or magnetic potentials 
15
+obey Poisson's equation, while the more general form can be used to solve electrostatic (DC and SP) problems. 
16
+
17
+\begin{enumerate}
18
+	\item The Galerkin finite element method is defined by reposing the global problem in terms of numerous local ones through the use of 
19
+	appropriate test functions. 
20
+	\begin{itemize}
21
+
22
+		\item Test functions $v$ must be from a suitable subspace. 
23
+		In this case, due to the Dirichlet boundary conditions,
24
+		\[
25
+			v  \in H^a_b(\Omega)
26
+		\]
27
+		meet our requirements. $H^a_b$ represents the subspace of weakly differentiable functions that are zero valued at $a$, and $b$
28
+		and $\textgoth{V}$ represents the actual functions. % Hilbert space.
29
+
30
+		The 3D variational problem may be written
31
+
32
+%		\[
33
+%				-\nabla \cdot \left( \sigma(\mathbf{r}) \nabla u(\mathbf{r}) \right) = g(\mathbf{r}) & \mathop{\forall}_{u \in \Omega} \\
34
+%	u = 0                                            & \mathop{\forall}_{u \in \partial \Omega} 
35
+%
36
+		%\] 
37
+		\[
38
+		  \int	-v \nabla \cdot \sigma  \nabla u = v g.
39
+		\]
40
+		This can be simplified 
41
+		\[
42
+			\int_a^b \sigma \frac{du}{dx} \frac{dv}{dx} dx = v g
43
+		\]
44
+		The proof of which follows below. 
45
+		%\item The variational form may be found by multiplying the elliptic PDE by any arbitrary
46
+		%\[ 
47
+		%	v \in H_a^b(\Omega) 
48
+		%\]
49
+		
50
+		%In 1D ($\Omega \in \mathbb{R}^1$) \autoref{eq:scheme} reduces to:
51
+		%\begin{equation} \label{eq:oned}
52
+		%	- \DD{x} \sigma \DD{x} u = g
53
+		%\end{equation}
54
+		%Using the variational (weak) formulation for any arbitrary $v \in \textgoth{V} 
55
+	
56
+		\item In any arbitrary dimension $x$, if the boundaries in that dimension of $\partial \Omega = [a,b]$ the variational problem using 
57
+		test functions can be constructed 
58
+		\begin{equation} \label{eq:oned}
59
+			-\int_a^b v(x) \DD{x} \sigma(x) \DD{x} u(x)  dx = \int_a^b v(x) g(x) dx ,  
60
+		\end{equation}
61
+
62
+				
63
+		The variation problem can be reduced to a simplified version, if appropriate test functions we may instead write the 
64
+		variational problem as 
65
+		\[
66
+			\int_a^b  \sigma \frac{du}{dx} \frac{dv}{dx} dx = \int_a^b v(x) g(x) dx
67
+		\]
68
+		
69
+
70
+		In one dimension this resolves to
71
+		\[
72
+			%	-\int_a^b v \frac{d}{dx} \left[ \sigma \frac{du}{dx} \right] dx = 
73
+			\int_a^b  \sigma \frac{du}{dx} \frac{dv}{dx} dx = \int_a^b v(x) g(x) dx
74
+		\]
75
+
76
+		
77
+				
78
+
79
+		\begin{corollary}
80
+		\[
81
+		\frac{d}{dx} \left[ v \sigma \frac{du}{dx}  \right] = v \frac{d}{dx} \left[ \sigma \frac{du}{dx} \right] +
82
+		 \sigma \frac{du}{dx} \frac{dv}{dx}  
83
+		\]	
84
+		\end{corollary}
85
+
86
+		
87
+
88
+		\begin{proof}
89
+		and the integration by parts on the left hand side yields
90
+		\begin{eqnarray*}
91
+		\int_a^b v \frac{d}{dx} \left[ v \sigma \frac{du}{dx} \right] dx &=&  \int_a^b v \frac{d}{dx} 
92
+		\left[ \sigma \frac{du}{dx} \right] dx + 
93
+		\int_a^b \sigma \frac{du}{dx} \frac{dv}{dx} dx  \\
94
+		\Rightarrow & & \\
95
+		\left[ v \sigma \frac{du}{dx} \right]_a^b &=& \int_a^b v \frac{d}{dx} \left[ 
96
+		\sigma \frac{du}{dx} \right]  + \int_a^b \sigma \frac{dv}{dx}\frac{du}{dx} dx \\
97
+		\Rightarrow & & \\\
98
+			-\int_a^b v \frac{d}{dx} \left[ \sigma \frac{du}{dx} \right] dx &=& \left[ v \sigma 
99
+			\frac{du}{dx} \right]_a^b + \int_a^b \sigma \frac{du}{dx} \frac{dv}{dx} dx
100
+		\end{eqnarray*}
101
+		\[
102
+				-\int_a^b v \frac{d}{dx} \left[ \sigma \frac{du}{dx} \right] dx = \int_a^b 
103
+		\sigma \frac{du}{dx} \frac{dv}{dx} dx
104
+		\]
105
+		\end{proof}
106
+
107
+		Because $v\in H^1_0$ the solution vanishes at the boundaries $\left[ v \sigma \frac{du}{dx} \right]_a^b =0 $.
108
+		Therefore the scheme reduces to:
109
+
110
+% 		Which can be rewritten as
111
+% 		\[
112
+% 			a(u,v) = <g,v>
113
+% 		\] 
114
+		
115
+		The Galerkin FEM method uses triangle (hat) functions for $v$, which are renamed $\phi$ as 
116
+		they are specific. I will occasionally use these interchangeably.  
117
+
118
+		Through induction it can be shown then that the 3D problem can similarity be posed 
119
+		So that Equation \ref{eq:scheme} may be rewritten
120
+		\[
121
+			-v \nabla \cdot \sigma  \nabla u = g v.
122
+		\]
123
+
124
+		\FloatBarrier
125
+	
126
+		\item \FloatBarrier Define mesh. Since $\Omega = (0,\pi)$ is an uncountable subset of $\mathbb{R}^1$ a 
127
+		countable subset of $\Omega$ must be defined. A mesh is defined over the interval $(0,\pi)$.
128
+		This mesh is defined and shown in Figure \ref{fig:mesh}.	
129
+
130
+		\begin{figure}[ht]
131
+		\begin{center}
132
+		\input{chapters/mesh}
133
+		\caption{A 1D FEM mesh is defined. $N$ nodes ($n$) are defined over the interval. Between the 
134
+		nodes an element is defined. The mesh is general and the spacing between nodes is defined by 
135
+		$N-1$ discritisation parameters $h$.}
136
+		\label{fig:mesh}
137
+		\end{center}
138
+		\end{figure}
139
+
140
+		\item Define a finite dimensional subspace based on the mesh and a particular test function.  
141
+		A subspace  $\textgoth{V}_h \subset \textgoth{V}$ is sought such that $ \textgoth{V}_h$ is finite 
142
+		dimensional. 
143
+		Particular linearity independent test functions $\phi$ are defined on $\textgoth{V}_h$ such that 
144
+		$\textgoth{V}_h = \mathrm{span}(\phi_i)$. The test functions form a basis of this space. 
145
+		If the weak formulation of the derivative is used these
146
+		test functions may be constructed such as they are only piecewise differentiable. We may define test 
147
+		functions as Kronecker delta $\delta$ functions taking values of unity at a particular node of the mesh. 		
148
+		The linear spline Galerkin method of FEM interpolates these $\delta$ functions. They are zero valued at the 
149
+		neighbouring nodes. In 1D this interpolation yields hat functions.
150
+		Therefore the test functions  $\phi_i$  are defined as:
151
+
152
+		\begin{equation}
153
+		\phi_i(x) = \left\{ \begin{array}{ccl} 
154
+		0 & \textrm{if}  & x\in[\alpha, x_{i-1}]  \\
155
+		\frac{x - x_{i-1}}{h_i} & \textrm{if}  & x\in[x_{i-1}, x_i]  \\
156
+		\frac{x_{i+1}-x}{h_{i+1}} & \textrm{if}  & x\in[x_i, x_{i+1}]  \\
157
+		0 & \textrm{if}  & x\in[x_{i+1}, \beta ]  \\
158
+		\end{array} \right.
159
+		\end{equation} 
160
+
161
+		Define the variational form of the solution solution 
162
+
163
+		\begin{equation} \label{eq:sol1}
164
+		a(u, v) = <g,v> 
165
+		\end{equation}
166
+
167
+		A is a symmetric bilinear form such that $a(u,v) = a(v,u)   \forall v \in \textgoth{V}_h$.
168
+		
169
+	\end{itemize}
170
+
171
+	In 3D things are a little different. For a given element (tetrahedra) comprised of 4 points we construct the 
172
+	location matrix
173
+	\[ \mathbf{C}  = 
174
+		\left[ \begin{matrix}
175
+			1 & x_1 & y_1 & z_1  \\
176
+			1 & x_2 & y_2 & z_2  \\
177
+			1 & x_3 & y_3 & z_3  \\
178
+			1 & x_4 & y_4 & z_4
179
+		       \end{matrix} \right]
180
+	\]
181
+
182
+	We can then fill the stiffness matrix
183
+	\[
184
+		K_{ij} = \sum_{i=0}^{N} \int_{Tet_k} = c \nabla \phi_i \cdot \phi_j
185
+	\]
186
+
187
+	\item The solution may be written in matrix(stiffness matrix) vector (load vector) notation. 
188
+
189
+	We approximate the solution (Equation \ref{eq:sol1}) using the trial and test functions $\phi$ discussed 
190
+	previously. Let 
191
+	\begin{eqnarray*}
192
+		\sigma(x) &=& x + 1 \\
193
+		u(x) &=& \sin(x) 
194
+	\end{eqnarray*}
195
+
196
+	At each node $u_h \in \textgoth{V}_h : a(u_h, v) = <g,v>$ the stiffness matrix $A$
197
+	\begin{eqnarray*}
198
+		A_{ij} &=& a(\phi_i, \phi_j) = \int_0^\pi \sigma(x) \phi'_i \phi'_j \\
199
+		       &=&  \int_0^\pi (x+1) \phi'_i \phi'_j 
200
+	\end{eqnarray*}
201
+	
202
+	%//Since $\phi$ is a triangle, $\phi'$ becomes a step function.
203
+
204
+	We have for $i= 1,\cdots , n$
205
+	\[
206
+		\phi'(x) = \left\{ \begin{array}{ccl}
207
+			0 & \textrm{if}  & x\in[\alpha, x_{i-1}]  \\
208
+			\frac{1}{h_i} & \textrm{if}  & x\in[x_{i-1}, x_i]  \\
209
+			-\frac{1}{h_{i+1}} & \textrm{if}  & x\in[x_i, x_{i+1}]  \\
210
+			0 & \textrm{if}  & x\in[x_{i+1}, \beta ]  \\
211
+		\end{array} \right.
212
+	\]
213
+
214
+	The product $\phi_i'(x) \phi_j(x)$ vanishes when $|i - j| > 1$. So that in a 1D case, A becomes tri-diagonal. 
215
+	Following the general equation:
216
+	\begin{eqnarray*}
217
+		A_{ij} &=&  \int_{i-1}^{i+1} (x+1) \phi'_i(x) \phi'_j(x) \\ 
218
+	\end{eqnarray*}
219
+
220
+	The load vector $g$ is given:
221
+	\[
222
+		[g]_i = <g, \phi_i> = \int_0^\pi g \phi_i
223
+	\]
224
+
225
+	Using $ g = [g]$, the linear system becomes:
226
+	\[
227
+		Au = g
228
+	\]
229
+
230
+	\item For this case the entries of the stiffness matrix  and load vector are
231
+	
232
+	For the three non-zero cases of $A$:
233
+	\begin{eqnarray*}
234
+		A_{ii} &=&  \int_{i-1}^{i+1} (x+1) \phi'_i(x) \phi'_i(x) \\ 
235
+		A_{ii} &=& \int_{{i-1}}^{i} (x+1) \phi_i'^2 dx + \int_{i}^{x_{i+1}} (x+1)\phi_i'^2 \\ 
236
+		A_{ii} &=& \frac{1}{h_i^2}\int_{{i-1}}^{i} (x+1)  dx + \frac{1}{h_{i+1}^2} \int_{i}^{{i+1}} (x+1) dx 
237
+	\end{eqnarray*}
238
+
239
+	\begin{eqnarray*}
240
+		A_{i,i+1} &=& \int_{i}^{i+1} (x+1) \phi'_i(x) \phi'_{i+1}(x) \\ 
241
+		A_{i,i+1} &=& \int_{i}^{i+1} (x+1) \phi_i' \phi_{i+1}' dx \\ %+ \int_{i}^{x_{i+1}} (x+1)\phi_i' \phi_{i+1}'  \\ 
242
+		A_{i,i+1} &=& \frac{1}{h_i + h_{i+1}}\int_{i}^{i+1} (x+1)  dx %+ \frac{1}{h_{i+1}^2} \int_{i}^{{i+1}} (x+1) dx 
243
+	\end{eqnarray*}
244
+
245
+	\begin{eqnarray*}
246
+		A_{i,i-1} &=&  \int_{i-1}^{i} (x+1) \phi'_i(x) \phi'_{i-1}(x) \\ 
247
+		A_{i,i-1} &=&  \int_{i-1}^{i} (x+1) \phi_i' \phi_{i-1}' dx \\%+ \int_{i}^{x_{i+1}} (x+1)\phi_i' \phi_{i-1}' \\ 
248
+		A_{i,i-1} &=& \frac{1}{h_i + h_{i-1}}\int_{{i-1}}^{i} (x+1) dx % dx + \frac{1}{h_{i+1}^2} \int_{i}^{{i+1}} (x+1) dx 
249
+	\end{eqnarray*}
250
+	
251
+	These integrals are evaluated numerically in my program \textit{gfemddn} using Simpson's Rule.
252
+
253
+	Solving for the forcing function $g$ in  \autoref{eq:scheme}
254
+	\begin{eqnarray*}
255
+		-\nabla \cdot \sigma(x) \nabla u(x) &=& g(x) \\
256
+		-\frac{\partial}{\partial x} \cdot (x+1) \frac{\partial }{\partial x} \sin(x) &=& g(x) \\
257
+		-\frac{\partial}{\partial x} \cdot (x+1) \cos(x) &=& g(x) \\
258
+		 \sin(x) + x\sin(x) - \cos(x) &=& g(x) \\
259
+		 \sin(x) (x+1) - \cos(x) &=& g(x) \\
260
+	\end{eqnarray*}	 
261
+
262
+	The load vector $g$ is then:
263
+	\[
264
+		g_i = <g, \phi_i> = \int_0^\pi \left(  \sin(x) (x+1) - \cos(x) \right) \phi_i
265
+	\]
266
+	In \textit{gfemddn} this integral is again evaluated using Simpson's Rule.
267
+
268
+	\end{enumerate}
269
+

+ 58
- 0
dox/chapters/examples.tex View File

@@ -0,0 +1,58 @@
1
+\chapter{Examples and Verification}
2
+
3
+\section{Coulombic Magnetic Potential}
4
+		In the absence of external current densities, we may write $\nabla \times \mathbf{H} = 0$.
5
+		This allows the $H$ field to be represented using a scalar potential term  
6
+		\begin{align} 
7
+			\mathbf{H} = \nabla \phi_M.
8
+		\end{align}
9
+		Static magnetics problems (in linear media) can be solved using a scalar potential term obeying the 
10
+		following relationship \cite[e.g.,][]{Jackson1998}
11
+		\begin{align} \label{eq:permMagnet}
12
+			%-\nabla \cdot \mu(\mathbf{r}) \nabla \phi_M(\mathbf{r}) = \mu(\mathbf{r}) M_0(\mathbf{r}).
13
+			-\LAPL{\phi_M} = \rho_M(\mathbf{r}).
14
+		\end{align}
15
+		Where $\phi_M$ represents the Coulomb magnetic potential (appropriate for static magnetics problems) 
16
+		and $\rho_M$ is the effective magnetic charge density (=$\nabla \cdot \mathbf{M}$).
17
+		This formulation is particularity useful in calculating the fields of permanent magnets, where the 
18
+		magnetisation of the magnet is given by $\mathbf{M}(\mathbf{r})$.
19
+		The left hand side of (\ref{eq:permMagnet}) can easily be solved using {\bf{FEM4EllipticPDE}}, however 
20
+		the right hand side requires some special care. 
21
+
22
+	\subsection{Calculation of Charge Density}
23
+		For uniformly magnetised media $\rho_M$ vanishes everywhere except at the boundaries of the magnet.  
24
+		In truth, $\mathbf{M}$ is well behaved and there are no truly uniformly magnetized magnets, but the 
25
+		true nature of $\mathbf{M}$ is rarely known, and the assumption of uniform magnetisation becomes necessary. 
26
+		Practical permanent magnets are \emph{effectively} uniformly magnetised, and this assumption is completely 
27
+		reasonable, and even necessary. 
28
+
29
+		We can therefore apply the divergence theorem to to the boundaries to calculate the surface charge density
30
+		$\sigma_M = \hat{\mathbf{n}} \cdot \mathbf{M}$ which exists on the 2D surface of the media and has zero 
31
+		Riemann measure, formally necessitating a Lebesgue integral. 
32
+		We may then let $\rho_M \rightarrow \sigma_M$ in 
33
+		(\ref{eq:permMagnet}). 
34
+		The FEM variational formulation for an particular element in the load vector $g$ that spans 
35
+		the boundary of the media at point $\mathbf{r}_0$  can be written
36
+		\begin{align}
37
+			[g]_i & = \left< \rho_M, \phi_i \right> = \int \rho_M \phi_i \\
38
+			      %//& = \int_L \delta\{\hat{\mathbf{r}_0}\} \sigma_M \phi_i \\ 
39
+			      & = \int_L \sigma_M \phi_i \\ 
40
+			      & = \sigma_M \phi_i(\mathbf{r}_0). 
41
+		\end{align}
42
+
43
+	\subsection{Uniformly Charged Sphere}
44
+	The scalar potential of a uniformly charged sphere is given \cite[p. 198, ][]{Jackson1998} 
45
+	\begin{align}
46
+		\phi_M(\rho, \theta) = \frac{1}{3} M_0 a^2 \frac{r_<}{r_>^2} \cos(\theta).
47
+	\end{align}
48
+	Where the notation $r_<, r_>$ represents the smaller or larger of the distance $\rho$ and sphere radius $a$.
49
+
50
+	Inside the sphere
51
+	\begin{align}
52
+		%\phi_M &= \frac{1}{3} M_0 \rho \cos \theta  & \text{inside the sphere} \\
53
+		\phi_M &= \frac{1}{3} M_0 z  & \text{inside the sphere} \\
54
+		\phi_M &= \frac{1}{3} M_0 a^3 \frac{\cos \theta}{\rho^2}  & \text{outside the sphere} 
55
+	\end{align}
56
+	
57
+
58
+ 

+ 9
- 0
dox/chapters/magnetics.tex View File

@@ -0,0 +1,9 @@
1
+\chapter{Magnetics}
2
+
3
+\section{Linear approximation}
4
+
5
+Linear induced magnetism. For low values of $\kappa$, the induced field can be approximated. For higher suceptibilities for for 
6
+remanance furthur corrections are needed, see section \
7
+\[
8
+	\nabla^2 u = \nabla \cdot \kappa \mathbf{H}
9
+\]

+ 189
- 0
dox/chapters/mesh.tex View File

@@ -0,0 +1,189 @@
1
+% Graphic for TeX using PGF
2
+% Title: /home/tirons/CGEM/tirons/Class/npde/ass2/report/mesh.dia
3
+% Creator: Dia v0.96.1
4
+% CreationDate: Sun Mar 29 11:45:22 2009
5
+% For: tirons
6
+% \usepackage{tikz}
7
+% The following commands are not supported in PSTricks at present
8
+% We define them conditionally, so when they are implemented,
9
+% this pgf file will use them.
10
+\ifx\du\undefined
11
+  \newlength{\du}
12
+\fi
13
+\setlength{\du}{15\unitlength}
14
+\begin{tikzpicture}
15
+\pgftransformxscale{1.000000}
16
+\pgftransformyscale{-1.000000}
17
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
18
+\pgfsetstrokecolor{dialinecolor}
19
+\definecolor{dialinecolor}{rgb}{1.000000, 1.000000, 1.000000}
20
+\pgfsetfillcolor{dialinecolor}
21
+\pgfsetlinewidth{0.100000\du}
22
+\pgfsetdash{}{0pt}
23
+\pgfsetdash{}{0pt}
24
+\pgfsetbuttcap
25
+{
26
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
27
+\pgfsetfillcolor{dialinecolor}
28
+% was here!!!
29
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
30
+\pgfsetstrokecolor{dialinecolor}
31
+\draw (12.012500\du,10.037500\du)--(27.337500\du,10.062500\du);
32
+}
33
+% setfont left to latex
34
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
35
+\pgfsetstrokecolor{dialinecolor}
36
+\node[anchor=west] at (11.712500\du,12.537500\du){0};
37
+% setfont left to latex
38
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
39
+\pgfsetstrokecolor{dialinecolor}
40
+\node[anchor=west] at (26.820000\du,12.410000\du){$\pi$};
41
+\pgfsetlinewidth{0.100000\du}
42
+\pgfsetdash{}{0pt}
43
+\pgfsetdash{}{0pt}
44
+\pgfsetbuttcap
45
+{
46
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
47
+\pgfsetfillcolor{dialinecolor}
48
+% was here!!!
49
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
50
+\pgfsetstrokecolor{dialinecolor}
51
+\draw (13.270437\du,9.662500\du)--(13.295437\du,10.474332\du);
52
+}
53
+\pgfsetlinewidth{0.100000\du}
54
+\pgfsetdash{}{0pt}
55
+\pgfsetdash{}{0pt}
56
+\pgfsetbuttcap
57
+{
58
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
59
+\pgfsetfillcolor{dialinecolor}
60
+% was here!!!
61
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
62
+\pgfsetstrokecolor{dialinecolor}
63
+\draw (12.056953\du,9.640847\du)--(12.032938\du,11.749332\du);
64
+}
65
+\pgfsetlinewidth{0.100000\du}
66
+\pgfsetdash{}{0pt}
67
+\pgfsetdash{}{0pt}
68
+\pgfsetbuttcap
69
+{
70
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
71
+\pgfsetfillcolor{dialinecolor}
72
+% was here!!!
73
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
74
+\pgfsetstrokecolor{dialinecolor}
75
+\draw (14.981953\du,9.665847\du)--(15.006953\du,10.477678\du);
76
+}
77
+\pgfsetlinewidth{0.100000\du}
78
+\pgfsetdash{}{0pt}
79
+\pgfsetdash{}{0pt}
80
+\pgfsetbuttcap
81
+{
82
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
83
+\pgfsetfillcolor{dialinecolor}
84
+% was here!!!
85
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
86
+\pgfsetstrokecolor{dialinecolor}
87
+\draw (17.016953\du,9.680847\du)--(17.041953\du,10.492678\du);
88
+}
89
+\pgfsetlinewidth{0.100000\du}
90
+\pgfsetdash{}{0pt}
91
+\pgfsetdash{}{0pt}
92
+\pgfsetbuttcap
93
+{
94
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
95
+\pgfsetfillcolor{dialinecolor}
96
+% was here!!!
97
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
98
+\pgfsetstrokecolor{dialinecolor}
99
+\draw (18.026953\du,9.670847\du)--(18.051953\du,10.482678\du);
100
+}
101
+\pgfsetlinewidth{0.100000\du}
102
+\pgfsetdash{}{0pt}
103
+\pgfsetdash{}{0pt}
104
+\pgfsetbuttcap
105
+{
106
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
107
+\pgfsetfillcolor{dialinecolor}
108
+% was here!!!
109
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
110
+\pgfsetstrokecolor{dialinecolor}
111
+\draw (18.986953\du,9.660847\du)--(19.011953\du,10.472678\du);
112
+}
113
+\pgfsetlinewidth{0.100000\du}
114
+\pgfsetdash{}{0pt}
115
+\pgfsetdash{}{0pt}
116
+\pgfsetbuttcap
117
+{
118
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
119
+\pgfsetfillcolor{dialinecolor}
120
+% was here!!!
121
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
122
+\pgfsetstrokecolor{dialinecolor}
123
+\draw (20.971953\du,9.700847\du)--(20.996953\du,10.512678\du);
124
+}
125
+\pgfsetlinewidth{0.100000\du}
126
+\pgfsetdash{}{0pt}
127
+\pgfsetdash{}{0pt}
128
+\pgfsetbuttcap
129
+{
130
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
131
+\pgfsetfillcolor{dialinecolor}
132
+% was here!!!
133
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
134
+\pgfsetstrokecolor{dialinecolor}
135
+\draw (27.356953\du,9.665847\du)--(27.357938\du,11.724332\du);
136
+}
137
+\pgfsetlinewidth{0.100000\du}
138
+\pgfsetdash{}{0pt}
139
+\pgfsetdash{}{0pt}
140
+\pgfsetbuttcap
141
+{
142
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
143
+\pgfsetfillcolor{dialinecolor}
144
+% was here!!!
145
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
146
+\pgfsetstrokecolor{dialinecolor}
147
+\draw (24.216953\du,9.680847\du)--(24.241953\du,10.492678\du);
148
+}
149
+% setfont left to latex
150
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
151
+\pgfsetstrokecolor{dialinecolor}
152
+\node[anchor=west] at (11.445438\du,9.274332\du){$n_0$};
153
+% setfont left to latex
154
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
155
+\pgfsetstrokecolor{dialinecolor}
156
+\node[anchor=west] at (12.817938\du,9.306832\du){$n_1$};
157
+% setfont left to latex
158
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
159
+\pgfsetstrokecolor{dialinecolor}
160
+\node[anchor=west] at (14.602938\du,9.346832\du){$n_2$};
161
+% setfont left to latex
162
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
163
+\pgfsetstrokecolor{dialinecolor}
164
+\node[anchor=west] at (16.567938\du,9.306832\du){$n_3$};
165
+% setfont left to latex
166
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
167
+\pgfsetstrokecolor{dialinecolor}
168
+\node[anchor=west] at (26.967938\du,9.231832\du){$n_N$};
169
+% setfont left to latex
170
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
171
+\pgfsetstrokecolor{dialinecolor}
172
+\node[anchor=west] at (12.282938\du,10.974332\du){$h_0$};
173
+% setfont left to latex
174
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
175
+\pgfsetstrokecolor{dialinecolor}
176
+\node[anchor=west] at (13.542938\du,11.006832\du){$h_1$};
177
+% setfont left to latex
178
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
179
+\pgfsetstrokecolor{dialinecolor}
180
+\node[anchor=west] at (15.377938\du,10.971832\du){$h_2$};
181
+% setfont left to latex
182
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
183
+\pgfsetstrokecolor{dialinecolor}
184
+\node[anchor=west] at (17.017938\du,10.981832\du){$h_3$};
185
+% setfont left to latex
186
+\definecolor{dialinecolor}{rgb}{0.000000, 0.000000, 0.000000}
187
+\pgfsetstrokecolor{dialinecolor}
188
+\node[anchor=west] at (25.202938\du,11.121832\du){$h_{N-1}$};
189
+\end{tikzpicture}

+ 5
- 0
dox/chapters/usage.tex View File

@@ -0,0 +1,5 @@
1
+\chapter{Usage}
2
+
3
+The main resource for using FEM4EllipticPDE is the Doxygen generated man pages. However, in this document 
4
+a more high level, simplified and incomplete, but also practical description of the API is presented for 
5
+those just wanting to use, and not extend the module. 

+ 43
- 42
examples/magnet/toroid.geo View File

@@ -20,14 +20,39 @@
20 20
 radius = 3.25;   // Radius of the damn thing
21 21
 blc = radius/2;  //  0.25;   // Target element size
22 22
 Box = 3*radius;  // The down side of potential
23
-lc = radius/2;        // toroid characteristic length
23
+lc = radius/10;        // toroid characteristic length
24 24
 
25
-
26
-tpp = newp;
27 25
 ts = 1;         // height of toroid
28 26
 tx = radius;  // radial width of toroid, measured in centre of ring
29 27
 tl = 0;         // centre of rotation
30 28
 
29
+// Total Solution Space
30
+X0 = -Box;
31
+X1 =  Box;
32
+Y0 = -Box;
33
+Y1 =  Box;
34
+Z0 = -Box;
35
+Z1 =  Box;
36
+/////////////////////////////////////
37
+// Large Bounding box
38
+pp = newp;
39
+Point(pp)    = {X0, Y0, Z0, blc};
40
+Point(pp+1)  = {X1, Y0, Z0, blc};
41
+Point(pp+2)  = {X1, Y1, Z0, blc};
42
+Point(pp+3)  = {X0, Y1, Z0, blc};
43
+
44
+lv = newl;
45
+Line(lv) = {pp,pp+1};
46
+Line(lv+1) = {pp+1,pp+2};
47
+Line(lv+2) = {pp+2,pp+3};
48
+Line(lv+3) = {pp+3,pp};
49
+Line Loop(lv+4) = {lv, lv+1, lv+2, lv+3};
50
+
51
+bs = news;
52
+Plane Surface(bs) = {lv+4};
53
+v[] = Extrude {0, 0, Z1-Z0} { Surface{bs}; };
54
+
55
+tpp = newp;
31 56
 Point(tpp  ) = {    tx,    0, 0,  lc};
32 57
 Point(tpp+1) = { ts+tx,    0, 0,  lc};
33 58
 Point(tpp+2) = {    tx,   ts, 0,  lc};
@@ -42,20 +67,23 @@ Circle(cc+3) = {tpp+3, tpp, tpp+1};
42 67
 
43 68
 ll = newll;
44 69
 Line Loop(ll) = {cc, cc+1, cc+2, cc+3};
70
+rs = news;
71
+Ruled Surface (rs) = {ll};
72
+//Surface Loop(rs) = {ll};
45 73
 
46 74
 ps = news;
47
-pio2=Pi/2;
48 75
 Plane Surface(ps) = {ll};
76
+
49 77
 tv1[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{ps}; };
50
-tv2[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{28}; };
51
-tv3[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{50}; };
52
-//t1[] = Rotate {{0,0,1},{0,0,0},pio2  } {Duplicata{Surface{ps};}};
53
-//Extrude Surface {ps, {0,1,0}, {-tl,0,0}, 2*Pi/3} { Recombine ;};
78
+//tv2[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{28}; };
79
+//tv3[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{50}; };
80
+//Extrude Surface {ps, {0,1,0}, {-tl,0,0}, 2*Pi/3};// { Recombine ;};
54 81
 //Extrude Surface {28, {0,1,0}, {-tl,0,0}, 2*Pi/3}; //{Layers{10,73,1};};
55 82
 //Extrude Surface {50, {0,1,0}, {-tl,0,0}, 2*Pi/3}; //{Layers{10,73,1};};
56 83
 
84
+
57 85
 /* Make a list of a ring (annulus) of surfaces around the hole */
58
-allParts[] = {tv1[0], tv2[0], tv3[0]};
86
+//allParts[] = {tv1[1], tv2[1], tv3[1]};
59 87
 
60 88
 /* Make surfaces to be meshed by transfinite algorithm */
61 89
 //Transfinite Surface {allParts[]};
@@ -63,43 +91,16 @@ allParts[] = {tv1[0], tv2[0], tv3[0]};
63 91
 /* The "Recombine Surface" command is issued in order to
64 92
  * crate quadrilateral elements.
65 93
  */
66
-//Recombine Surface {allParts[]};
94
+//Recombine
95
+//Surface {allParts[1]};
67 96
 
68 97
 // Extrude Surface {12, {0,0,1}, {0,0,0}, 2*Pi/3} {
69 98
 //   Recombine ; Layers { 6, 54, 1 } ;
70 99
 // } ;
71 100
 
72
-// Total Solution Space
73
-X0 = -Box;
74
-X1 =  Box;
75
-Y0 = -Box;
76
-Y1 =  Box;
77
-Z0 = -Box;
78
-Z1 =  Box;
79
-/////////////////////////////////////
80
-// Large Bounding box
81
-pp = newp;
82
-Point(pp)    = {X0, Y0, Z0, blc};
83
-Point(pp+1)  = {X1, Y0, Z0, blc};
84
-Point(pp+2)  = {X1, Y1, Z0, blc};
85
-Point(pp+3)  = {X0, Y1, Z0, blc};
86
-//
87
-lv = newl;
88
-Line(lv) = {pp,pp+1};
89
-Line(lv+1) = {pp+1,pp+2};
90
-Line(lv+2) = {pp+2,pp+3};
91
-Line(lv+3) = {pp+3,pp};
92
-Line Loop(lv+4) = {lv, lv+1, lv+2, lv+3};
93
-//
94
-// Hard coded doom
95
-bs = news;
96
-Plane Surface(bs) = {lv+4};
97
-//
98
-//v = newv;
99
-v[] = Extrude {0, 0, Z1-Z0} { Surface{bs}; };
100 101
 
101
-/* This is GOOD */
102
-Surface{ allParts } In Volume{v[1]};
103
-//Surface{t1[0]} In Volume{v[1]};
104
-//Surface{t2[0]} In Volume{v[1]};
102
+//Surface{ ll+1 } In Volume{v[1]};
103
+//Surface{cc} In Volume{v[1]};
104
+Surface{tv1[0]} In Volume{v[1]};
105 105
 //Surface{t3[0]} In Volume{v[1]};
106
+Physical Volume(1) = {v[1]};

Loading…
Cancel
Save