Re: Is there a simple way to plot field lines? [message #35369] |
Fri, 30 May 2003 12:02 |
jeyadev
Messages: 78 Registered: February 1995
|
Member |
|
|
In article <d96c8f7c.0305281529.6bd3bc9d@posting.google.com>,
Mirko Vukovic <mvukovic@taz.telusa.com> wrote:
> so@cp.dias.ie (Steve) wrote in message news:<178496d6.0305280522.5db923d4@posting.google.com>...
>> "Mark Hadfield" <m.hadfield@niwa.co.nz> wrote in message news:<bb12df$qan$1@newsreader.mailgate.org>...
>>> "Steve" <so@cp.dias.ie> wrote in message
>>> news:178496d6.0305271647.468088fa@posting.google.com...
>>>> I would like to plot field lines but there coesn't seem to be an
>>>> intrinsic function which can do it. This seems hard to believe, am I
>>>> mistaken?
>>>
>>> What do you mean by "plot field lines". If you have (x,y) coordinates
>>> defining your lines, then PLOT them. Or do you want to plot isolines for a
>>> scalar field? Or lines in 3D space? Or cows walking along lines in fields?
>>
>> Ouch. Well I guess I should have been more explicit to. I mean field
>> lines which are everywhere tangent to a vector field (2d is fine
>> thanks), also known as streamlines for velocity fields. I don't want
>> arrows anywhere. Or cows.
Cows add little of value here, but arrows do!
>
> This seems to me a problem to which there is no magic bullet. What
Very true .... !!
> you seem to be looking for really, is to obtain a function of your
> coordinates, such that contours of that function are the streamlines
> from your data.
>
> Another (more defined) approach would be to set-up a PDE for your
> streamlines, with the right hand side being derived from your data
> (interpolated at the points where the PDE is being solved for)
>
> dx/ds = cos(alpha)
> dy/ds = sin(alpha)
>
> where alpha is the angle of the streamline with respect to x and s is
> the arclength.
>
> Then you would solve the PDE for some starting point, and follow it to
> obtain a streamline. The PDE may be re-cast as on ODE
>
> dx/dy = tan(alpha)
>
> However, this may fail if you have looping streamlines.
This is the way I plot electric field lines, but as you said, it
depends on the geometry and the field. The above method not only
has problems with looping lines (not a problem with electrostatic
fields) but also when the field is "vertical", as tan(alpha)
blows up and so the code should take care to test this and
account for it. This is big problem if the boundary condition is
such that the field is "vertical" at the starting boundary value
of the ODE.
> Summarizing, this is more of a problem of data analysis and number
> crunching than just plotting. But it sure sounds fun!
That is the nub of it. The way I do it is the just get a lot of
(x,y) pairs and then use PV Wave to plot the lines. One particular
issue here is that of constant flux between the lines. Traditional
field line plotting is such the the flux between any pair of lines
is the same, so that the lines come close together where the fields
are high and are far apart where the fields are weak. This aspect
is the trickiest part of the problem. It comes down to finding
points at the boundary from which you want to integrate that are
so placed that the flux between any pair of them is the same.
Determining the starting points of the field lines is a numerical
problem that has to be solved before integrating the ODEs.
I do not know of any generic package that does this.
--
Surendar Jeyadev jeyadev@wrc.xerox.bounceback.com
Remove 'bounceback' for email address
|
|
|
|
Re: Is there a simple way to plot field lines? [message #35399 is a reply to message #35396] |
Wed, 28 May 2003 16:29  |
mvukovic
Messages: 63 Registered: July 1998
|
Member |
|
|
so@cp.dias.ie (Steve) wrote in message news:<178496d6.0305280522.5db923d4@posting.google.com>...
> "Mark Hadfield" <m.hadfield@niwa.co.nz> wrote in message news:<bb12df$qan$1@newsreader.mailgate.org>...
>> "Steve" <so@cp.dias.ie> wrote in message
>> news:178496d6.0305271647.468088fa@posting.google.com...
>>> I would like to plot field lines but there coesn't seem to be an
>>> intrinsic function which can do it. This seems hard to believe, am I
>>> mistaken?
>>
>> What do you mean by "plot field lines". If you have (x,y) coordinates
>> defining your lines, then PLOT them. Or do you want to plot isolines for a
>> scalar field? Or lines in 3D space? Or cows walking along lines in fields?
>
> Ouch. Well I guess I should have been more explicit to. I mean field
> lines which are everywhere tangent to a vector field (2d is fine
> thanks), also known as streamlines for velocity fields. I don't want
> arrows anywhere. Or cows.
This seems to me a problem to which there is no magic bullet. What
you seem to be looking for really, is to obtain a function of your
coordinates, such that contours of that function are the streamlines
from your data.
Another (more defined) approach would be to set-up a PDE for your
streamlines, with the right hand side being derived from your data
(interpolated at the points where the PDE is being solved for)
dx/ds = cos(alpha)
dy/ds = sin(alpha)
where alpha is the angle of the streamline with respect to x and s is
the arclength.
Then you would solve the PDE for some starting point, and follow it to
obtain a streamline. The PDE may be re-cast as on ODE
dx/dy = tan(alpha)
However, this may fail if you have looping streamlines.
Summarizing, this is more of a problem of data analysis and number
crunching than just plotting. But it sure sounds fun!
Mirko
|
|
|
|
Re: Is there a simple way to plot field lines? [message #35401 is a reply to message #35400] |
Wed, 28 May 2003 13:36  |
so
Messages: 9 Registered: August 2000
|
Junior Member |
|
|
David Fanning <david@dfanning.com> wrote in message news:<MPG.193e67c621b7edc6989bb4@news.frii.com>...
> Steve (so@cp.dias.ie) writes:
>
>> Ouch. Well I guess I should have been more explicit to. I mean field
>> lines which are everywhere tangent to a vector field (2d is fine
>> thanks), also known as streamlines for velocity fields. I don't want
>> arrows anywhere. Or cows.
>
> Oh, well then. STREAMLINE might do the trick. :-)
>
> Cheers,
>
> David
There is a script called streamline.pro on
http://www.metvis.com.au/graphics.html with nice examples of its
output. It uses particle_trace and by commenting out the arrow
commands and judiciously tweaking the number of seedpoints, step size,
and max iterations it produces perfectly acceptable field line plots.
I am plotting dipole fields which look a bit iron-filing like I guess
because of the 1/r3 dependence but I am guessing if the seed points
were chosen over a central sphere with uniform angular separation it
would be smoother.
Hope this helps somebody else sometime.
Cheers, Stephen
|
|
|
Re: Is there a simple way to plot field lines? [message #35406 is a reply to message #35401] |
Wed, 28 May 2003 06:54  |
so
Messages: 9 Registered: August 2000
|
Junior Member |
|
|
David Fanning <david@dfanning.com> wrote in message news:<MPG.193dd29796c88430989bb3@news.frii.com>...
> Mark Hadfield (m.hadfield@niwa.co.nz) writes:
>
>> What do you mean by "plot field lines". If you have (x,y) coordinates
>> defining your lines, then PLOT them. Or do you want to plot isolines for a
>> scalar field? Or lines in 3D space? Or cows walking along lines in fields?
>
> I think you might have to code the latter up. I once
> had a railroad engine running across a plot. If you
> screw up your nose and cross your eyes it sorta looks
> like a cow. I'd be happy to send you the code.
>
> I think "plot field lines" might be code for "velovect".
> If so, I would get the one Martin Schultz modified for
> overplotting, etc. It can be found under "Modified IDL
> Routines -> Plotting Routines" on Ronn Kling's web page:
>
> http://www.rlkling.com/
>
> Cheers,
>
> David
Thanks. I've had a look and I reckon the easiest way of doing this is
to write a field line plotter (sorry,
code-that-takes-a-vector-field-and-traces-lines-which-are-ta ngent-to-the-vector-field-from-a-number-of-seed-points)
in C. I can't see much point in having to hack a huge expensive
package like IDL to do something simple slowly.
Thanks again though!
|
|
|
Re: Is there a simple way to plot field lines? [message #35408 is a reply to message #35406] |
Wed, 28 May 2003 06:30  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Steve (so@cp.dias.ie) writes:
> Ouch. Well I guess I should have been more explicit to. I mean field
> lines which are everywhere tangent to a vector field (2d is fine
> thanks), also known as streamlines for velocity fields. I don't want
> arrows anywhere. Or cows.
Oh, well then. STREAMLINE might do the trick. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Is there a simple way to plot field lines? [message #35409 is a reply to message #35408] |
Wed, 28 May 2003 06:22  |
so
Messages: 9 Registered: August 2000
|
Junior Member |
|
|
"Mark Hadfield" <m.hadfield@niwa.co.nz> wrote in message news:<bb12df$qan$1@newsreader.mailgate.org>...
> "Steve" <so@cp.dias.ie> wrote in message
> news:178496d6.0305271647.468088fa@posting.google.com...
>> I would like to plot field lines but there coesn't seem to be an
>> intrinsic function which can do it. This seems hard to believe, am I
>> mistaken?
>
> What do you mean by "plot field lines". If you have (x,y) coordinates
> defining your lines, then PLOT them. Or do you want to plot isolines for a
> scalar field? Or lines in 3D space? Or cows walking along lines in fields?
Ouch. Well I guess I should have been more explicit to. I mean field
lines which are everywhere tangent to a vector field (2d is fine
thanks), also known as streamlines for velocity fields. I don't want
arrows anywhere. Or cows.
|
|
|
Re: Is there a simple way to plot field lines? [message #35412 is a reply to message #35409] |
Tue, 27 May 2003 19:53  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Mark Hadfield (m.hadfield@niwa.co.nz) writes:
> What do you mean by "plot field lines". If you have (x,y) coordinates
> defining your lines, then PLOT them. Or do you want to plot isolines for a
> scalar field? Or lines in 3D space? Or cows walking along lines in fields?
I think you might have to code the latter up. I once
had a railroad engine running across a plot. If you
screw up your nose and cross your eyes it sorta looks
like a cow. I'd be happy to send you the code.
I think "plot field lines" might be code for "velovect".
If so, I would get the one Martin Schultz modified for
overplotting, etc. It can be found under "Modified IDL
Routines -> Plotting Routines" on Ronn Kling's web page:
http://www.rlkling.com/
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Is there a simple way to plot field lines? [message #35414 is a reply to message #35412] |
Tue, 27 May 2003 18:12  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
"Steve" <so@cp.dias.ie> wrote in message
news:178496d6.0305271647.468088fa@posting.google.com...
> I would like to plot field lines but there coesn't seem to be an
> intrinsic function which can do it. This seems hard to believe, am I
> mistaken?
What do you mean by "plot field lines". If you have (x,y) coordinates
defining your lines, then PLOT them. Or do you want to plot isolines for a
scalar field? Or lines in 3D space? Or cows walking along lines in fields?
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|