/[escript]/trunk/doc/cookbook/example10.tex
ViewVC logotype

Diff of /trunk/doc/cookbook/example10.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5661 by jfenwick, Fri Apr 24 01:36:26 2015 UTC revision 5662 by caltinay, Thu Jun 18 04:40:34 2015 UTC
# Line 19  In this chapter the gravitational potent Line 19  In this chapter the gravitational potent
19  Gravitational fields are present in many modelling scenarios, including  Gravitational fields are present in many modelling scenarios, including
20  geophysical investigations, planetary motion and attraction and micro-particle  geophysical investigations, planetary motion and attraction and micro-particle
21  interactions. Gravitational fields also present an opportunity to demonstrate  interactions. Gravitational fields also present an opportunity to demonstrate
22  the saving and visualisation of vector data for Mayavi, and the construction of  the saving and visualisation of vector data for \mayavi, and the construction of
23  variable sized meshes.  variable sized meshes.
24    
25  The gravitational potential $U$ at a point $P$ due to a region with a mass  The gravitational potential $U$ at a point $P$ due to a region with a mass
# Line 93  ser to \verb!r=0.0!. This is a Dirichlet Line 93  ser to \verb!r=0.0!. This is a Dirichlet
93  \sslist{example10a.py}  \sslist{example10a.py}
94  A gravity pole is used in this example to demonstrate the vector characteristics  A gravity pole is used in this example to demonstrate the vector characteristics
95  of gravity, and also to demonstrate how this information can be exported for  of gravity, and also to demonstrate how this information can be exported for
96  visualisation to Mayavi or an equivalent using the VTK data format.  visualisation to \mayavi or an equivalent using the VTK data format.
97    
98  The solution script for this section is very simple. First the domain is  The solution script for this section is very simple. First the domain is
99  constructed, then the parameters of the model are set, and finally the steady  constructed, then the parameters of the model are set, and finally the steady
# Line 127  saveVTK(os.path.join(save_path,"ex10a.vt Line 127  saveVTK(os.path.join(save_path,"ex10a.vt
127          grav_pot=sol,g_field=g_field,g_fieldz=g_fieldz,gz=gz)          grav_pot=sol,g_field=g_field,g_fieldz=g_fieldz,gz=gz)
128  \end{python}  \end{python}
129    
130  It is quite simple to visualise the data from the gravity solution in Mayavi2.  It is quite simple to visualise the data from the gravity solution in \mayavi.
131  With Mayavi2 open go to File, Load data, Open file \ldots as in  With \mayavi open go to File, Load data, Open file \ldots as in
132  \autoref{fig:mayavi2openfile} and select the saved data file. The data will  \autoref{fig:mayavi2openfile} and select the saved data file. The data will
133  have then been loaded and is ready for visualisation. Notice that under the data  have then been loaded and is ready for visualisation. Notice that under the data
134  object in the Mayavi2 navigation tree the 4 values saved to the VTK file are  object in the \mayavi navigation tree the 4 values saved to the VTK file are
135  available (\autoref{fig:mayavi2data}). There are two vector values,  available (\autoref{fig:mayavi2data}). There are two vector values,
136  \verb|gfield| and \verb|gfieldz|. Note that to plot both of these on the same  \verb|gfield| and \verb|gfieldz|. Note that to plot both of these on the same
137  chart requires that the data object be imported twice.  chart requires that the data object be imported twice.
# Line 149  potential and gravitational field vector Line 149  potential and gravitational field vector
149  \begin{figure}[ht]  \begin{figure}[ht]
150  \centering  \centering
151  \includegraphics[width=0.75\textwidth]{figures/mayavi2_openfile.png}  \includegraphics[width=0.75\textwidth]{figures/mayavi2_openfile.png}
152  \caption{Open a file in Mayavi2}  \caption{Open a file in \mayavi}
153  \label{fig:mayavi2openfile}  \label{fig:mayavi2openfile}
154  \end{figure}  \end{figure}
155    

Legend:
Removed from v.5661  
changed lines
  Added in v.5662

  ViewVC Help
Powered by ViewVC 1.1.26