next up previous contents index
Next: A Subjective Test Using Up: Testing the ASTRA program Previous: Testing the ASTRA program

   
Testing the geometry section

Testing the results that the geometry subroutine produces is not easy due to the 3-D nature of the problem. Nonetheless it is important to test the results for a few cases to ensure the correct results are being produced. In order to help convince others who may wish to use the program that these are the correct results an example for one line of sight is tested below. By considering only a small sized cloud it is possible to work through the calculations of certain lines of sight by hand. Confirmation that the program reproduces these results makes it almost certain that it also works correctly for much larger models. The only caveat to this is that there are sometimes special situations that arise (eg. a line of sight passing exactly through the corner of a ring) which may not have been programmed for which also do not occur in a small model cloud such as the one used for testing here.


 

\includegraphics[angle=270, scale=0.55]{cyl2.eps}   A sample line of sight

Consider for example figure 5.1. This shows a 3$\times$3 model cloud (or 3 cylinders by 4 disks). Taking $hlines=8$there are then 22 lines of sight at each position. This figure shows line 17 (ie. $counter=17+8=25$) in ring (1,3) which is angled downwards at $45^{\circ }$ and has its horizontal projection angled at $120^\circ$ to the radial (ie. the angle between the thick dashed line and the $V_{r_1}$ line in the diagram). The three angles $\theta_r$, $\theta_\theta$ and $\theta_z$are the angles between the line of sight (the thick solid line) and the three velocity components ($V_{r_1}$, $V_{\theta_1}$ and $V_{z_1}$ - each of which is perpendicular to the other two). Also drawn on the diagram are the radial, tangential and vertical components of velocity at the point where the line of sight exits the cloud (ie. through disk 0), the vertical component lies directly over the thick dashed line heading upwards into the cloud. The velocity field in the cloud is chosen (arbitrarily) to be:

-2 -1 -1 -0.5
-3 -2 -2 -1
-3 -2 -2 -1
-2 -1 -1 -0.5
for $vr$ and:

2 1 1 0.5
3 2 2 1
3 2 2 1
2 1 1 0.5
for $vt$ and:

2 1 1 0.5
3 2 2 1
-3 -2 -2 -1
-2 -1 -1 -0.5
for $vz$. These tables correspond to positions in the cloud as shown - ie. disk 0 is the bottom row in each case but remember that the run.** files are the other way round (as mentioned in section 4.12.5). This represents a cloud with radial infall (fastest at the centre of the cloud) and vertical outflow (again faster toward the centre of the cloud) together with rotation (fastest at the centre).

The cylinders are located at 1, 2 & 3 pc (numbers that are just chosen to make calculations easier) and the disks are located at 0, 1, 2 & 3 pc. Line of sight intersections   \includegraphics[scale=0.5]{los5.eps} Figure 5.2 shows the same line of sight as in figure 5.1 in a top view (the upper diagram) and a side view (lower diagram). In the top view the dashed line is the projection of the line of sight. It starts at point S, a distance of 0.5 pc from the origin (ie. the centre of the innermost ring) and is angled at 120$^\circ$ to the $\theta=0$ line (the dotted line continuing the CS line). This projection (SE) has a length of 2.5 pc, this is known as it starts at a height of 2.5 pc above disk 0 (the base of the cloud) and is angled at 45$^\circ$. The angle $\theta$and the length of the remaining side can be calculated using the cosine rule and yield the co-ordinates of the exit point (E) from the cloud, ie. (r,$\theta$,z)=(2.29, 109$^\circ$, 0), or in cartesians (x, y, z)=(-1.15, 1.984, 0). The side view is along the projection of the line of sight, therefore the points A & B in both diagrams correspond to each other. The side view therefore shows where the line of sight crosses the ring
boundaries. Since the starting position (marked by a black circle) is 2.5 pc above the base of the cylinder and the projection along the base also has length 2.5 pc the length of the line of sight is given by $\frac{5}{\sqrt{2}} {\rm pc}$. It is now relatively simple to work out the positions where the line of sight crosses the ring boundaries. For the cylinder crossings simply use the top view diagram and for the first cylinder crossing consider the triangle formed by C, S and the intersection of the line of sight with the first cylinder (ie. point X). This has sides CS=0.5, CX=1 (the first cylinder has radius 1) and $\angle$CSX$=60^\circ$ as before. Now using the cosine rule the intersection is at 1.15 pc, however, this is only the projection distance so the actual distance along the line of sight is this divided by $\sin 45=\frac{1}{\sqrt2}$ yielding 1.63 pc, or 5.02 $\times 10^{16}$m. Similarly the intersection with the second cylinder is at 3.11 pc = 9.59 $\times 10^{16}$m.

Finding where the line of sight crosses the disks is similar. Using the lower diagram consider the triangle SHG. Since $\angle$SGH$=90^\circ$ both the other angles are 45$^\circ$. Length SG is 0.5 so length SH is $\frac{1}{\sqrt2}=0.71{\rm pc}=2.18\times 10^{16}$m. Similarly the intersections with disks 1 and 0 are at 2.12 pc = 6.53 $\times 10^{16}$m and 3.53 pc = 10.89 $\times 10^{16}$m, respectively, this last value being the total length of the line of sight in the cloud as it exits the cloud when it passes through disk 0.

So in summary the segments and their lengths are:

Segment No. Total length Segment length
  to end of segment (pc) (pc) ( $\times 10^{16}$ m)
1 0.71 0.71 2.19
2 1.63 0.92 2.83
3 2.12 0.49 1.51
4 3.11 0.99 3.05
5 3.53 0.42 1.29

Angle between the line of sight and $V_r$   \includegraphics[scale=0.6]{losangle2.eps} Having now calculated all the intersection locations along the line of sight it is necessary to locate their actual positions in the cloud in order to be able to determine the cloud's velocity field at each intersection and thereby the component of the velocity field along the line of sight. Start by considering the situation shown in figure 5.3. The diagram should be interpreted as a pyramid from above with triangle BCD being the base and point A the apex (which is `above' the base in this view). Point A represents the start of the line of sight (the same line of sight that has been referred to in the previous paragraphs) with point D being some point further along the line of sight. AC represents the unit vector of the radial component of velocity in the cloud at point A (ie. continuing along this line in the direction CA would lead to the central line of symmetry in the cloud). The aim here is to determine the angle $\theta$, ie. the angle between the radial component of velocity and the line of sight. To do this consider the projection of the line of sight onto the plane containing the vector AC. This is line AB (this plane has constant $z$ in the co-ordinate system, ie. is parallel to the disks in the cloud). Considering just the first unit length of this line defines point B (this can be any length, 1 is chosen for convenience). Line BD is perpendicular to the plane containing ABC and therefore intersects the line of sight. This intersection point is labeled D. Line BC is perpendicular to BD and lies in the plane ABC, this line intersects the radial velocity component at point C. With this setup it is fairly easy to find $\theta$. Using triangle ABC side BC is $\sqrt{3}=1.73$ and then using triangle BCD side CD is 2. Using triangle ABD length AD is $\sqrt{2}=1.41$. Finally using triangle ACD it is possible to determine $\theta_r=110.7^\circ$. A similar method for the tangential component yields $\theta_\theta=52.2^\circ$ (the diagram for this is the same as in figure 5.3 except that $\angle BAC=30^\circ$ since the radial and tangential velocity components are perpendicular to one another). The final component with the vertical is simply $\theta_z=135^\circ$ (the line of sight was defined as being angled downwards at $45^{\circ }$ but the vertical velocity component is positive in the upward direction). This last angle remains the same for all positions along the line of sight whereas the other two angles may vary with position along the line of sight. Now using equation 4.17 the total velocity component can be determined. As defined in the tables above, the velocity components at position $(r,z)=(\frac{1}{2},2\frac{1}{2})$ are $V_r=-2$, $V_\theta=2$ and $V_z=2$. Therefore the velocity component along the line of sight at its starting point is $V_1=-2\times\cos110.7^\circ+2\times\cos52.2^\circ+2\times\cos135^\circ=0.707+1.226-1.414=0.519
\hspace*{1mm} {\rm km} \hspace*{1mm} {\rm s}^{-1}$.

Angle between the line of sight projection and $V_r$.   [r] \includegraphics[scale=0.5]{los6.eps} As it can be rather confusing considering the different signs required for the velocities the basic principles are emphasised here. The $V_r, V_\theta, V_z$ figures represent the velocity field of the cloud at the point of interest. They are positive when the velocity is in the direction of the $r, \theta, z$ vectors (ie. outwards, clockwise (viewed from above) and upwards, respectively). $V_1$ and $V_2$ are the components of the velocity field along the line of sight and are therefore positive when the velocity is aligned along the line of sight. Thus the $V_r$ vector in this example is negative because there is infall (ie. motion towards the cloud centre) at the start of the line of sight, however the contribution that $V_r \times \cos \theta_r$ makes is positive as the line of sight is pointed towards the cloud centre and therefore this contribution is travelling in that direction. Later when the line of sight is on the other side of the cloud the velocity from the $V_r$ contribution will be negative as it will be travelling against the line of sight. Care is needed using the method used here in the text that the correct sign is chosen depending on which side of the cloud the line of sight is on but using the vector method in the program the signs take care of themselves (due to the co-ordinate system chosen).

It is now necessary to calculate these velocity components at the disk/cylinder intersections along the line of sight (ie. those positions determined above). Take the first intersection (with disk 2). By considering figure 5.4 it can be seen that the situation is much the same as at the start of the line of sight. The only difference is that the angle $\angle$BAC in figure 5.3 is now represented by $\phi$ (as in figure 5.4) and is no longer 120$^\circ$. Figure 5.4 is a top view of the cloud, the start of the line of sight is at S, the centre line of the cloud is C and the intersection with the first disk is at X. Therefore the length (in projection) of SX is $0.71\cos45^\circ=0.5 pc$ (0.71 was the length of the line of sight to the first disk intersection). CS is known to also be 0.5 pc so it is easy to find $\phi=60^\circ$. For the tangential velocity component it will be $\phi=30^\circ$. In order to calculate the velocity components the exact position in the cloud (in cylindrical co-ordinates) of the intersection must be known. Using figure 5.4 the length CX is the radial component (ie. CX=0.5 pc) and from figure 5.2 the length SG=0.5 pc - ie. the vertical co-ordinate is 2.5-0.5=2 pc. So the velocity components are $V_r=-2.5$, $V_\theta=2.5$ and $V_z=2.5$. Now proceeding as before but substituting the above values of $\phi$ for the $120^\circ$ used previously the angles between the velocity components and the lines of sight can be calculated as $\theta_r=69.3^\circ$ and $\theta_\theta=52,2^\circ$. Therefore the velocity component at this point on the line of sight is $V_2=-2.5\times\cos69.3^\circ+2.5\times\cos52.2^\circ+2.5\times\cos135^\circ=-0.884+1.531-1.768=-1.121
\hspace*{1mm} {\rm km} \hspace*{1mm} {\rm s}^{-1}$.

This procedure can be repeated at the next disk intersection (ie. with disk 1). This time SX is $2.12\cos45^\circ=1.5 pc$, CS is of course still 0.5 pc and CX can be calculated as 1.323 pc, therefore $\phi=19.11^\circ$ for the radial component and $70.89^\circ$ for the tangential component. So using figure 5.3 these give $\theta_r=48.1^\circ$ and $\theta_\theta=76.6^\circ$. The position for the intersection is (r, $\theta$, z)=(1.323, $\theta$, 1.5) so the velocity components are $V_r=-2$, $V_\theta=2$ and $V_z=-2$. Therefore the velocity component at this point on the line of sight is $V_2=-2\times\cos48.1^\circ+2\times\cos76.6^\circ-2\times\cos135^\circ=-1.336+0.463+1.414=0.541
\hspace*{1mm} {\rm km} \hspace*{1mm} {\rm s}^{-1}$. Finally, again for disk 0 (the exit point from the cloud) we have SX=2.50 pc, CS=0.5 pc, CX=2.29 pc. So $\phi=10.89^\circ$ or $79.11^\circ$ for the radial and tangential components of velocity respectively. These yield $\theta_r=46.0^\circ$ and $\theta_\theta=82.3^\circ$. So since the velocities at this point are $V_r=-0.85$, $V_\theta=0.85$ and $V_z=-0.85$ we have $V_2=-0.85\times\cos46.0^\circ+0.85\times\cos82.3^\circ-0.85\times\cos135^\circ=-0.593+0.114+0.604=0.125
\hspace*{1mm} {\rm km} \hspace*{1mm} {\rm s}^{-1}$.

There are also two cylinder crossings, the first being with cylinder 1. Calculating the velocity components at these two points involves much the same procedure as with the disks. For cylinder 1, considering the triangle CSX in figure 5.2, the angle $\angle CXS=\phi=25.66^\circ$ by use of the sine rule. Therefore proceeding as before (ie. using figure 5.4) yields $V_2=-2\times\cos50.4^\circ+2\times\cos72.2^\circ-0.6\times\cos135^\circ=-1.274+0.612+0.424=-0.238
\hspace*{1mm} km \hspace*{1mm} s^{-1}$. Similarly the intersection with cylinder 2 yields $V_2=-0.895+0.195+0.917=0.220 \hspace*{1mm} km \hspace*{1mm} s^{-1}$. All these data are summarised in table 5.1.


 
Table 5.1: Summary of intersections on the line of sight.
Intersection No. Velocity components (km s$^{-1}$) Velocity Relative Velocity
  r $\theta$ z (km s$^{-1}$) (m s$^{-1}$)
0 0.707 1.226 -1.414 0.519 0
1 -0.884 1.531 -1.768 -1.121 -1640
2 -1.274 0.612 0.424 -0.238 -757
3 -1.336 0.463 1.414 0.541 22
4 -0.895 0.195 0.917 0.220 -299
5 -0.593 0.114 0.604 0.125 -394


Comparing these values with those produced by the the program shows them to be the same (within rounding errors). Having calculated these values the midfind subroutine is called which in this example locates the two segments where the velocity changes direction (ie. segments 1 and 3). It then locates the position in each segment where the velocity is zero. As this is done by an iterative method (see section 4.5.7 for an explanation of how this works) there is no simple way of repeating it by hand to check the method. However it can be seen that the results do have the expected values. The final results returned from the geometry routine for line 25 in ring (1,3) then are shown in table 5.2.
 
Table 5.2: Summary of all segments on the line of sight.
Intersection Length to this Segment length between Velocity at Velocity at
Number intersection this intersection and intersection intersection
    the previous intersection   relative to start
  (pc) (pc) ( $\times 10^{16}$ m) (m s$^{-1}$) (m s$^{-1}$)
0 0 n/a n/a 518 n/a
1 0.35 0.35 1.07 0 -518
2 0.71 0.35 1.07 -1121 -1638
3 1.63 0.92 2.84 -234 -752
4 1.96 0.33 1.02 0 -518
5 2.12 0.16 0.49 541 23
6 3.11 0.99 3.05 220 -297
7 3.53 0.42 1.29 123 -393

Note that the values in the above table are the actual values returned by the program (it can be seen that they are however very close to the values in the previous tables).

As a final test it is worthwhile considering a line of sight that travels in a direction that takes it across the centre of the cloud. This is necessary to check that the program copes correctly with the velocity reversal that occurs from one side of the cloud to the other (eg. due to rotation). Line 21 is a good test for this. It has $\theta_z=45^\circ$, ie. travels upward rather than downward and has $\theta_\theta=240^\circ$, ie. travels out of the cloud in the other direction to line 25. This time use ring (1,1) as the starting ring (otherwise the line of sight immediately exits the cloud). It is only necessary to test the velocity at the start of the line of sight and at one other point (say the exit point from the cloud) to be certain that it is functioning correctly. At the start we have $V_1=
2 \cos 69.2^\circ + 2 \cos 52.2^\circ -2 \cos 45^\circ =+0.710-1.226-1.414=-1.930 \hspace*{1mm} {\rm km}
\hspace*{1mm} {\rm s}^{-1}$. At the exit point from the cloud (which due to symmetry with line 25 can be calculated as (r,$\theta$,z)=(2.29, 251$^\circ$, 3)) velocity is given by $V_2=0.85 \times \cos
46.0^\circ +0.85 \times \cos 82.3^\circ+0.85 \times \cos 4...
...irc=-0.593-0.114+0.604=-0.103
\hspace*{1mm} {\rm km} \hspace*{1mm} {\rm s}^{-1}$. These also agree with the values returned by the program.

These rather laborious few pages have been included to hopefully convince users that the geometry routine works correctly for all normal situations and to provide a baseline against which future modifications can be checked. Note that the method used here for the check was deliberately chosen to be different from that used by the program which hopefully eliminates the possibility of an error in the method used causing a problem. 



 
next up previous contents index
Next: A Subjective Test Using Up: Testing the ASTRA program Previous: Testing the ASTRA program

1999-04-12