Skip to content

Commit

Permalink
Always allocate shelfmask array (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasTorsvik authored Dec 3, 2024
1 parent 9f854b4 commit edf39f3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions hamocc/mo_read_shelfmask.F90
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ subroutine ini_read_shelfmask(kpie,kpje,kbnd,pbath,omask)
integer :: i,j,errstat,ncid,ncstat
real,allocatable :: mask(:,:)

! Always allocate field to hold shelfsea mask
if(mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable shelfmask ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate(shelfmask(kpie,kpje),stat=errstat)
allocate(mask(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory shelfmask'
shelfmask(:,:) = .false.
mask = 0.

! Check, if we are going to run with shelf-sea water residence time tracers
if (.not.use_shelfsea_res_time) then
if (mnproc.eq.1) then
Expand All @@ -82,18 +94,6 @@ subroutine ini_read_shelfmask(kpie,kpje,kbnd,pbath,omask)
write(io_stdo_bgc,*) '... using internal bathymetry data to reconstruct the mask '
endif

! Allocate field to hold shelfsea mask
if(mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable shelfmask ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate(shelfmask(kpie,kpje),stat=errstat)
allocate(mask(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory shelfmask'
shelfmask(:,:) = .false.
mask = 0.

if (file_exists) then
! read shelf sea mask from file
if (mnproc.eq.1) then
Expand Down

0 comments on commit edf39f3

Please sign in to comment.