Skip to content

Commit

Permalink
Move nfix_t* param-read from pftconMod (public) to CNFUNMod (local)
Browse files Browse the repository at this point in the history
  • Loading branch information
slevis-lmwg committed Dec 23, 2024
1 parent 5e27db7 commit 83e27f7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
23 changes: 19 additions & 4 deletions src/biogeochem/CNFUNMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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

!
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 0 additions & 18 deletions src/main/pftconMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) )
Expand Down Expand Up @@ -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__))

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 83e27f7

Please sign in to comment.