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

bugfix for fgrg_rofi computation #295

Merged
merged 2 commits into from
Aug 11, 2024
Merged
Changes from all 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
17 changes: 11 additions & 6 deletions dglc/dglc_datamode_noevolve_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ module dglc_datamode_noevolve_mod
! type(icesheet_ptr_t), allocatable :: So_t(:)
! type(icesheet_ptr_t), allocatable :: So_q(:)

real(r8), allocatable :: usrf(:) ! upper surface elevation (m) on ice grid

! Export Field names
character(len=*), parameter :: field_out_area = 'Sg_area'
character(len=*), parameter :: field_out_topo = 'Sg_topo'
Expand Down Expand Up @@ -238,8 +240,7 @@ subroutine dglc_datamode_noevolve_advance(pio_subsystem, io_type, io_format, &
real(r8) :: rhoi ! density of ice ~ kg/m^3
real(r8) :: rhoo ! density of sea water ~ kg/m^3
real(r8) :: eus ! eustatic sea level
real(r8), allocatable :: lsrf(:)
real(r8), allocatable :: usrf(:)
real(r8), allocatable :: lsrf(:) ! lower surface elevation (m) on ice grid
character(len=*), parameter :: subname='(dglc_datamode_noevolve_advance): '
!-------------------------------------------------------------------------------

Expand Down Expand Up @@ -316,8 +317,8 @@ subroutine dglc_datamode_noevolve_advance(pio_subsystem, io_type, io_format, &
rcode = pio_inq_varid(pioid, 'thk', varid)
call pio_read_darray(pioid, varid, pio_iodesc, thck, rcode)

allocate(lsrf(lsize))
allocate(usrf(lsize))
allocate(lsrf(lsize))

rhoi = SHR_CONST_RHOICE ! 0.917e3
rhoo = SHR_CONST_RHOSW ! 1.026e3
Expand Down Expand Up @@ -360,7 +361,6 @@ subroutine dglc_datamode_noevolve_advance(pio_subsystem, io_type, io_format, &
end do

deallocate(lsrf)
deallocate(usrf)

call pio_closefile(pioid)
call pio_freedecomp(pio_subsystem, pio_iodesc)
Expand All @@ -372,8 +372,13 @@ subroutine dglc_datamode_noevolve_advance(pio_subsystem, io_type, io_format, &
if (initialized_noevolve) then
! Compute Fgrg_rofi
do ns = 1,num_icesheets
do ng = 1,size(Fgrg_rofi(ns)%ptr)
Fgrg_rofi(ns)%ptr(ng) = Flgl_qice(ns)%ptr(ng)
lsize = size(Fgrg_rofi(ns)%ptr)
do ng = 1,lsize
if (is_in_active_grid(usrf(ng))) then
Fgrg_rofi(ns)%ptr(ng) = Flgl_qice(ns)%ptr(ng)
else
Fgrg_rofi(ns)%ptr(ng) = 0._r8
end if
end do
end do
end if
Expand Down
Loading