-
Notifications
You must be signed in to change notification settings - Fork 25
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 obtain ndep from datm or cam using cmeps/cdeps #410
Changes from 5 commits
3a64f47
c54a2d7
944dd2b
457c98f
d90b354
2b55a4e
6032936
80c8817
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -242,12 +242,12 @@ subroutine init_indices() | |
use mo_control_bgc, only: bgc_namelist,get_bgc_namelist, io_stdo_bgc | ||
use mo_control_bgc, only: use_BROMO,use_AGG,use_WLIN,use_natDIC,use_CFC,use_cisonew, & | ||
use_sedbypass,use_PBGC_OCNP_TIMESTEP,use_PBGC_CK_TIMESTEP, & | ||
use_FB_BGC_OCE, use_BOXATM,use_extNcycle,use_pref_tracers | ||
use_FB_BGC_OCE, use_BOXATM,use_extNcycle,use_pref_tracers,use_nuopc_ndep | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a line break here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
integer :: iounit | ||
|
||
namelist / config_bgc / use_BROMO,use_AGG,use_WLIN,use_natDIC,use_CFC,use_cisonew, & | ||
use_sedbypass,use_PBGC_OCNP_TIMESTEP,use_PBGC_CK_TIMESTEP, & | ||
use_FB_BGC_OCE,use_BOXATM,use_extNcycle,use_pref_tracers | ||
use_FB_BGC_OCE,use_BOXATM,use_extNcycle,use_pref_tracers,use_nuopc_ndep | ||
|
||
io_stdo_bgc = lp ! standard out. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,14 +90,14 @@ subroutine ini_read_ndep(kpie,kpje) | |
|
||
! Return if N deposition is turned off | ||
if (.not. do_ndep) then | ||
if (mnproc.eq.1) then | ||
if (mnproc == 1) then | ||
write(io_stdo_bgc,*) '' | ||
write(io_stdo_bgc,*) 'ini_read_ndep: N deposition is not activated.' | ||
endif | ||
return | ||
endif | ||
if (do_ndep_coupled) then | ||
if (mnproc.eq.1) then | ||
if (mnproc == 1) then | ||
write(io_stdo_bgc,*) '' | ||
write(io_stdo_bgc,*) 'ini_read_ndep: N deposition in interactive mode.' | ||
endif | ||
|
@@ -107,7 +107,7 @@ subroutine ini_read_ndep(kpie,kpje) | |
! Initialise the module | ||
if (.not. lini) then | ||
|
||
if (mnproc.eq.1) then | ||
if (mnproc == 1) then | ||
write(io_stdo_bgc,*)' ' | ||
write(io_stdo_bgc,*)'***************************************************' | ||
write(io_stdo_bgc,*)'iHAMOCC: Initialization of module mo_read_ndep:' | ||
|
@@ -116,7 +116,7 @@ subroutine ini_read_ndep(kpie,kpje) | |
|
||
! Check if nitrogen deposition file exists. If not, abort. | ||
inquire(file=ndepfile,exist=file_exists) | ||
if (.not. file_exists .and. mnproc.eq.1) then | ||
if (.not. file_exists .and. mnproc == 1) then | ||
write(io_stdo_bgc,*) '' | ||
write(io_stdo_bgc,*) 'ini_read_ndep: Cannot find N deposition file... ' | ||
call xchalt('(ini_read_ndep)') | ||
|
@@ -125,32 +125,32 @@ subroutine ini_read_ndep(kpie,kpje) | |
|
||
if (use_extNcycle) then | ||
! Allocate field to hold N-deposition fluxes | ||
if (mnproc.eq.1) then | ||
if (mnproc == 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' | ||
if(errstat /= 0) stop 'not enough memory nhxdepread' | ||
nhxdepread(:,:) = 0.0 | ||
|
||
if (mnproc.eq.1) then | ||
if (mnproc == 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' | ||
if(errstat /= 0) stop 'not enough memory noydepread' | ||
noydepread(:,:) = 0.0 | ||
else | ||
! Allocate field to hold N-deposition fluxes | ||
if (mnproc.eq.1) then | ||
if (mnproc == 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' | ||
if(errstat /= 0) stop 'not enough memory ndep' | ||
ndepread(:,:) = 0.0 | ||
endif | ||
|
||
|
@@ -160,7 +160,7 @@ subroutine ini_read_ndep(kpie,kpje) | |
call ncgeti('endyear',endyear) | ||
call ncfcls | ||
|
||
if (mnproc.eq.1) then | ||
if (mnproc == 1) then | ||
write(io_stdo_bgc,*) '' | ||
write(io_stdo_bgc,*) 'ini_read_ndep: Using N deposition file '//trim(ndepfile) | ||
endif | ||
|
@@ -182,7 +182,7 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd | |
|
||
use mod_xc, only: mnproc | ||
use netcdf, only: nf90_open,nf90_close,nf90_nowrite | ||
use mo_control_bgc, only: io_stdo_bgc,do_ndep,use_extNcycle, do_ndep_coupled | ||
use mo_control_bgc, only: io_stdo_bgc, do_ndep, use_extNcycle, do_ndep_coupled, use_nuopc_ndep | ||
use mo_netcdf_bgcrw, only: read_netcdf_var | ||
use mo_param1_bgc, only: nndep,idepnoy,idepnhx | ||
use mo_chemcon, only: mw_nitrogen | ||
|
@@ -209,12 +209,14 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd | |
return | ||
endif | ||
|
||
if (use_extNcycle .and. do_ndep_coupled) then | ||
! If use_nuopc_ndep, nitrogen deposition is ALWAYS obtained from the | ||
! nuopc mediator | ||
if ((use_nuopc_ndep) .or. (use_extNcycle .and. do_ndep_coupled)) then | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dear @mvertens , I am not fully getting your logics here. If I am not mistaken, the source of N-deposition (whether it comes from CAM or from input files) will be decided at the level of the nuopc, right - so the
|
||
! get N-deposition from atmosphere | ||
fatmndep = 365.*86400./mw_nitrogen | ||
ndep(:,:,:) = 0. | ||
!$OMP PARALLEL DO PRIVATE(i) | ||
!$omp parallel do private(i) | ||
do j=1,kpje | ||
do i=1,kpie | ||
! convert from kgN/m2/s to climatological input file units: kmolN/m2/yr | ||
|
@@ -226,17 +228,28 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd | |
endif | ||
enddo | ||
enddo | ||
!$OMP END PARALLEL DO | ||
if (mnproc .eq. 1) then | ||
!$omp end parallel do | ||
if (mnproc == 1) then | ||
write (io_stdo_bgc,*) 'iHAMOCC: getting NOy and NHx deposition from atm' | ||
endif | ||
|
||
if (use_nuopc_ndep .and. .not. use_extNcycle) then | ||
! Reduced and oxidized forms will all enter the NO3 pool | ||
!$omp parallel do private(i) | ||
do j=1,kpje | ||
do i=1,kpie | ||
ndep(i,j,idepnoy) = ndep(i,j,idepnoy) + ndep(i,j,idepnhx) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am a bit puzzled in this line: if
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I I am not mistaken, this would also affect the former loop above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jmaerz - thanks for catching this. You are totally right. I agree with your suggested change. |
||
enddo | ||
enddo | ||
!$omp end parallel do | ||
end if | ||
|
||
else | ||
|
||
! read ndep data from file | ||
if (kplmon.ne.oldmonth) then | ||
if (kplmon /= oldmonth) then | ||
month_in_file=(max(startyear,min(endyear,kplyear))-startyear)*12+kplmon | ||
if (mnproc.eq.1) then | ||
if (mnproc == 1) then | ||
write(io_stdo_bgc,*) 'Read N deposition month ',month_in_file,' from file ',trim(ndepfile) | ||
endif | ||
ncstat=nf90_open(trim(ndepfile),nf90_nowrite,ncid) | ||
|
@@ -250,10 +263,10 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd | |
oldmonth=kplmon | ||
endif | ||
|
||
!$OMP PARALLEL DO PRIVATE(i) | ||
!$omp parallel do private(i) | ||
! 1 = NO3; 2 = NH4 | ||
do j=1,kpje | ||
do i=1,kpie | ||
do j=1,kpje | ||
do i=1,kpie | ||
if (use_extNcycle) then | ||
ndep(i,j,idepnoy) = noydepread(i,j) | ||
ndep(i,j,idepnhx) = nhxdepread(i,j) | ||
|
@@ -262,7 +275,7 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd | |
endif | ||
enddo | ||
enddo | ||
!$OMP END PARALLEL DO | ||
!$omp end parallel do | ||
|
||
endif | ||
end subroutine get_ndep | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question out of curiosity: what is the use_arctic switch for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use_arctic has a different communication pattern in mod_xc.F90.
In particular - it checks that all arctic patch tiles must be the same size or empty,
and empty tiles must be "twinned" across the top boundary. It ensures that the latitudinal tile dimension is closed/arctic and handles the halo in the arctic differently. @matsbn - do you want to add more?