From 83e27f79788a858c57111db078bdfc2bb04252b4 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 23 Dec 2024 12:06:04 -0700 Subject: [PATCH] Move nfix_t* param-read from pftconMod (public) to CNFUNMod (local) --- src/biogeochem/CNFUNMod.F90 | 23 +++++++++++++++++++---- src/main/pftconMod.F90 | 18 ------------------ 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/biogeochem/CNFUNMod.F90 b/src/biogeochem/CNFUNMod.F90 index 0b3382f041..af29d26c74 100644 --- a/src/biogeochem/CNFUNMod.F90 +++ b/src/biogeochem/CNFUNMod.F90 @@ -54,6 +54,9 @@ module CNFUNMod type, private :: params_type real(r8) :: ndays_off ! number of days to complete leaf offset + real(r8), allocatable :: nfix_tmin(:) ! A BNF parameter + real(r8), allocatable :: nfix_topt(:) ! A BNF parameter + real(r8), allocatable :: nfix_tmax(:) ! A BNF parameter end type params_type ! @@ -86,6 +89,7 @@ subroutine readParams ( ncid ) ! ! !USES: use ncdio_pio , only : file_desc_t,ncd_io + use clm_varpar, only : mxpft ! !ARGUMENTS: implicit none @@ -106,6 +110,20 @@ subroutine readParams ( ncid ) if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) params_inst%ndays_off=tempr + allocate(params_inst%nfix_tmin(mxpft)) + tString='nfix_tmin' + call ncd_io(trim(tString), params_inst%nfix_tmin(:), 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + + allocate(params_inst%nfix_topt(mxpft)) + tString='nfix_topt' + call ncd_io(trim(tString), params_inst%nfix_topt(:), 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + + allocate(params_inst%nfix_tmax(mxpft)) + tString='nfix_tmax' + call ncd_io(trim(tString), params_inst%nfix_tmax(:), 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) end subroutine readParams @@ -505,9 +523,6 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp& b_fix => pftcon%b_fix , & ! Input: A BNF parameter c_fix => pftcon%c_fix , & ! Input: A BNF parameter s_fix => pftcon%s_fix , & ! Input: A BNF parameter - nfix_tmin => pftcon%nfix_tmin , & ! Input: A BNF parameter - nfix_topt => pftcon%nfix_topt , & ! Input: A BNF parameter - nfix_tmax => pftcon%nfix_tmax , & ! Input: A BNF parameter akc_active => pftcon%akc_active , & ! Input: A mycorrhizal uptake ! parameter akn_active => pftcon%akn_active , & ! Input: A mycorrhizal uptake @@ -1067,7 +1082,7 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp& big_cost,crootfr(p,j),s_fix(ivt(p)),tc_soisno(c,j)) case ('Bytnerowicz') ! no acclimation calculation costNit(j,icostFix) = fun_cost_fix_Bytnerowicz_noAcc(fixer, & - nfix_tmin(ivt(p)),nfix_topt(ivt(p)),nfix_tmax(ivt(p)), & + params_inst%nfix_tmin(ivt(p)), params_inst%nfix_topt(ivt(p)), params_inst%nfix_tmax(ivt(p)), & big_cost,crootfr(p,j),s_fix(ivt(p)),tc_soisno(c,j)) case default errCode = ' ERROR: unknown nfix_method value: ' // nfix_method diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 19165b24be..b987879c03 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -268,9 +268,6 @@ module pftconMod real(r8), allocatable :: b_fix (:) ! A BNF parameter real(r8), allocatable :: c_fix (:) ! A BNF parameter real(r8), allocatable :: s_fix (:) ! A BNF parameter - real(r8), allocatable :: nfix_tmin (:) ! A BNF parameter - real(r8), allocatable :: nfix_topt (:) ! A BNF parameter - real(r8), allocatable :: nfix_tmax (:) ! A BNF parameter real(r8), allocatable :: akc_active (:) ! A mycorrhizal uptake parameter real(r8), allocatable :: akn_active (:) ! A mycorrhizal uptake parameter real(r8), allocatable :: ekc_active (:) ! A mycorrhizal uptake parameter @@ -488,9 +485,6 @@ subroutine InitAllocate (this) allocate( this%b_fix (0:mxpft) ) allocate( this%c_fix (0:mxpft) ) allocate( this%s_fix (0:mxpft) ) - allocate( this%nfix_tmin (0:mxpft) ) - allocate( this%nfix_topt (0:mxpft) ) - allocate( this%nfix_tmax (0:mxpft) ) allocate( this%akc_active (0:mxpft) ) allocate( this%akn_active (0:mxpft) ) allocate( this%ekc_active (0:mxpft) ) @@ -886,15 +880,6 @@ subroutine InitRead(this) call ncd_io('s_fix', this%s_fix, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - call ncd_io('nfix_tmin', this%nfix_tmin, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('nfix_topt', this%nfix_topt, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('nfix_tmax', this%nfix_tmax, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - call ncd_io('akc_active', this%akc_active, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) @@ -1590,9 +1575,6 @@ subroutine Clean(this) deallocate( this%b_fix) deallocate( this%c_fix) deallocate( this%s_fix) - deallocate( this%nfix_tmin) - deallocate( this%nfix_topt) - deallocate( this%nfix_tmax) deallocate( this%akc_active) deallocate( this%akn_active) deallocate( this%ekc_active)