Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help Plotting director fields

127 views
Skip to first unread message

Liquid Crystal

unread,
Jul 12, 2011, 7:03:08 AM7/12/11
to
Hello,

I am trying to plot a director field for nematic liquid crystals.
The form of the director is, in pseudo-mathematica

n = {Cos[theta],Sin[theta]}

Where:

theta = s ArcTan[y/x] + theta_0

If you reference the following links, you will see the various
disinclinations induced in the director field by choosing various s
and theta_0

http://learnliquid.blogspot.com/2011/07/test.html

However, using the following code I am not able to produce these images.
Any suggestions?

AAA = {Cos[-1/2 ArcTan[y/x] + 0/2], Sin[-1/2 ArcTan[y/x] + 0/2]}

StreamPlot[AAA, {x, -1, 1}, {y, -1, 1}, StreamPoints -> 12,
AspectRatio -> 1, StreamScale -> None]

Thank you,

LL

Heike Gramberg

unread,
Jul 13, 2011, 3:12:55 AM7/13/11
to
I think the problem is that ArcTan[y/x] in your definition of theta
should actually be the
polar angle of the vector {x,y}. For x>0 this is indeed ArcTan[y/x], but
for x<0 the polar
angle becomes ArcTan[y/x] + Pi for y>0 and ArcTan[y/x]-Pi for y<0.

One way around this is to define theta according to

theta = s Arg[x+I y] + theta0

so for example

AAA = {Cos[-1/2 Arg[x + I y] + 0], Sin[-1/2 Arg[x + I y] + 0]}

StreamPlot[AAA, {x, -1, 1}, {y, -1.5, 1.5}, StreamPoints -> 20,
StreamScale -> None]

Heike.

Peter Pein

unread,
Jul 13, 2011, 3:10:52 AM7/13/11
to

Hi,

it works here with ArcTan[x,y] in place of ArcTan[y/x] :-)

Peter


JUN

unread,
Jul 14, 2011, 5:22:40 AM7/14/11
to
On Jul 13, 12:10 am, Peter Pein <pet...@dordos.net> wrote:
> Am 12.07.2011 13:03, schrieb Liquid Crystal:
>
>
>
>
>
>
>
>
>
> > Hello,
>
> > I am trying to plot a director field for nematic liquid crystals.
> > The form of the director is, in pseudo-mathematica
>
> > n = {Cos[theta],Sin[theta]}
>
> > Where:
>
> > theta = s ArcTan[y/x] + theta_0
>
> > If you reference the following links, you will see the various
> > disinclinations induced in the director field by choosing various s
> > and theta_0
>
> >http://learnliquid.blogspot.com/2011/07/test.html
>
> > However, using the following code I am not able to produce these images=

.
> > Any suggestions?
>
> > AAA = {Cos[-1/2 ArcTan[y/x] + 0/2], Sin[-1/2 ArcTan[y/x] + 0/2]}
>
> > StreamPlot[AAA, {x, -1, 1}, {y, -1, 1}, StreamPoints -> 12,
> > AspectRatio -> 1, StreamScale -> None]
>
> > Thank you,
>
> > LL
>
> Hi,
>
> it works here with ArcTan[x,y] in place of ArcTan[y/x] :-)
>
> Peter

I find Arg[x + I y] preferable because it handles the special case
x=y=0 whereas ArcTan[x,y] doesn't.

The equivalent convenience function in javascript, atan2(x,y), does
give 0 for x=y=0. It would be more consistent if Mathematica's ArcTan
with two arguments also followed this convention.

Speaking of coordinate transformations, it may also be efficient to
make use of CoordinatesFromCartesian, see
VectorAnalysis/ref/CoordinatesFromCartesian
(link to the documentation).

Without loading that package, the way to emulate
CoordinatesFromCartesian[pt] for polar coordinates in two dimensions
would be
Arg@Apply[Complex, pt]

Jens

Liquid Crystal

unread,
Jul 15, 2011, 4:11:54 AM7/15/11
to
Thank you all for your help,

Heike informed me of some of these solution methods via email, and
helped clear up an issue with how mathematica seeds the streams for
the stream plot so as to make the plots syymetric.
Here is his solution for one of the systems:

AAA = {Cos[1 Arg[x + I y] + 0], Sin[1 Arg[x + I y] + 0]}
points = Table[0.5 {Cos[th], Sin[th]}, {th, 0, 2 Pi, Pi/6}];

StreamPlot[AAA, {x, -1, 1}, {y, -1, 1}, StreamPoints -> points,
StreamScale -> None]

Best,

Mike


0 new messages