# [MITgcm-support] XU, YU and XV, YV coordinates in the curvilinear grid...

Simone Sammartino ssammartino at ctima.uma.es
Mon Nov 5 02:40:22 EST 2012

```Hi Martin
Sorry for my late but I was out in the sea..:-)
I had to calculate manually the XU/V and YU/V grid...
The correct location of the XU/V and YU/V coordinates in a curvilinear grid
is given by the following:

XU(Ix,Iy) = XC(Ix,Iy)-((DXG(Ix,Iy)/2)*ACS(Ix,Iy))/faclon;
YU(Ix,Iy) = YC(Ix,Iy)-((DXG(Ix,Iy)/2)*ASN(Ix,Iy))/faclat;

XV(Ix,Iy) = XC(Ix,Iy)+((DYG(Ix,Iy)/2)*ASN(Ix,Iy))/faclon;
YV(Ix,Iy) = YC(Ix,Iy)-((DYG(Ix,Iy)/2)*ACS(Ix,Iy))/faclat;

where:

- Ix,Iy is a couple of indexes of the grid
- ACS and ASN are the cos and the sin, respectively, of the angle between
the Ix,Iy -th cell and the equator
- faclon and faclat are conversion factors representing the length in meters
of one degree at the longitude and latitude of the Ix,Iy -th cell, which can
be calculated respectively as, for instance:

faclon = 1000*m_lldist([XC(Ix,Iy)-.5 XC(Ix,Iy)+.5],[YC(Ix,Iy) YC(Ix,Iy)]);
faclat = 1000*m_lldist([XC(Ix,Iy) XC(Ix,Iy)],[YC(Ix,Iy)-.5 YC(Ix,Iy)+.5]);

by using the m_lldist function of the m_map toolbox.

In any case the discrepancy between the correct XY/UV location and the one
calculated by half XY/CG cells is proportional to the angle of the cell and
it is variable in a curvilinear grid.
Hence, if the XY/UV grid is written as XU=XG, YU=YC, XV=XC and YV=YG in the
NETCDF case (as it seems) it is correct only for the cartesian grid.
Otherwise the grids are badly located.

Thank you

Simone

-------------------------------------
Simone Sammartino
Physical Oceanography Research Group
University of Málaga
GOFIMA
Campus Teatinos s/n
ETSI Telecomunicación
29071 Málaga (Spain)

Tel: +34 952 13 28 49
http://oceano.uma.es
--------------------------------------
Do you really need to print this message?
Let's protect the environment.
-----Mensaje original-----
From: Martin Losch
Sent: Sunday, October 28, 2012 11:18 AM
To: mitgcm-support at mitgcm.org
Subject: Re: [MITgcm-support] XU, YU and XV,YV coordinates in the
curvilinear grid...

Simone,

the location of the velocity points is the same on all of the grids.
I am afraid, you'll have to compute XU/YU, and XV/YV yourself as averages of
XC/G, and YC/G. That's usually good enough.

Martin

On Oct 24, 2012, at 11:51 AM, Simone Sammartino wrote:

> Hi
> I’m working on outputs on a curvilinear grid...
> I saw that the X-YU and X-YV grid are written in the NETCDF case
> (http://mitgcm.org/viewvc/MITgcm/MITgcm/model/src/write_grid.F?view=markup),
> but it seems they are not in the binary output format case.
> The U coordinates are defined as XU=XG and YU=YC and the V coordinates as
> XV=XC and YV=YG, but it is correct only in the case of a cartesian grid.
> It does not correspond to the real U and V coordinates on a curvilinear
> grid, which instead depends on the angle in X-YC.
> So, two questions:
> - Where are located the U and V vectors in the curvilinear grid?
> - Why the X-YU and X-YV grid are not written in the binary output format?
>
>
> Simone
>
> -------------------------------------
> Simone Sammartino
> Physical Oceanography Research Group
> University of Málaga
> GOFIMA
> Campus Teatinos s/n
> ETSI Telecomunicación
> 29071 Málaga (Spain)
>
> Tel: +34 952 13 28 49
> http://oceano.uma.es
> --------------------------------------
> Do you really need to print this message?
> Let's protect the environment.
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support

_______________________________________________
MITgcm-support mailing list
MITgcm-support at mitgcm.org
http://mitgcm.org/mailman/listinfo/mitgcm-support

```