-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1448 from ESMCI/mvertens/ndep
Mvertens/ndep new optional ndep stream from atm Changes to driver to add ndep fields from atm to land and ocean - IF they appear in drv_flds_in. These needed for CESM/CMIP6 Test suite: scripts_regression_tests also verified that the following two tests were bfb with in cesm ERP_Ln9.f09_f09.F1850_DONOTUSE.yellowstone_intel.cam-outfrq9s_clm5 ERI.f09_g17.B1850.yellowstone_intel.allactive-defaultio Test baseline: alpha06j Test namelist changes: Test status: bit-for-bit Fixes: None User interface changes?: None Code review: edwards, sacks, craig, jacob
- Loading branch information
Showing
3 changed files
with
161 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
module shr_ndep_mod | ||
|
||
!======================================================================== | ||
! Module for handling nitrogen depostion of tracers. | ||
! This module is shared by land and atmosphere models for the computations of | ||
! dry deposition of tracers | ||
!======================================================================== | ||
|
||
!USES: | ||
use shr_sys_mod, only : shr_sys_abort | ||
use shr_log_mod, only : s_loglev => shr_log_Level | ||
use shr_kind_mod, only : r8 => shr_kind_r8, CS => SHR_KIND_CS, CX => SHR_KIND_CX | ||
|
||
implicit none | ||
save | ||
|
||
private | ||
|
||
! !PUBLIC MEMBER FUNCTIONS | ||
public :: shr_ndep_readnl ! Read namelist | ||
!==================================================================================== | ||
|
||
CONTAINS | ||
|
||
!==================================================================================== | ||
subroutine shr_ndep_readnl(NLFilename, ID, ndep_fields, add_ndep_fields) | ||
|
||
!======================================================================== | ||
! reads ndep_inparm namelist and sets up driver list of fields for | ||
! atmosphere -> land and atmosphere -> ocn communications. | ||
!======================================================================== | ||
|
||
use shr_file_mod , only : shr_file_getUnit, shr_file_freeUnit | ||
use shr_log_mod , only : s_logunit => shr_log_Unit | ||
use seq_comm_mct , only : seq_comm_iamroot, seq_comm_setptrs | ||
use shr_mpi_mod , only : shr_mpi_bcast | ||
use shr_nl_mod , only : shr_nl_find_group_name | ||
implicit none | ||
|
||
character(len=*), intent(in) :: NLFilename ! Namelist filename | ||
integer , intent(in) :: ID ! seq_comm ID | ||
character(len=*), intent(out) :: ndep_fields | ||
logical , intent(out) :: add_ndep_fields | ||
|
||
!----- local ----- | ||
integer :: i ! Indices | ||
integer :: unitn ! namelist unit number | ||
integer :: ierr ! error code | ||
logical :: exists ! if file exists or not | ||
character(len=8) :: token ! dry dep field name to add | ||
integer :: mpicom ! MPI communicator | ||
|
||
integer, parameter :: maxspc = 100 ! Maximum number of species | ||
character(len=32) :: ndep_list(maxspc) = '' ! List of ndep species | ||
|
||
!----- formats ----- | ||
character(*),parameter :: subName = '(shr_ndep_read) ' | ||
character(*),parameter :: F00 = "('(shr_ndep_read) ',8a)" | ||
character(*),parameter :: FI1 = "('(shr_ndep_init) ',a,I2)" | ||
|
||
namelist /ndep_inparm/ ndep_list | ||
|
||
!----------------------------------------------------------------------------- | ||
! Read namelist and figure out the ndep field list to pass | ||
! First check if file exists and if not, n_ndep will be zero | ||
!----------------------------------------------------------------------------- | ||
|
||
!--- Open and read namelist --- | ||
if ( len_trim(NLFilename) == 0 ) then | ||
call shr_sys_abort( subName//'ERROR: nlfilename not set' ) | ||
end if | ||
call seq_comm_setptrs(ID,mpicom=mpicom) | ||
if (seq_comm_iamroot(ID)) then | ||
inquire( file=trim(NLFileName), exist=exists) | ||
if ( exists ) then | ||
unitn = shr_file_getUnit() | ||
open( unitn, file=trim(NLFilename), status='old' ) | ||
if ( s_loglev > 0 ) then | ||
write(s_logunit,F00) 'Read in ndep_inparm namelist from: ', trim(NLFilename) | ||
end if | ||
call shr_nl_find_group_name(unitn, 'ndep_inparm', ierr) | ||
if (ierr == 0) then | ||
ierr = 1 | ||
do while ( ierr /= 0 ) | ||
read(unitn, ndep_inparm, iostat=ierr) | ||
if (ierr < 0) then | ||
call shr_sys_abort( subName//'ERROR: encountered end-of-file on namelist read' ) | ||
endif | ||
end do | ||
close( unitn ) | ||
else | ||
write(s_logunit,*) 'shr_ndep_readnl: no ndep_inparm namelist found in ',NLFilename | ||
endif | ||
call shr_file_freeUnit( unitn ) | ||
end if | ||
end if | ||
call shr_mpi_bcast( ndep_list, mpicom ) | ||
|
||
ndep_fields = ' ' | ||
if (len_trim(ndep_list(1)) == 0) then | ||
add_ndep_fields = .false. | ||
else | ||
! Loop over species to fill list of fields to communicate for ndep | ||
add_ndep_fields = .true. | ||
do i=1,maxspc | ||
if ( len_trim(ndep_list(i))==0 ) exit | ||
if ( i == 1 ) then | ||
ndep_fields = 'Faxa_' // trim(ndep_list(i)) | ||
else | ||
ndep_fields = trim(ndep_fields)//':'//'Faxa_' // trim(ndep_list(i)) | ||
endif | ||
enddo | ||
end if | ||
|
||
end subroutine shr_ndep_readnl | ||
|
||
end module shr_ndep_mod |