Skip to content

Commit

Permalink
Merge branch 'user/wfc/grid_initialization' of https://github.com/wfc…
Browse files Browse the repository at this point in the history
…ooke/MOM6 into wfcooke-user/wfc/grid_initialization
  • Loading branch information
adcroft committed Jan 23, 2018
2 parents 0cf3baf + 1686e12 commit 4686129
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3003,6 +3003,15 @@ subroutine write_static_fields(G, GV, tv, diag)
'Delta(y) at v points (meter)', 'm', interp_method='none')
if (id > 0) call post_data(id, G%dyCv, diag, .true.)

id = register_static_field('ocean_model', 'dyCuo', diag%axesCu1, &
'Open meridional grid spacing at u points (meter)', 'm', interp_method='none')
if (id > 0) call post_data(id, G%dy_Cu, diag, .true.)

id = register_static_field('ocean_model', 'dxCvo', diag%axesCv1, &
'Open zonal grid spacing at v points (meter)', 'm', interp_method='none')
if (id > 0) call post_data(id, G%dx_Cv, diag, .true.)


! This static diagnostic is from CF 1.8, and is the fraction of a cell
! covered by ocean, given as a percentage (poorly named).
id = register_static_field('ocean_model', 'area_t_percent', diag%axesT1, &
Expand Down
31 changes: 26 additions & 5 deletions src/initialization/MOM_shared_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ subroutine reset_face_lengths_list(G, param_file)
! model parameter values.
character(len=120), pointer, dimension(:) :: lines => NULL()
character(len=120) :: line
character(len=200) :: filename, chan_file, inputdir ! Strings for file/path
character(len=200) :: filename, chan_file, inputdir, mesg ! Strings for file/path
character(len=40) :: mdl = "reset_face_lengths_list" ! This subroutine's name.
real, pointer, dimension(:,:) :: &
u_lat => NULL(), u_lon => NULL(), v_lat => NULL(), v_lon => NULL()
Expand Down Expand Up @@ -907,9 +907,19 @@ subroutine reset_face_lengths_list(G, param_file)
if (((lat >= u_lat(1,npt)) .and. (lat <= u_lat(2,npt))) .and. &
(((lon >= u_lon(1,npt)) .and. (lon <= u_lon(2,npt))) .or. &
((lon_p >= u_lon(1,npt)) .and. (lon_p <= u_lon(2,npt))) .or. &
((lon_m >= u_lon(1,npt)) .and. (lon_m <= u_lon(2,npt)))) ) &

G%dy_Cu(I,j) = G%mask2dCu(I,j) * min(G%dyCu(I,j), max(u_width(npt), 0.0))
((lon_m >= u_lon(1,npt)) .and. (lon_m <= u_lon(2,npt)))) ) then

G%dy_Cu(I,j) = G%mask2dCu(I,j) * min(G%dyCu(I,j), max(u_width(npt), 0.0))
if ( G%mask2dCu(I,j) == 0.0 ) then
write(mesg,'(A,I4,A)') "read_face_lengths_list : G%mask2dCu is not defined for line ",npt, &
"Please update values in "//trim(filename)
call MOM_error(FATAL, mesg, all_print=.true.)
else
write(mesg,'(A54,2F8.2,A2,4F8.2,A5,F9.2,A1)') "read_face_lengths_list : Modifying dy_Cu gridpoint at ",lat,lon," (",&
u_lat(1,npt), u_lat(2,npt), u_lon(1,npt), u_lon(2,npt),") to ",G%dy_Cu(I,j),"m"
call MOM_error(WARNING, mesg, all_print=.true.)
endif
endif
enddo

G%areaCu(I,j) = G%dxCu(I,j)*G%dy_Cu(I,j)
Expand All @@ -926,8 +936,18 @@ subroutine reset_face_lengths_list(G, param_file)
if (((lat >= v_lat(1,npt)) .and. (lat <= v_lat(2,npt))) .and. &
(((lon >= v_lon(1,npt)) .and. (lon <= v_lon(2,npt))) .or. &
((lon_p >= v_lon(1,npt)) .and. (lon_p <= v_lon(2,npt))) .or. &
((lon_m >= v_lon(1,npt)) .and. (lon_m <= v_lon(2,npt)))) ) &
((lon_m >= v_lon(1,npt)) .and. (lon_m <= v_lon(2,npt)))) ) then
G%dx_Cv(i,J) = G%mask2dCv(i,J) * min(G%dxCv(i,J), max(v_width(npt), 0.0))
if ( G%mask2dCv(I,j) == 0.0 ) then
write(mesg,'(A,I4,A)') "read_face_lengths_list : G%mask2dCv is not defined for line ",npt, &
"Please update values in "//trim(filename)
call MOM_error(FATAL, mesg, all_print=.true.)
else
write(mesg,'(A54,2F8.2,A2,4F8.2,A5,F9.2,A1)') "read_face_lengths_list : Modifying dx_Cv gridpoint at ",lat,lon," (",&
v_lat(1,npt), v_lat(2,npt), v_lon(1,npt), v_lon(2,npt),") to ",G%dx_Cv(I,j),"m"
call MOM_error(WARNING, mesg, all_print=.true.)
endif
endif
enddo

G%areaCv(i,J) = G%dyCv(i,J)*G%dx_Cv(i,J)
Expand Down Expand Up @@ -1134,6 +1154,7 @@ subroutine write_ocean_geometry_file(G, param_file, directory, geom_file)
vars(22) = var_desc("Dblock_v","m","Blocked depth at v points",'v','1','1')
vars(23) = var_desc("Dopen_v","m","Open depth at v points",'v','1','1')


nFlds_used = 19 ; if (G%bathymetry_at_vel) nFlds_used = 23

if (present(geom_file)) then
Expand Down

0 comments on commit 4686129

Please sign in to comment.