diff --git a/hamocc/mo_read_ndep.F90 b/hamocc/mo_read_ndep.F90 index 723e2c24..d953a7b9 100644 --- a/hamocc/mo_read_ndep.F90 +++ b/hamocc/mo_read_ndep.F90 @@ -57,7 +57,6 @@ module mo_read_ndep public :: ndepfile character(len=512) :: ndepfile='' - real, allocatable :: ndepread(:,:) real, allocatable :: noydepread(:,:) real, allocatable :: nhxdepread(:,:) integer :: startyear,endyear @@ -96,7 +95,7 @@ subroutine ini_read_ndep(kpie,kpje) endif return endif - if (do_ndep_coupled) then + if (do_ndep_coupled .and. use_extNcycle) then if (mnproc.eq.1) then write(io_stdo_bgc,*) '' write(io_stdo_bgc,*) 'ini_read_ndep: N deposition in interactive mode.' @@ -123,36 +122,24 @@ subroutine ini_read_ndep(kpie,kpje) stop '(ini_read_ndep)' endif - if (use_extNcycle) then - ! Allocate field to hold N-deposition fluxes - if (mnproc.eq.1) then - write(io_stdo_bgc,*)'Memory allocation for variable nhxdepread ...' - write(io_stdo_bgc,*)'First dimension : ',kpie - write(io_stdo_bgc,*)'Second dimension : ',kpje - endif - allocate (nhxdepread(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory nhxdepread' - nhxdepread(:,:) = 0.0 + ! Allocate fields to hold N-deposition fluxes + if (mnproc.eq.1) then + write(io_stdo_bgc,*)'Memory allocation for variable nhxdepread ...' + write(io_stdo_bgc,*)'First dimension : ',kpie + write(io_stdo_bgc,*)'Second dimension : ',kpje + endif + allocate (nhxdepread(kpie,kpje),stat=errstat) + if(errstat.ne.0) stop 'not enough memory nhxdepread' + nhxdepread(:,:) = 0.0 - if (mnproc.eq.1) then - write(io_stdo_bgc,*)'Memory allocation for variable noydepread ...' - write(io_stdo_bgc,*)'First dimension : ',kpie - write(io_stdo_bgc,*)'Second dimension : ',kpje - endif - allocate (noydepread(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory noydepread' - noydepread(:,:) = 0.0 - else - ! Allocate field to hold N-deposition fluxes - if (mnproc.eq.1) then - write(io_stdo_bgc,*)'Memory allocation for variable ndepread ...' - write(io_stdo_bgc,*)'First dimension : ',kpie - write(io_stdo_bgc,*)'Second dimension : ',kpje - endif - allocate (ndepread(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory ndep' - ndepread(:,:) = 0.0 + if (mnproc.eq.1) then + write(io_stdo_bgc,*)'Memory allocation for variable noydepread ...' + write(io_stdo_bgc,*)'First dimension : ',kpie + write(io_stdo_bgc,*)'Second dimension : ',kpje endif + allocate (noydepread(kpie,kpje),stat=errstat) + if(errstat.ne.0) stop 'not enough memory noydepread' + noydepread(:,:) = 0.0 ! read start and end year of n-deposition file call ncfopn(trim(ndepfile),'r',' ',1,iotype) @@ -237,15 +224,12 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd if (kplmon.ne.oldmonth) then month_in_file=(max(startyear,min(endyear,kplyear))-startyear)*12+kplmon if (mnproc.eq.1) then - write(io_stdo_bgc,*) 'Read N deposition month ',month_in_file,' from file ',trim(ndepfile) + write(io_stdo_bgc,*) 'Read NHx and NOy deposition month ', & + & month_in_file,' from file ',trim(ndepfile) endif ncstat=nf90_open(trim(ndepfile),nf90_nowrite,ncid) - if (use_extNcycle) then - call read_netcdf_var(ncid,'nhxdep',nhxdepread,1,month_in_file,0) - call read_netcdf_var(ncid,'noydep',noydepread,1,month_in_file,0) - else - call read_netcdf_var(ncid,'ndep',ndepread,1,month_in_file,0) - endif + call read_netcdf_var(ncid,'nhxdep',nhxdepread,1,month_in_file,0) + call read_netcdf_var(ncid,'noydep',noydepread,1,month_in_file,0) ncstat=nf90_close(ncid) oldmonth=kplmon endif @@ -255,10 +239,12 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd do j=1,kpje do i=1,kpie if (use_extNcycle) then + ! Separation between reduced and oxidized N species (NHx and NOy) ndep(i,j,idepnoy) = noydepread(i,j) ndep(i,j,idepnhx) = nhxdepread(i,j) else - ndep(i,j,idepnoy) = ndepread(i,j) + ! Reduced and oxidized forms will all enter the NO3 pool + ndep(i,j,idepnoy) = nhxdepread(i,j) + noydepread(i,j) endif enddo enddo