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

Added dxgrow, dygrow to facilitate variable spaced grid. Modified rec… #746

Merged
merged 14 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion cicecore/cicedynB/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ subroutine input_data
grid_ice, grid_ice_thrm, grid_ice_dynu, grid_ice_dynv, &
grid_ocn, grid_ocn_thrm, grid_ocn_dynu, grid_ocn_dynv, &
grid_atm, grid_atm_thrm, grid_atm_dynu, grid_atm_dynv, &
dxrect, dyrect, &
dxrect, dyrect, dxgrow, dygrow, &
pgl_global_ext
use ice_dyn_shared, only: ndte, kdyn, revised_evp, yield_curve, &
evp_algorithm, visc_method, &
Expand Down Expand Up @@ -208,6 +208,7 @@ subroutine input_data
bathymetry_file, use_bathymetry, nfsd, bathymetry_format, &
ncat, nilyr, nslyr, nblyr, &
kcatbound, gridcpl_file, dxrect, dyrect, &
dxgrow, dygrow, &
close_boundaries, orca_halogrid, grid_ice, kmt_type, &
grid_atm, grid_ocn

Expand Down Expand Up @@ -394,6 +395,8 @@ subroutine input_data
ksno = 0.3_dbl_kind ! snow thermal conductivity
dxrect = 0.0_dbl_kind ! user defined grid spacing in cm in x direction
dyrect = 0.0_dbl_kind ! user defined grid spacing in cm in y direction
dxgrow = 1.0_dbl_kind ! user defined rectgrid x-grid growth factor (e.g., 1.02)
dygrow = 1.0_dbl_kind ! user defined rectgrid y-grid growth factor (e.g., 1.02)
close_boundaries = .false. ! true = set land on edges of grid
seabed_stress= .false. ! if true, seabed stress for landfast is on
seabed_stress_method = 'LKD'! LKD = Lemieux et al 2015, probabilistic = Dupont et al. in prep
Expand Down Expand Up @@ -847,6 +850,8 @@ subroutine input_data
call broadcast_scalar(grid_format, master_task)
call broadcast_scalar(dxrect, master_task)
call broadcast_scalar(dyrect, master_task)
call broadcast_scalar(dxgrow, master_task)
call broadcast_scalar(dygrow, master_task)
call broadcast_scalar(close_boundaries, master_task)
call broadcast_scalar(grid_type, master_task)
call broadcast_scalar(grid_ice, master_task)
Expand Down
99 changes: 77 additions & 22 deletions cicecore/cicedynB/infrastructure/ice_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ module ice_grid
dxrect, & ! user_specified spacing (cm) in x-direction (uniform HTN)
dyrect ! user_specified spacing (cm) in y-direction (uniform HTE)

! growth factor for variable spaced grid
real (kind=dbl_kind), public :: &
dxgrow, & ! user_specified growth factor in x direction (e.g., 1.02)
dygrow ! user_specified growth factor in y direction (e.g., 1.02)


! Corners of grid boxes for history output
real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: &
lont_bounds, & ! longitude of gridbox corners for T point
Expand Down Expand Up @@ -1361,7 +1367,7 @@ subroutine rectgrid
imid, jmid

real (kind=dbl_kind) :: &
length, &
length, l0, &
rad_to_deg

real (kind=dbl_kind), dimension(:,:), allocatable :: &
Expand Down Expand Up @@ -1392,16 +1398,30 @@ subroutine rectgrid

if (my_task == master_task) then
work_g1 = c0
length = dxrect*cm_to_m/radius*rad_to_deg
length = dxrect*cm_to_m/radius*rad_to_deg ! dah: base dlon

! work_g1(1,:) = -55._dbl_kind ! Weddell Sea
work_g1(1,:) = -156.5_dbl_kind ! Barrow AK
! work_g1(1,:) = -55._dbl_kind ! Weddell Sea
! work_g1(1,:) = -156.5_dbl_kind ! Barrow AK
work_g1(:,:) = -156.5_dbl_kind ! Barrow AK

do j = 1, ny_global
do i = 2, nx_global
work_g1(i,j) = work_g1(i-1,j) + length ! ULON
enddo
enddo
! for variable spaced grid,
! split grid spacing to work from center outward

! do from center of grid to left (west)
l0 = length ! first initialize length for ULON array
do i = (nx_global/2)-1, 1, -1
work_g1(i,j) = work_g1(i+1,j) + l0 ! ULON
l0 = l0*dxgrow
enddo ! i

! go from center to right (east)
l0 = length ! initialize lenght factor
do i = (nx_global/2)+1, nx_global, 1
work_g1(i,j) = work_g1(i-1,j) + l0 ! ULON
l0 = l0*dxgrow
enddo ! i
enddo ! j
work_g1(:,:) = work_g1(:,:) / rad_to_deg
endif
call scatter_global(ULON, work_g1, master_task, distrb_info, &
Expand All @@ -1413,14 +1433,28 @@ subroutine rectgrid
work_g1 = c0
length = dyrect*cm_to_m/radius*rad_to_deg

! work_g1(:,1) = -75._dbl_kind ! Weddell Sea
work_g1(:,1) = 71.35_dbl_kind ! Barrow AK
! work_g1(:,1) = -75._dbl_kind ! Weddell Sea
! work_g1(:,1) = 71.35_dbl_kind ! Barrow AK
work_g1(:,:) = 71.35_dbl_kind ! Barrow AK

do i = 1, nx_global
do j = 2, ny_global
work_g1(i,j) = work_g1(i,j-1) + length ! ULAT
enddo
enddo
! split domain to work from center to South/North
! to implement variable spaced grid

! here go fom center of grid south
l0 = length ! initialize lenght factor
do j = (ny_global/2)-1, 1, -1
work_g1(i,j) = work_g1(i,j+1) + l0 ! ULAT
l0 = l0*dygrow
enddo ! j

! here go fom center north
l0 = length ! initialize lenght factor
do j = (ny_global/2)+1, ny_global, 1
work_g1(i,j) = work_g1(i,j-1) + l0 ! ULAT
l0 = l0*dygrow
enddo ! j
enddo ! i
work_g1(:,:) = work_g1(:,:) / rad_to_deg
endif
call scatter_global(ULAT, work_g1, master_task, distrb_info, &
Expand All @@ -1430,19 +1464,40 @@ subroutine rectgrid

if (my_task == master_task) then
do j = 1, ny_global
do i = 1, nx_global
work_g1(i,j) = dxrect ! HTN
enddo
enddo
i = nx_global / 2 ! specify i index to initialize
work_g1(i,j) = dxrect ! initialize center
! go from center to left (west)
do i = (nx_global/2)-1, 1, -1
! expand based on dxgrow
work_g1(i,j) = work_g1(i+1,j)*dxgrow ! HTN
enddo ! i

! from center to right (east)
! loop starts at center+1
! already initialized center in above loop
do i = (nx_global/2)+1, nx_global, 1
! expand based on dxgrow
work_g1(i,j) = work_g1(i-1,j)*dxgrow ! HTN
enddo ! i
enddo ! j
endif
call primary_grid_lengths_HTN(work_g1) ! dxU, dxT, dxN, dxE

if (my_task == master_task) then
do j = 1, ny_global
do i = 1, nx_global
work_g1(i,j) = dyrect ! HTE
enddo
enddo
j = ny_global/2 ! specify j index to initalize
work_g1(i,j) = dyrect ! initialize denter

! go from center to south
do j = (ny_global/2)-1, 1, -1
work_g1(i,j) = work_g1(i,j+1)*dygrow ! HTE
enddo ! j

! go from center to north
do j = (ny_global/2)+1, nx_global, 1
work_g1(i,j) = work_g1(i,j-1)*dygrow ! HTE
enddo ! j
enddo ! i
endif
call primary_grid_lengths_HTE(work_g1) ! dyU, dyT, dyN, dyE

Expand Down
2 changes: 2 additions & 0 deletions configuration/scripts/ice_in
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
kcatbound = 0
dxrect = 30.e5
dyrect = 30.e5
dxgrow = 1.0
dygrow = 1.0
close_boundaries = .false.
ncat = 5
nfsd = 1
Expand Down
2 changes: 2 additions & 0 deletions configuration/scripts/options/set_nml.vargrid
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dxgrow = 1.02
dygrow = 1.01
2 changes: 2 additions & 0 deletions configuration/scripts/tests/gridsys_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ smoke gbox80 1x1 boxslotcyl
smoke gbox80 2x4 boxnodyn
#smoke gbox80 2x2 boxsymn,run1day
smoke gbox80 4x2 boxsyme,run1day
smoke gbox80 4x2 boxsyme,run1day,vargrid
#smoke gbox80 4x1 boxsymne,run1day
#smoke gbox80 2x2 boxsymn,run1day,kmtislands
smoke gbox80 4x1 boxsyme,run1day,kmtislands
smoke gbox80 4x1 boxsyme,run1day,kmtislands,vargrid
#smoke gbox80 4x2 boxsymne,run1day,kmtislands
#smoke gbox80 8x1 boxislandsn,run1day
smoke gbox80 4x2 boxislandse,run1day
Expand Down