diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 2a2d14eb69..ab0aab0cc5 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -5209,6 +5209,7 @@ sub write_output_files { } push @groups, "clm_humanindex_inparm"; push @groups, "cnmresp_inparm"; + push @groups, "cnfun_inparm"; push @groups, "photosyns_inparm"; push @groups, "cnfire_inparm"; push @groups, "cn_general"; diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 3f63ccaa72..ac61b86852 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -388,8 +388,8 @@ Slope of free living Nitrogen fixation with annual ET Intercept of free living Nitrogen fixation with zero annual ET - + Choice of nfix parameterization diff --git a/src/biogeochem/CNFUNMod.F90 b/src/biogeochem/CNFUNMod.F90 index af29d26c74..b66083db2f 100644 --- a/src/biogeochem/CNFUNMod.F90 +++ b/src/biogeochem/CNFUNMod.F90 @@ -48,10 +48,13 @@ module CNFUNMod private ! ! !PUBLIC MEMBER FUNCTIONS: + public :: CNFUNReadNML ! Read in namelist variables public:: readParams ! Read in parameters needed for FUN public:: CNFUNInit ! FUN calculation initialization public:: CNFUN ! Run FUN + character(len=25) :: nfix_method ! choice of nfix parameterization + type, private :: params_type real(r8) :: ndays_off ! number of days to complete leaf offset real(r8), allocatable :: nfix_tmin(:) ! A BNF parameter @@ -85,6 +88,62 @@ module CNFUNMod contains !-------------------------------------------------------------------- !--- + subroutine CNFUNReadNML(NLFilename) + ! + ! !DESCRIPTION: + ! Read in namelist variables + ! + ! !USES: + use fileutils , only : getavu, relavu, opnfil + use shr_nl_mod , only : shr_nl_find_group_name + use spmdMod , only : masterproc, mpicom + use shr_mpi_mod, only : shr_mpi_bcast + use clm_varctl , only : iulog + use spmdMod , only : MPI_CHARACTER + ! + ! !ARGUMENTS: + character(len=*), intent(in) :: NLFilename ! Namelist filename + ! + ! !LOCAL VARIABLES: + integer :: ierr ! error code + integer :: unitn ! unit for namelist file + + character(len=*), parameter :: nmlname = 'cnfun_inparm' + !----------------------------------------------------------------------- + + namelist /cnfun_inparm/ nfix_method + + ! Initialize options to default values, in case they are not specified in + ! the namelist + + if (masterproc) then + unitn = getavu() + write(iulog,*) 'Read in '//nmlname//' namelist' + call opnfil (NLFilename, unitn, 'F') + call shr_nl_find_group_name(unitn, nmlname, status=ierr) + if (ierr == 0) then + read(unitn, nml=cnfun_inparm, iostat=ierr) + if (ierr /= 0) then + call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) + end if + else + call endrun(msg="ERROR finding "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) + end if + call relavu( unitn ) + end if + + call mpi_bcast (nfix_method, len(nfix_method), MPI_CHARACTER, 0, mpicom, ierr) + + if (masterproc) then + write(iulog,*) ' ' + write(iulog,*) nmlname//' settings:' + write(iulog,nml=cnfun_inparm) + write(iulog,*) ' ' + end if + + end subroutine CNFUNReadNML + + !----------------------------------------------------------------------- subroutine readParams ( ncid ) ! ! !USES: @@ -222,7 +281,7 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp& use clm_time_manager, only : get_step_size_real, get_curr_date use clm_varpar , only : nlevdecomp use clm_varcon , only : secspday, smallValue, fun_period, tfrz, dzsoi_decomp, spval - use clm_varctl , only : use_nitrif_denitrif, nfix_method + use clm_varctl , only : use_nitrif_denitrif use PatchType , only : patch use subgridAveMod , only : p2c use pftconMod , only : npcropmin diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 0989400961..9539060200 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -227,8 +227,6 @@ module clm_varctl ! real(r8), public :: nfix_timeconst = -1.2345_r8 - character(len=25), public :: nfix_method ! choice of nfix parameterization - !---------------------------------------------------------- ! Physics !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 61c56f5201..e8121519aa 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -119,6 +119,7 @@ subroutine control_init(dtime) ! ! !USES: use CNMRespMod , only : CNMRespReadNML + use CNFUNMod , only : CNFUNReadNML use CNNDynamicsMod , only : CNNDynamicsReadNML use CNPhenologyMod , only : CNPhenologyReadNML use landunit_varcon , only : max_lunit @@ -257,8 +258,6 @@ subroutine control_init(dtime) CNratio_floating, lnc_opt, reduce_dayl_factor, vcmax_opt, & CN_evergreen_phenology_opt, carbon_resp_opt - namelist /clm_nitrogen/ nfix_method - namelist /clm_inparm/ use_soil_moisture_streams ! excess ice flag @@ -598,6 +597,7 @@ subroutine control_init(dtime) if ( use_fun ) then call CNMRespReadNML( NLFilename ) + call CNFUNReadNML( NLFilename ) end if call soilHydReadNML( NLFilename ) @@ -884,7 +884,6 @@ subroutine control_spmd() call mpi_bcast (use_c13_timeseries, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (atm_c13_filename, len(atm_c13_filename), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (use_fun, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (nfix_method, len(nfix_method), MPI_CHARACTER, 0, mpicom, ier) end if call mpi_bcast (perchroot, 1, MPI_LOGICAL, 0, mpicom, ier)