Skip to content

Commit

Permalink
Add CM3 meltpond coupling (#14)
Browse files Browse the repository at this point in the history
* Add meltponds to ice export

* Scale pond fraction and depths to conserve area and volume

* Abort if tr_pond_lvl selected
  • Loading branch information
blimlim authored Jan 28, 2025
1 parent f5ca10f commit 5151c0b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
24 changes: 24 additions & 0 deletions cicecore/drivers/access/cmeps/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ subroutine cice_init1()
file=__FILE__,line= __LINE__)

call input_data ! namelist variables
call access_verify_inputs

call input_zbgc ! vertical biogeochemistry namelist
call count_tracers ! count tracers

Expand Down Expand Up @@ -465,6 +467,28 @@ end subroutine init_restart

!=======================================================================

subroutine access_verify_inputs()
! Check required namelist settings for ACCESS CM3
logical(kind=log_kind) :: &
tr_pond_lvl
character(len=*), parameter :: subname = '(access_verify_inputs)'


call icepack_query_tracer_flags(tr_pond_lvl_out=tr_pond_lvl)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(trim(subname), &
file=__FILE__,line= __LINE__)

if (tr_pond_lvl) then
write(nu_diag,*) subname//' ERROR: Wrong meltpond scheme selected'
write(nu_diag,*) subname//' ERROR: tr_pond_lvl = ', tr_pond_lvl
call abort_ice (error_message=subname//' Level pond scheme not supported in ACCESS CM3 coupling', &
file=__FILE__, line=__LINE__)
end if

end subroutine access_verify_inputs
!=======================================================================

end module CICE_InitMod

!=======================================================================
21 changes: 16 additions & 5 deletions cicecore/drivers/access/cmeps/ice_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2035,7 +2035,7 @@ subroutine ice_export_access(importState, exportState, ailohi, cpl_dt, rc)
use icepack_therm_shared, only: calculate_Tin_from_qin
use ice_state, only: aicen, vsnon, vicen, trcrn
! use icepack_therm_itd, only: nt_hpnd,
use icepack_tracers, only: nt_qsno, nt_hpnd, nt_sice, nt_qice
use icepack_tracers, only: nt_qsno, nt_hpnd, nt_apnd, nt_sice, nt_qice
use ice_arrays_column, only: apeffn

! input/output variables
Expand All @@ -2051,6 +2051,7 @@ subroutine ice_export_access(importState, exportState, ailohi, cpl_dt, rc)
integer :: ilo, ihi, jlo, jhi ! beginning and end of physical domain
logical :: flag
real (kind=dbl_kind), allocatable :: tempfld(:,:,:), tempfld1(:,:,:), ki_fld(:,:,:,:), hi1_fld(:,:,:,:)
real (kind=dbl_kind), allocatable :: pndfn_scaled(:,:,:,:), pndtn_scaled(:,:,:,:)
real(kind=dbl_kind), pointer :: fhocn_ptr(:), fresh_ptr(:), um_icenth(:), um_icesth(:)
real (kind=dbl_kind) :: hs1, hi1, Tmlt1, ki, rnslyr, rnilyr, licefw, liceht
character(len=*),parameter :: subname = 'ice_export_access'
Expand All @@ -2064,21 +2065,31 @@ subroutine ice_export_access(importState, exportState, ailohi, cpl_dt, rc)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=u_FILE_u, line=__LINE__)

! Create a temporary field
! Create temporary fields
allocate(tempfld(nx_block,ny_block,nblocks))
allocate(tempfld1(nx_block,ny_block,nblocks))

allocate(pndfn_scaled(nx_block,ny_block,ncat,nblocks))
allocate(pndtn_scaled(nx_block,ny_block,ncat,nblocks))

do n = 1, ncat
call state_setexport(exportState, 'ia_aicen', input=aicen , lmask=tmask, ifrac=ailohi, rc=rc, index=n, ungridded_index=n)
call state_setexport(exportState, 'ia_snown', input=vsnon , lmask=tmask, ifrac=ailohi, rc=rc, index=n, ungridded_index=n)
call state_setexport(exportState, 'ia_thikn', input=vicen , lmask=tmask, ifrac=ailohi, rc=rc, index=n, ungridded_index=n)
! call state_setexport(exportState, 'ia_pndfn', input=apeffn, lmask=tmask, ifrac=ailohi, rc=rc, index=n, ungridded_index=n)
! call state_setexport(exportState, 'ia_pndtn', input=trcrn(:,:,nt_hpnd,:,:), lmask=tmask, ifrac=ailohi, rc=rc, index=n, ungridded_index=n)
end do

call state_setexport(exportState, 'sstfrz', input=Tf , lmask=tmask, ifrac=ailohi, rc=rc)

! To conserve pond areas, scale by ice fractions before mapping. Unscale in the atmosphere after mapping
pndfn_scaled(:,:,:,:) = apeffn(:,:,:,:) * aicen(:,:,:,:)
! To conserve pond volumes, scale by the pond gridcell fraction before mapping. Unscale in the atmosphere
! after mapping
pndtn_scaled(:,:,:,:) = trcrn(:,:,nt_hpnd,:,:) * apeffn(:,:,:,:) * aicen(:,:,:,:)

do n = 1, ncat
call state_setexport(exportState, 'ia_pndfn', input=pndfn_scaled, lmask=tmask, ifrac=ailohi, rc=rc, index=n, ungridded_index=n)
call state_setexport(exportState, 'ia_pndtn', input=pndtn_scaled, lmask=tmask, ifrac=ailohi, rc=rc, index=n, ungridded_index=n)
end do

rnslyr = real(nslyr,kind=dbl_kind)
rnilyr = real(nilyr,kind=dbl_kind)

Expand Down

0 comments on commit 5151c0b

Please sign in to comment.