Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate vels #614

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/diagnostics/MOM_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ module MOM_diagnostics
integer :: id_sst = -1, id_sst_sq = -1, id_sstcon = -1
integer :: id_sss = -1, id_sss_sq = -1, id_sssabs = -1
integer :: id_ssu = -1, id_ssv = -1
integer :: id_ssu_east = -1, id_ssv_north = -1

! Diagnostic IDs for heat and salt flux fields
integer :: id_fraz = -1
Expand Down Expand Up @@ -1283,6 +1284,8 @@ subroutine post_surface_dyn_diags(IDs, G, diag, sfc_state, ssh)

! Local variables
real, dimension(SZI_(G),SZJ_(G)) :: speed ! The surface speed [L T-1 ~> m s-1]
real :: ssu_east(SZI_(G),SZJ_(G)) ! Surface velocity due east component [L T-1 ~> m s-1]
real :: ssv_north(SZI_(G),SZJ_(G)) ! Surface velocity due north component [L T-1 ~> m s-1]
integer :: i, j, is, ie, js, je

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec
Expand All @@ -1304,6 +1307,17 @@ subroutine post_surface_dyn_diags(IDs, G, diag, sfc_state, ssh)
call post_data(IDs%id_speed, speed, diag, mask=G%mask2dT)
endif

if (IDs%id_ssu_east > 0 .or. IDs%id_ssv_north > 0) then
do j=js,je ; do i=is,ie
ssu_east(i,j) = (0.5*(sfc_state%u(I-1,j) + sfc_state%u(I,j))) * G%cos_rot(i,j) + &
(0.5*(sfc_state%v(i,J-1) + sfc_state%v(i,J))) * G%sin_rot(i,j)
ssv_north(i,j) = - (0.5*(sfc_state%u(I-1,j) + sfc_state%u(I,j))) * G%sin_rot(i,j) + &
(0.5*(sfc_state%v(i,J-1) + sfc_state%v(i,J))) * G%cos_rot(i,j)
enddo ; enddo
if (IDs%id_ssu_east > 0 ) call post_data(IDs%id_ssu_east, ssu_east, diag, mask=G%mask2dT)
if (IDs%id_ssv_north > 0 ) call post_data(IDs%id_ssv_north, ssv_north, diag, mask=G%mask2dT)
endif

end subroutine post_surface_dyn_diags


Expand Down Expand Up @@ -1912,6 +1926,10 @@ subroutine register_surface_diags(Time, G, US, IDs, diag, tv)
'Sea Surface Meridional Velocity', 'm s-1', conversion=US%L_T_to_m_s)
IDs%id_speed = register_diag_field('ocean_model', 'speed', diag%axesT1, Time, &
'Sea Surface Speed', 'm s-1', conversion=US%L_T_to_m_s)
IDs%id_ssu_east = register_diag_field('ocean_model', 'ssu_east', diag%axesT1, Time, &
'Eastward velocity', 'm s-1', conversion=US%L_T_to_m_s)
IDs%id_ssv_north = register_diag_field('ocean_model', 'ssv_north', diag%axesT1, Time, &
'Northward velocity', 'm s-1', conversion=US%L_T_to_m_s)

if (associated(tv%T)) then
IDs%id_sst = register_diag_field('ocean_model', 'SST', diag%axesT1, Time, &
Expand Down
Loading