 # Diff of /release/4.0/doc/cookbook/example07.tex

revision 3025 by ahallam, Thu May 6 01:20:46 2010 UTC revision 3029 by ahallam, Fri May 21 02:01:37 2010 UTC
# Line 30  The Laplacian opperator which can be wri Line 30  The Laplacian opperator which can be wri
30  calculated via the divergence of the gradient of the object, which is in this  calculated via the divergence of the gradient of the object, which is in this
31  example $p$. Thus we can write;  example $p$. Thus we can write;
32  \begin{equation}  \begin{equation}
33   \nabla^2 p = \nabla \cdot \nabla p = \frac{\partial^2 p}{\partial   \nabla^2 p = \nabla \cdot \nabla p =
34  x^2\hackscore{i}}      \sum\hackscore{i}^n
35        \frac{\partial^2 p}{\partial x^2\hackscore{i}}
36   \label{eqn:laplacian}   \label{eqn:laplacian}
37  \end{equation}  \end{equation}
38  For the two dimensional case in Cartesian coordinates \refEq{eqn:laplacian}  For the two dimensional case in Cartesian coordinates \refEq{eqn:laplacian}
# Line 66  pressure field which acts in the directi Line 67  pressure field which acts in the directi
67  \end{equation}  \end{equation}
68
69  \refEq{eqn:grad} corresponds to the Linear PDE general form value  \refEq{eqn:grad} corresponds to the Linear PDE general form value
70  $X$. Notice however that the gernal form contains the term $X \hackscore{i,j}$,  $X$. Notice however that the general form contains the term $X 71 \hackscore{i,j}$\footnote{This is the first derivative in the $j^{th}$
72    direction for the $i^{th}$ component of the solution.},
73  hence for a rank 0 object there is no need to do more than calculate the  hence for a rank 0 object there is no need to do more than calculate the
74  gradient and submit it to the solver. In the case of the rank 1 or greater  gradient and submit it to the solver. In the case of the rank 1 or greater
75  object, it is nesscary to calculate the trace also. This is the sum of the  object, it is nesscary to calculate the trace also. This is the sum of the
# Line 134  problems. Line 137  problems.
137  This requirement makes the wave equation arduous to  This requirement makes the wave equation arduous to
138  solve numerically due to the large number of time iterations required in each  solve numerically due to the large number of time iterations required in each
139  solution. Models with very high velocities and frequencies will be the worst  solution. Models with very high velocities and frequencies will be the worst
140  effected by this problem.  affected by this problem.
141
142  \section{Displacement Solution}  \section{Displacement Solution}
143  \sslist{example07a.py}  \sslist{example07a.py}
235  pl.savefig(os.path.join(savepath,"source_line.png"))  pl.savefig(os.path.join(savepath,"source_line.png"))
236  \end{python}  \end{python}
237  \begin{figure}[h]  \begin{figure}[h]
238   \includegraphics[width=5in]{figures/sourceline.png}   \centering
239     \includegraphics[width=6in]{figures/sourceline.png}
240   \caption{Cross section of the source function.}   \caption{Cross section of the source function.}
241   \label{fig:cxsource}   \label{fig:cxsource}
242  \end{figure}  \end{figure}
# Line 245  function. Line 249  function.
249  \begin{python}  \begin{python}
250   rec=Locator(mydomain,[250.,250.])   rec=Locator(mydomain,[250.,250.])
251  \end{python}  \end{python}
252   When the solution \verb u  is update we can extract the value at that point   When the solution \verb u  is updated we can extract the value at that point
253  via;  via;
254  \begin{python}  \begin{python}
255   u_rec=rec.getValue(u)   u_rec=rec.getValue(u)
# Line 265  the \verb Locator  function. Line 269  the \verb Locator  function.
269  \sslist{example07b.py}  \sslist{example07b.py}
270
271  An alternative method is to solve for the acceleration $\frac{\partial ^2 An alternative method is to solve for the acceleration$\frac{\partial ^2
272  p}{\partial t^2}$directly, and derive the the displacement solution from the p}{\partial t^2}$ directly, and derive the displacement solution from the
273  PDE solution. \refEq{eqn:waveu} is thus modified;  PDE solution. \refEq{eqn:waveu} is thus modified;
274  \begin{equation}  \begin{equation}
275    \nabla ^2 p - \frac{1}{c^2} a = 0    \nabla ^2 p - \frac{1}{c^2} a = 0
# Line 277  After each iteration the displacement is Line 281  After each iteration the displacement is
281   p\hackscore{(t+1)}=2p\hackscore{(t)} - p\hackscore{(t-1)} + h^2a   p\hackscore{(t+1)}=2p\hackscore{(t)} - p\hackscore{(t-1)} + h^2a
282  \end{equation}  \end{equation}
283
284    \subsection{Lumping}
285  For \esc, the acceleration solution is prefered as it allows the use of matrix  For \esc, the acceleration solution is prefered as it allows the use of matrix
286  lumping. Lumping or mass lumping as it is sometimes known, is the process of  lumping. Lumping or mass lumping as it is sometimes known, is the process of
287  aggressively approximating the density elements of a mass matrix into the main  aggressively approximating the density elements of a mass matrix into the main
288  diagonal. The use of Lumping is motivaed by the simplicity of diagonal matrix  diagonal. The use of Lumping is motivaed by the simplicity of diagonal matrix
289   inversion. As a result, Lumping can significantly reduce the computational   inversion. As a result, Lumping can significantly reduce the computational
290  requirements of a problem.  requirements of a problem. Care should be taken however, as this
291    function can only be used when the $A$, $B$ and $C$ coefficients of the
292    general form are zero.
293
294  To turn lumping on in \esc one can use the command;  To turn lumping on in \esc one can use the command;
295  \begin{python}  \begin{python}

Legend:
 Removed from v.3025 changed lines Added in v.3029