Skip to content

Commit

Permalink
Add some variables for CD discretization (#21)
Browse files Browse the repository at this point in the history
* Prototype variables for CD grid discretization

* Fix syntax error

* Change variable names to ratio and only need 4

* Needed minus signs and fix alignment

* Make the ratios consistent with the doc
  • Loading branch information
dabail10 authored Nov 18, 2021
1 parent b401c08 commit e3112eb
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cicecore/cicedynB/infrastructure/ice_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ module ice_grid
dxhy , & ! 0.5*(HTE(i,j) - HTW(i,j)) = 0.5*(HTE(i,j) - HTE(i-1,j))
dyhx ! 0.5*(HTN(i,j) - HTS(i,j)) = 0.5*(HTN(i,j) - HTN(i,j-1))

real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: &
ratiodxN , & ! - dxn(i+1,j) / dxn(i,j)
ratiodyE , & ! - dye(i ,j+1) / dye(i,j)
ratiodxNr , & ! 1 / ratiodxN
ratiodyEr ! 1 / ratiodyE

! grid dimensions for rectangular grid
real (kind=dbl_kind), public :: &
dxrect, & ! user_specified spacing (cm) in x-direction (uniform HTN)
Expand Down Expand Up @@ -255,6 +261,16 @@ subroutine alloc_grid
stat=ierr)
if (ierr/=0) call abort_ice(subname//'ERROR: Out of memory')

if (grid_system == 'CD') then
allocate( &
ratiodxN (nx_block,ny_block,max_blocks), &
ratiodyE (nx_block,ny_block,max_blocks), &
ratiodxNr(nx_block,ny_block,max_blocks), &
ratiodyEr(nx_block,ny_block,max_blocks), &
stat=ierr)
if (ierr/=0) call abort_ice(subname//'ERROR: Out of memory')
endif

if (pgl_global_ext) then
allocate( &
G_HTE(nx_global+2*nghost, ny_global+2*nghost), & ! length of eastern edge of T-cell (global ext.)
Expand Down Expand Up @@ -502,6 +518,17 @@ subroutine init_grid2
enddo
enddo

if (grid_system == 'CD') then
do j = jlo, jhi
do i = ilo, ihi
ratiodxN (i,j,iblk) = - dxn(i+1,j ,iblk) / dxn(i,j,iblk)
ratiodyE (i,j,iblk) = - dye(i ,j+1,iblk) / dye(i,j,iblk)
ratiodxNr(i,j,iblk) = c1 / ratiodxn(i,j,iblk)
ratiodyEr(i,j,iblk) = c1 / ratiodye(i,j,iblk)
enddo
enddo
endif

enddo ! iblk
!$OMP END PARALLEL DO

Expand Down

0 comments on commit e3112eb

Please sign in to comment.