1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 99.2beta8 (1.46)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>6.13 Plotting of vector fields</TITLE>
<META NAME="description" CONTENT="6.13 Plotting of vector fields">
<META NAME="keywords" CONTENT="GMT_Docs">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="GMT_Docs.css">
<LINK REL="next" HREF="node87.html">
<LINK REL="previous" HREF="node85.html">
<LINK REL="up" HREF="node73.html">
<LINK REL="next" HREF="node87.html">
</HEAD>
<BODY bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html2234"
HREF="node87.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A>
<A NAME="tex2html2228"
HREF="node73.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A>
<A NAME="tex2html2222"
HREF="node85.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A>
<A NAME="tex2html2230"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A>
<A NAME="tex2html2232"
HREF="node149.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html2235"
HREF="node87.html">6.14 Gridding of data</A>
<B> Up:</B> <A NAME="tex2html2229"
HREF="node73.html">6. Cook-book</A>
<B> Previous:</B> <A NAME="tex2html2223"
HREF="node85.html">6.12 Optimal triangulation of</A>
  <B> <A NAME="tex2html2231"
HREF="node1.html">Contents</A></B>
  <B> <A NAME="tex2html2233"
HREF="node149.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION0014130000000000000000"></A>
<A NAME="11200"></A>
<BR>
6.13 Plotting of vector fields
</H1>
<P>
In many areas, such as fluid dynamics and elasticity,
it is desirable to plot vector fields of various kinds.
<A NAME="tex2html415"
HREF="http://www.soest.hawaii.edu/gmt"><B>GMT</B></A> provides a way to illustrate 2-component vector fields
using the <A NAME="tex2html416"
HREF="../grdvector.html"><I><B>grdvector</B></I></A><A NAME="11216"></A> utility. The two components of
the field (Cartesian or polar components) are stored in
separate grdfiles. In this example we use <A NAME="tex2html417"
HREF="../grdmath.html"><I><B>grdmath</B></I></A><A NAME="11225"></A>
to generate a surface <!-- MATH
$z(x, y) = x \cdot \exp(-x^2 -y^2)$
-->
<IMG
WIDTH="170" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
SRC="img114.gif"
ALT="$z(x, y) = x \cdot \exp(-x^2 -y^2)$">
and to calculate <IMG
WIDTH="22" HEIGHT="30" ALIGN="MIDDLE" BORDER="0"
SRC="img115.gif"
ALT="$\nabla z$"> by
returning the <I>x</I>- and <I>y</I>-derivatives separately.
We superpose the gradient vector field and the surface
<I>z</I> and also plot the components of the gradient
in separate windows:
<P>
<P>
<BR>
<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>
grdmath -R-2/2/-2/2 -I0.1 X Y R2 NEG EXP X MUL = z.grd
grdmath z.grd DDX = dzdx.grd
grdmath z.grd DDY = dzdy.grd
grdcontour dzdx.grd -JX3i -B1/1WSne -C0.1 -A0.5 -K -P -G2i/10 -S4 -T0.1i/0.03i \
-U"Example 13 in Cookbook" >! example_13.ps
grdcontour dzdy.grd -JX -B1/1WSne -C0.05 -A0.2 -O -K -G2i/10 -S4 -T0.1i/0.03i -X3.45i >> example_13.ps
grdcontour z.grd -JX -B1/1WSne -C0.05 -A0.1 -O -K -G2i/10 -S4 -T0.1i/0.03i -X-3.45i -Y3.45i \
>> example_13.ps
grdcontour z.grd -JX -B1/1WSne -C0.05 -O -K -G2i/10 -S4 -X3.45i >> example_13.ps
grdvector dzdx.grd dzdy.grd -I0.2 -JX -O -K -Q0.03i/0.1i/0.09in0.25i -G0 -S5i >> example_13.ps
echo "3.2 3.6 40 0 6 2 z(x,y) = x * exp(-x@+2@+-y@+2@+)" | pstext -R0/6/0/4.5 -Jx1i -O -X-3.45i \
>> example_13.ps
\rm -f z.grd dzdx.grd dzdy.grd .gmtcommands
</PRE>
<P>
<BR>
<BR>
<P>
<BR CLEAR="ALL">
<HR>
<P>
A <A NAME="tex2html418"
HREF="../pstext.html"><I><B>pstext</B></I></A><A NAME="11294"></A> call to place a header finishes the plot
(Figure <A HREF="node86.html#fig:GMT_example_13">6.13</A>.
<P>
<P></P>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_13"></A><A NAME="11303"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 6.13:</STRONG>
Display of vector fields in <A NAME="tex2html412"
HREF="http://www.soest.hawaii.edu/gmt"><B>GMT</B></A></CAPTION>
<TR><TD><IMG
WIDTH="394" HEIGHT="448" BORDER="0"
SRC="img116.gif"
ALT="\begin{figure}\centering\epsfig{figure=eps/GMT_example_13.eps}\end{figure}"></TD></TR>
</TABLE>
</DIV><P></P>
<P>
<A NAME="11278"></A>
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html2234"
HREF="node87.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A>
<A NAME="tex2html2228"
HREF="node73.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A>
<A NAME="tex2html2222"
HREF="node85.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A>
<A NAME="tex2html2230"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A>
<A NAME="tex2html2232"
HREF="node149.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html2235"
HREF="node87.html">6.14 Gridding of data</A>
<B> Up:</B> <A NAME="tex2html2229"
HREF="node73.html">6. Cook-book</A>
<B> Previous:</B> <A NAME="tex2html2223"
HREF="node85.html">6.12 Optimal triangulation of</A>
  <B> <A NAME="tex2html2231"
HREF="node1.html">Contents</A></B>
  <B> <A NAME="tex2html2233"
HREF="node149.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2001-04-18
</ADDRESS>
</BODY>
</HTML>
|