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

Always allocate shelfmask array #441

Merged
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
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
Loading