In streamline.c there is a condition for stopping the trace if the data vector 
has zero magnitude or if the dot product between the data vector at the 
current step and the next step is < -0.0:

if (ZeroVector(v1, nDim) || VectorDot(v0, v1, nDim) < -0.0)

The documentation for the Streamline module should be changed so the user 
knows that there are stopping conditions besides the one for the maximum 
number of steps.

Besides correcting the documentation, I think one of two changes discussed 
below should be made to the Streamline Module:
(1) Stop conditions only generate a warning
(2) Streamline module has an option for diabling the stop conditions.

The stop conditions can cause problems in the application when we want to know 
if a magnetic field line trace started in the northern hemisphere will end in 
the southern hemisphere of Earth (or more generally if a field line started 
at a point in space will intersect a region on Earth).   

For example, one of the field lines in 
http://lasp.colorado.edu/~weigel/StreamLineProblem/StreamLineProblem_ex2.png
terminates in a location where other field lines are magnetically connected to 
Earth; this behavior creates many problems in our analysis and working around 
it is quite messy.

The attached patch changes the VectorDot condition so that only a warning is 
generated if VectorDot(v0, v1, nDim) < -0.0.  

Instead of a warning, should the streamline module have an input where the 
user can specify if VectorDot(v0, v1, nDim) < -0.0 is a stop condition?
As an argument for keeping the original stop conditions, compare what happens 
with and without the proposed patch for a poorly chosen grid:

http://lasp.colorado.edu/~weigel/StreamLineProblem/StreamLineProblem_ex1.png

and with the patch 

http://lasp.colorado.edu/~weigel/StreamLineProblem/StreamLineProblem_ex1_withfix.png

(The images were generated with the code in the .tgz at
http://lasp.colorado.edu/~weigel/StreamLineProblem/)


--- ./src/exec/dxmods/streamline.c	2002-03-21 10:10:05.000000000 -0700
+++ ../dx-4.3.2-patched/src/exec/dxmods/streamline.c	2005-10-06 13:19:35.000000000 -0600
@@ -600,8 +600,14 @@ Streamline(VectorField vf, 	/* Vector fi
 	    keepPoint = 1;
 	}
 
-	if (ZeroVector(v1, nDim) || VectorDot(v0, v1, nDim) < -0.0)
+	if (ZeroVector(v1, nDim))
+	  {
+	    DXWarning("Magnitude of vector for proposed next step is zero.");
 	    done = 1;
+	  }
+
+	if (VectorDot(v0, v1, nDim) < -0.0)
+	  DXWarning("Dot product between current and proposed next step is zero.  Continuing.");
 	
 	elapsedtime += t;
 

Reply via email to