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

Add a bunch of C-grid infrastructure #1

Merged
merged 17 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 10 additions & 1 deletion cicecore/cicedynB/analysis/ice_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ subroutine init_hist (dt)
use ice_domain_size, only: max_blocks, max_nstrm, nilyr, nslyr, nblyr, ncat, nfsd
use ice_dyn_shared, only: kdyn
use ice_flux, only: mlt_onset, frz_onset, albcnt, snwcnt
use ice_grid, only: grid_system
use ice_history_shared ! everything
use ice_history_mechred, only: init_hist_mechred_2D, init_hist_mechred_3Dc
use ice_history_pond, only: init_hist_pond_2D, init_hist_pond_3Dc
Expand Down Expand Up @@ -547,11 +548,19 @@ subroutine init_hist (dt)
"snow/ice surface temperature", &
"averaged with Tf if no ice is present", c1, c0, &
ns1, f_Tsfc)


! tcraig, just to test capability, tcx
! if (grid_system == 'CD') then
! call define_hist_field(n_aice,"aice","1",nstr2D, ncstr, &
! "ice area (aggregate)", &
! "none", c1, c0, &
! ns1, f_aice)
! else
call define_hist_field(n_aice,"aice","1",tstr2D, tcstr, &
"ice area (aggregate)", &
"none", c1, c0, &
ns1, f_aice)
! endif

call define_hist_field(n_uvel,"uvel","m/s",ustr2D, ucstr, &
"ice velocity (x)", &
Expand Down
13 changes: 11 additions & 2 deletions cicecore/cicedynB/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ subroutine input_data
use ice_grid, only: grid_file, gridcpl_file, kmt_file, &
bathymetry_file, use_bathymetry, &
bathymetry_format, &
grid_type, grid_format, &
grid_type, grid_format, grid_system, &
dxrect, dyrect, &
pgl_global_ext
use ice_dyn_shared, only: ndte, kdyn, revised_evp, yield_curve, &
Expand Down Expand Up @@ -184,7 +184,7 @@ subroutine input_data
bathymetry_file, use_bathymetry, nfsd, bathymetry_format, &
ncat, nilyr, nslyr, nblyr, &
kcatbound, gridcpl_file, dxrect, dyrect, &
close_boundaries, orca_halogrid
close_boundaries, orca_halogrid, grid_system

namelist /tracer_nml/ &
tr_iage, restart_age, &
Expand Down Expand Up @@ -324,6 +324,7 @@ subroutine input_data
ice_ic = 'default' ! latitude and sst-dependent
grid_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf)
grid_type = 'rectangular' ! define rectangular grid internally
grid_system = 'B' ! underlying grid system
grid_file = 'unknown_grid_file'
gridcpl_file = 'unknown_gridcpl_file'
orca_halogrid = .false. ! orca haloed grid
Expand Down Expand Up @@ -696,6 +697,7 @@ subroutine input_data
call broadcast_scalar(dyrect, master_task)
call broadcast_scalar(close_boundaries, master_task)
call broadcast_scalar(grid_type, master_task)
call broadcast_scalar(grid_system, master_task)
call broadcast_scalar(grid_file, master_task)
call broadcast_scalar(gridcpl_file, master_task)
call broadcast_scalar(orca_halogrid, master_task)
Expand Down Expand Up @@ -1356,6 +1358,7 @@ subroutine input_data
if (trim(grid_type) == 'displaced_pole') tmpstr2 = ' : user-defined grid with rotated north pole'
if (trim(grid_type) == 'tripole') tmpstr2 = ' : user-defined grid with northern hemisphere zipper'
write(nu_diag,1030) ' grid_type = ',trim(grid_type),trim(tmpstr2)
write(nu_diag,1030) ' grid_system = ',trim(grid_system)
if (trim(grid_type) /= 'rectangular') then
if (use_bathymetry) then
tmpstr2 = ' : bathymetric input data is used'
Expand Down Expand Up @@ -2024,6 +2027,12 @@ subroutine input_data
abort_list = trim(abort_list)//":20"
endif

if (grid_system /= 'B' .and. &
grid_system /= 'CD' ) then
if (my_task == master_task) write(nu_diag,*) subname//' ERROR: unknown grid_system=',trim(grid_system)
abort_list = trim(abort_list)//":26"
endif

if (kdyn == 1 .and. &
evp_algorithm /= 'standard_2d' .and. &
evp_algorithm /= 'shared_mem_1d') then
Expand Down
34 changes: 11 additions & 23 deletions cicecore/cicedynB/infrastructure/ice_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module ice_grid
bathymetry_file, & ! input bathymetry for seabed stress
bathymetry_format, & ! bathymetry file format (default or pop)
grid_spacing , & ! default of 30.e3m or set by user in namelist
grid_system , & ! Underlying grid structure (i.e. B, C, CD, etc)
grid_type ! current options are rectangular (default),
! displaced_pole, tripole, regional

Expand Down Expand Up @@ -448,6 +449,10 @@ subroutine init_grid2

!-----------------------------------------------------------------
! T-grid cell and U-grid cell quantities
! Fill halo data locally where possible to avoid missing
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change BFB when blocks are not eliminated?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've run the quick suite on cheyenne pgi, intel, and gnu and it is BFB so far. I was worried about this too. By avoiding the haloupdate for the variables, we can do a little more in terms of the averaging to/from grids for blocks where the neighbor is eliminated. I need to test the full suite and will do that tonight.

! data associated with land block elimination
! Note: HTN, HTE, dx*, dy* are all defined from global arrays
! at halos.
!-----------------------------------------------------------------

!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
Expand All @@ -458,8 +463,8 @@ subroutine init_grid2
jlo = this_block%jlo
jhi = this_block%jhi

do j = jlo, jhi
do i = ilo, ihi
do j = 1,ny_block
do i = 1,nx_block
tarea(i,j,iblk) = dxt(i,j,iblk)*dyt(i,j,iblk)
uarea(i,j,iblk) = dxu(i,j,iblk)*dyu(i,j,iblk)
narea(i,j,iblk) = dxn(i,j,iblk)*dyn(i,j,iblk)
Expand All @@ -476,7 +481,11 @@ subroutine init_grid2
uarear(i,j,iblk) = c0 ! possible on boundaries
endif
tinyarea(i,j,iblk) = puny*tarea(i,j,iblk)
enddo
enddo

do j = jlo, jhi
do i = ilo, ihi
dxhy(i,j,iblk) = p5*(HTE(i,j,iblk) - HTE(i-1,j,iblk))
dyhx(i,j,iblk) = p5*(HTN(i,j,iblk) - HTN(i,j-1,iblk))
enddo
Expand Down Expand Up @@ -506,27 +515,6 @@ subroutine init_grid2
!-----------------------------------------------------------------

call ice_timer_start(timer_bound)
call ice_HaloUpdate (tarea, halo_info, &
field_loc_center, field_type_scalar, &
fillValue=c1)
call ice_HaloUpdate (uarea, halo_info, &
field_loc_NEcorner, field_type_scalar, &
fillValue=c1)
call ice_HaloUpdate (narea, halo_info, &
field_loc_Nface, field_type_scalar, &
fillValue=c1)
call ice_HaloUpdate (earea, halo_info, &
field_loc_Eface, field_type_scalar, &
fillValue=c1)
call ice_HaloUpdate (tarear, halo_info, &
field_loc_center, field_type_scalar, &
fillValue=c1)
call ice_HaloUpdate (uarear, halo_info, &
field_loc_NEcorner, field_type_scalar, &
fillValue=c1)
call ice_HaloUpdate (tinyarea, halo_info, &
field_loc_center, field_type_scalar, &
fillValue=c1)
call ice_HaloUpdate (dxhy, halo_info, &
field_loc_center, field_type_vector, &
fillValue=c1)
Expand Down
1 change: 1 addition & 0 deletions configuration/scripts/ice_in
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
&grid_nml
grid_format = 'bin'
grid_type = 'displaced_pole'
grid_system = 'B'
grid_file = 'grid'
kmt_file = 'kmt'
bathymetry_file = 'unknown_bathymetry_file'
Expand Down