Hi all users:
We notice that in orthogonal curvilinear grids the velocity in nc file are in eta and xi directions. So if we want to plot current fields using the matlab command quiver, should we change the velocity fields into the cartesian coordinate first? And if the external forcing like winds are precribed, should they be changed from cartesian coordinate into orthogonal curvilinear coordinate according to the angle in the grd file?
Thanks for your help!
about the coordinate conversion
Re: about the coordinate conversion
Yes, you have to rotate the model velocities clockwise by the field "angle" for many plotting packages.
If you are providing winds to ROMS, you may or may not have to rotate, it depends. Are you giving ROMS a full gridded field on the ROMS grid? If so, it should be rotated to the xi,eta directions. If you are giving ROMS a global wind field and expecting ROMS to do the interpolation, ROMS will also do the rotation. Same for a single value of wind data that gets used over the whole domain.
If you are providing winds to ROMS, you may or may not have to rotate, it depends. Are you giving ROMS a full gridded field on the ROMS grid? If so, it should be rotated to the xi,eta directions. If you are giving ROMS a global wind field and expecting ROMS to do the interpolation, ROMS will also do the rotation. Same for a single value of wind data that gets used over the whole domain.
-
- Posts: 45
- Joined: Tue Nov 11, 2008 5:45 pm
- Location: National Marine Environmental Mornitoring Center
Re: about the coordinate conversion
Dear Kate and other users:kate wrote:If you are giving ROMS a global wind field and expecting ROMS to do the interpolation, ROMS will also do the rotation. Same for a single value of wind data that gets used over the whole domain.
Would you please tell where to find the interpolation and rotation part in ROMS? I want to read the code. Thank you!
Qian
Re: about the coordinate conversion
Rotation is in set_data.F: search for CosAngler or SinAngler.
Interpolation is in interpolate.F, called by regrid, called by nf_fread2d.
Interpolation is in interpolate.F, called by regrid, called by nf_fread2d.
-
- Posts: 45
- Joined: Tue Nov 11, 2008 5:45 pm
- Location: National Marine Environmental Mornitoring Center
Re: about the coordinate conversion
! If input point wind stress, rotate to curvilinear grid. Notice
! that rotation is done at RHO-points. It does not matter.
!
IF (.not.Linfo(1,idUsms,ng).or. &
& (Iinfo(5,idUsms,ng).ne.Lm(ng)+1).or. &
& (Iinfo(6,idUsms,ng).ne.Mm(ng)+2)) THEN
DO j=JstrR,JendR
DO i=IstrR,IendR
cff1=FORCES(ng)%sustr(i,j)*GRID(ng)%CosAngler(i,j)+ &
& FORCES(ng)%svstr(i,j)*GRID(ng)%SinAngler(i,j)
cff2=FORCES(ng)%svstr(i,j)*GRID(ng)%CosAngler(i,j)- &
& FORCES(ng)%sustr(i,j)*GRID(ng)%SinAngler(i,j)
FORCES(ng)%sustr(i,j)=cff1
FORCES(ng)%svstr(i,j)=cff2
END DO
END DO
----------------------------------------------------------------------------
Dear Kate:
In set_data.F, the transfromation about winds are listed above. According to the code, the values of sustr are positive if the wind is from north. Is that true?
Qian
! that rotation is done at RHO-points. It does not matter.
!
IF (.not.Linfo(1,idUsms,ng).or. &
& (Iinfo(5,idUsms,ng).ne.Lm(ng)+1).or. &
& (Iinfo(6,idUsms,ng).ne.Mm(ng)+2)) THEN
DO j=JstrR,JendR
DO i=IstrR,IendR
cff1=FORCES(ng)%sustr(i,j)*GRID(ng)%CosAngler(i,j)+ &
& FORCES(ng)%svstr(i,j)*GRID(ng)%SinAngler(i,j)
cff2=FORCES(ng)%svstr(i,j)*GRID(ng)%CosAngler(i,j)- &
& FORCES(ng)%sustr(i,j)*GRID(ng)%SinAngler(i,j)
FORCES(ng)%sustr(i,j)=cff1
FORCES(ng)%svstr(i,j)=cff2
END DO
END DO
----------------------------------------------------------------------------
Dear Kate:
In set_data.F, the transfromation about winds are listed above. According to the code, the values of sustr are positive if the wind is from north. Is that true?
Qian
Re: about the coordinate conversion
It depends on the angle. What direction is the positive i direction in the model?
-
- Posts: 45
- Joined: Tue Nov 11, 2008 5:45 pm
- Location: National Marine Environmental Mornitoring Center
Re: about the coordinate conversion
If the wind is from north, the svstr is negitive!zhaoqian wrote:
In set_data.F, the transfromation about winds are listed above. According to the code, the values of sustr are positive if the wind is from north. Is that true?