help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: curvilinear coordinates


From: Juan Pablo Carbajal
Subject: Re: curvilinear coordinates
Date: Tue, 19 Feb 2013 10:39:46 +0100

On Tue, Feb 19, 2013 at 9:44 AM, Katrijn Baetens
<address@hidden> wrote:
> Hello,
>
> Thanks for your answer. I'm trying to convert flow velocity data from a
> curvilinear grid, to data in a cartesian grid. In the attached file I have a
> halfcircle domain (domain.gif), in order to simplify my flow calculations in
> that domain I used curvilinear coordinates, so my domain in cartesian
> coordinates looks like domaincart.gif. The output of my program are the
> velocities in the cartesian grid (domaincartvel.gif) and i have the
> positions of the curvilinear grid. so I would like to show the vector field
> in the half circle. I guess I'll have to manually program this?
>
> Thanks for your reply!
>
> KAtrijn
>
> For example, i have a
> On 18/02/13 18:04, Juan Pablo Carbajal wrote:
>
> On Mon, Feb 18, 2013 at 5:21 PM, Katrijn <address@hidden> wrote:
>
> Hello,
>
> I am working with non-orthogonal curvilinear coordinates. When using the
> command quiver(x,y,uvel,vvel) I get the origins of the vectors at the
> correct spot, however the direction is still calculated in the cartesian
> coordinate system (so basically I get the same vectors in quiver(uvel,vvel)
> and quiver(x,y,uvel,vvel) except that the position is changed, while I
> expected a translation and a rotation of my vectors, I only got a
> translation. I looked around but do not seem to find an easy answer. In
> matlab there seems to exist a curv2cart.m script, but I can't seem to find
> it. Hope somebody can help me.
>
> Cheers,
>
> Katrijn
>
>
>
> --
> View this message in context:
> http://octave.1599824.n4.nabble.com/curvilinear-coordinates-tp4649950.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
>
> Katrijn,
>
> quiver plots an arrow defined by the components V=(vx,vy) at the point
> P=(x,y). A kind of discretized version of a vector field V(P) =
> (vx(x,y),vy(x,y)).
>
> What is exactly what you want to plot? what are you trying to achieve?
> I do not the curv2mat script you mentioned.
>
> Cheers
>
>
> --
>
> Katrijn Baetens, PhD
>
> Gulledelle 100
>
> 1200 Brussels
>
> Belgium
>
>
> address@hidden
>
> 00 32 (0)2 773 21 45


Katrijn,
Please always keep the mailing list in CC.

Since you have the transformation from the half-circle (though it
looks more like a half ring) to the square, you can use the inverse of
that transformation to map back to the curvilinear frame.

That is, you can use quiver to plot on the square. Your inverse
transformation can rotate, translate and scale the base points and the
velocity vectors (maybe the geometry package has some helping
functions to do that,
http://octave.sourceforge.net/geometry/overview.html). Now to plot it
you can still use quiver using the transformed base points and arrows.

In equations I think it should look like
P = (x,y) % points of your mesh in the square domain
V = (vx,vy) % velocity vectors in the square domain
F: S --> C % Transformation form the curvilinear to the Cartesian frame
Pc = F (P) % Base points
Vc = dF/dt (V) % Velocities points

The following example is an hybrid one. It assumes you have your grid
in the square (corresponding to angle t and radius r) but your
velocities are already in the Cartesian coordinates (just apply the
derivative w.r.t. of your transformation).

[t,r] = meshgrid (linspace (0,pi,20),linspace (0.3,1,20)); % a mesh of
a half ring in the (t,r) plane
vx   = r.*cos (2*t); vy = r.*sin (2*t);  % a velocity field already in
Cartesian coordinates.
h    = quiver (t,r,vx,vy);  % This is the cartesian velocity field in
the curvilinear frame.
[x y] = pol2cart (t,r);  % Transformation from curvilinear to cartesian
h = quiver (x,y,vx,vy); % This is the cartesian velocity field in the
cartesian frame (i.e. the half ring).

I hope this helps.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]