~ubuntu-branches/ubuntu/trusty/rheolef/trusty

« back to all changes in this revision

Viewing changes to doc/pusrman/neumann-nh.tex

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%---------------------------------------------------------------------------------
 
2
\section{Non-homogeneous Neumann boundary conditions for the Helmholtz operator}
 
3
%---------------------------------------------------------------------------------
 
4
\label{sec-neummann-nh}
 
5
\bcindex{Neumann}%
 
6
\pbindex{Helmholtz}%
 
7
\cindex{operator!Helmholtz}%
 
8
 
 
9
\subsection*{Formulation}
 
10
  Let us show how to insert Neumann boundary conditions.
 
11
  Let $f \in H^{-1}(\Omega)$ and
 
12
  $g \in H^{-\frac{1}{2}}(\partial \Omega)$.
 
13
  The problem writes:
 
14
 
 
15
  $(P_3)$: {\it find $u$, defined in $\Omega$ such that:}
 
16
  \begin{eqnarray*}
 
17
      u -\Delta u &=& f \ {\rm in}\ \Omega \\
 
18
      \Frac{\partial u}{ \partial n} &=& g \ {\rm on}\ \partial \Omega
 
19
  \end{eqnarray*}
 
20
  The variational formulation of this problem expresses:
 
21
 
 
22
  $(VF_3)$: {\it find $u \in H^1(\Omega)$ such that:}
 
23
  $$
 
24
    a(u,v) = l(v), \ \forall v \in H^1(\Omega)
 
25
  $$
 
26
  where
 
27
  \begin{eqnarray*}
 
28
    a(u,v) &=& \int_\Omega u\,v \, {\rm d}x + \int_\Omega \nabla u . \nabla v \, {\rm d}x \\
 
29
    l(v) &=& \int_\Omega f\, v \, {\rm d}x + \int_{\partial \Omega} g \, v \, {\rm d}s
 
30
  \end{eqnarray*}
 
31
 
 
32
\subsection*{Approximation}
 
33
\cindex{Lagrange!interpolation}
 
34
  As usual, we introduce a mesh ${\cal T}_h$ of $\Omega$
 
35
  and the finite dimensional space $X_h$:
 
36
  $$
 
37
      X_h = \{ v \in H^1(\Omega); \
 
38
          v_{/K} \in P_k, \
 
39
          \forall K \in {\cal T}_h \}
 
40
  $$
 
41
  The approximate problem writes:
 
42
 
 
43
  {\it $(VF_3)_h$: find $u_h\in X_h$ such that:}
 
44
  $$
 
45
      a(u_h,v_h) = l(v_h),
 
46
      \ \forall v_h \in X_h
 
47
  $$
 
48
 
 
49
\subsection*{File \file{neumann-nh.cc}}
 
50
  \exindex{neumann-nh.cc}
 
51
  \myexample{neumann-nh.cc}
 
52
 
 
53
  Let us choose $\Omega \subset R^d$, $d=1,2,3$ and
 
54
  \begin{eqnarray*}
 
55
      f(x) &=& (1+d\pi^2) \prod_{i=0}^{d-1} \sin(\pi x_i) \\
 
56
      g(x) &=& \left\{
 
57
        \begin{array}{ll}
 
58
                -\pi    & \mbox{ when } d = 1 \\
 
59
                -\pi\left( {\displaystyle \sum_{i=0}^{d-1} \sin(\pi x_i)}\right)
 
60
                        & \mbox{ when } d = 2 \\
 
61
                -\pi\left( {\displaystyle \sum_{i=0}^{d-1} \sin(\pi x_i)} \sin(x_{(i+1){\rm mod}\,d}\right)
 
62
                        & \mbox{ when } d = 3
 
63
        \end{array}
 
64
        \right.
 
65
  \end{eqnarray*}
 
66
  This example is convenient, since
 
67
  the exact solution is known:
 
68
  \[
 
69
        u(x) = \prod_{i=0}^{d-1} \sin(\pi x_i)
 
70
  \]
 
71
\subsection*{File \file{sinusprod\_helmholtz.icc}}
 
72
  \exindex{sinusprod\_helmholtz.icc}
 
73
  \myexample{sinusprod_helmholtz.icc}
 
74
 
 
75
 
 
76
\subsection*{Comments}
 
77
  The {\tt neumann-nh.cc}
 
78
  code looks like the previous one {\tt dirichlet-nh.cc}.
 
79
  Let us comments only the changes.
 
80
  \begin{lstlisting}[numbers=none,frame=none]
 
81
    form m (Xh, Xh, "mass");
 
82
    form a (Xh, Xh, "grad_grad");
 
83
  \end{lstlisting}
 
84
  The bilinear forms $m(.,.)$ and $a(.,.)$, also called the {\em mass} and 
 
85
  {\em energy} in mechanics, are defined as:
 
86
  \[
 
87
    m(u,v) = \int_\Omega u\,v \, {\rm d}x
 
88
        \ \ \mbox{ and }\ \ 
 
89
    a(u,v) = \int_\Omega \nabla u . \nabla v \, {\rm d}x
 
90
  \]
 
91
  Then, these two forms are added and stored in $a$:
 
92
  \begin{lstlisting}[numbers=none,frame=none]
 
93
    a = m + a;
 
94
  \end{lstlisting}
 
95
  The right-hand side is computed as:
 
96
  \begin{lstlisting}[numbers=none,frame=none]
 
97
    field lh = riesz(Xh, f(d)) + riesz(Xh, "boundary", g(d));
 
98
  \end{lstlisting}
 
99
 
 
100
\subsection{How to run the program}
 
101
 
 
102
  First, compile the program:
 
103
    \begin{verbatim}
 
104
          make neumann-nh
 
105
    \end{verbatim}
 
106
  Running the program is obtained from the homogeneous Dirichlet case,
 
107
  by replacing \code{dirichlet} by \code{neumann-nh}.
 
108
 
 
109
%\vfill