Skip to content

Commit

Permalink
Make jmaxb0, wc2wjb0, r_mort pft-dimensioned
Browse files Browse the repository at this point in the history
  • Loading branch information
olyson committed Oct 22, 2024
1 parent 694333f commit 77b8e80
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
13 changes: 3 additions & 10 deletions src/biogeochem/CNGapMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ module CNGapMortalityMod
public :: CNGapMortality

type, private :: params_type
real(r8):: am ! mortality rate based on annual rate, fractional mortality (1/yr)
real(r8):: k_mort ! coeff. of growth efficiency in mortality equation
end type params_type
!
Expand Down Expand Up @@ -70,11 +69,6 @@ subroutine readParams ( ncid )
character(len=100) :: tString ! temp. var for reading
!-----------------------------------------------------------------------

tString='r_mort'
call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%am=tempr

tString='k_mort'
call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
Expand Down Expand Up @@ -140,6 +134,7 @@ subroutine CNGapMortality (bounds, num_soilp, filter_soilp, &

leafcn => pftcon%leafcn , & ! Input: [real(r8) (:)] leaf C:N (gC/gN)
livewdcn => pftcon%livewdcn , & ! Input: [real(r8) (:)] live wood (phloem and ray parenchyma) C:N (gC/gN)
r_mort => pftcon%r_mort , & ! Input: [real(r8) (:)] Mortality rate (1/year)
laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index
laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index
nind => dgvs_inst%nind_patch , & ! Output:[real(r8)(:)] number of individuals (#/m2) added by F. Li and S. Levis
Expand Down Expand Up @@ -183,8 +178,6 @@ subroutine CNGapMortality (bounds, num_soilp, filter_soilp, &
)

dt = real( get_step_size(), r8 )
! set the mortality rate based on annual rate
am = params_inst%am
! set coeff of growth efficiency in mortality equation
k_mort = params_inst%k_mort

Expand Down Expand Up @@ -216,12 +209,12 @@ subroutine CNGapMortality (bounds, num_soilp, filter_soilp, &
am = min(1._r8, am + heatstress(p))
else ! lpj didn't set this for grasses; cn does
! set the mortality rate based on annual rate
am = params_inst%am
am = r_mort(ivt(p))
end if

end if

m = am/(get_average_days_per_year() * secspday)
m = r_mort(ivt(p))/(get_average_days_per_year() * secspday)

!------------------------------------------------------
! patch-level gap mortality carbon fluxes
Expand Down
28 changes: 14 additions & 14 deletions src/biogeophys/LunaMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ module LunaMod
real(r8) :: kc25_coef ! Michaelis-Menten const. at 25°C for CO2 (unitless)
real(r8) :: ko25_coef ! Michaelis-Menten const. at 25°C for O2 (unitless)
real(r8) :: luna_theta_cj ! LUNA empirical curvature parameter for ac, aj photosynthesis co-limitation (unitless)
real(r8) :: jmaxb0 ! The baseline proportion of nitrogen allocated for electron transport (J)
real(r8) :: wc2wjb0 ! The baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) (unitless)
real(r8) :: enzyme_turnover_daily ! The daily turnover rate for photosynthetic enzyme at 25oC in view of ~7 days of half-life time for Rubisco (Suzuki et al. 2001) (unitless)
real(r8) :: relhExp ! Specifies the impact of relative humidity on electron transport rate (unitless)
real(r8) :: minrelh ! Minimum relative humidity for nitrogen optimization (fraction)
Expand Down Expand Up @@ -120,10 +118,6 @@ subroutine readParams( ncid )
params_inst%kc25_coef = params_inst%kc25_coef * 1.e5_r8 ! from mol/mol to Luna units
! LUNA empirical curvature parameter for ac, aj photosynthesis co-limitation
call readNcdioScalar(ncid, 'luna_theta_cj', subname, params_inst%luna_theta_cj)
! The baseline proportion of nitrogen allocated for electron transport (J)
call readNcdioScalar(ncid, 'jmaxb0', subname, params_inst%jmaxb0)
! The baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) (unitless)
call readNcdioScalar(ncid, 'wc2wjb0', subname, params_inst%wc2wjb0)
! The daily turnover rate for photosynthetic enzyme at 25oC in view of ~7 days of half-life time for Rubisco (Suzuki et al. 2001) (unitless)
call readNcdioScalar(ncid, 'enzyme_turnover_daily', subname, params_inst%enzyme_turnover_daily)
! Specifies the impact of relative humidity on electron transport rate (unitless)
Expand Down Expand Up @@ -257,7 +251,9 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, &
c3psn => pftcon%c3psn , & ! photosynthetic pathway: 0. = c4, 1. = c3
slatop => pftcon%slatop , & ! specific leaf area at top of canopy, projected area basis [m^2/gC]
leafcn => pftcon%leafcn , & ! leaf C:N (gC/gN)
jmaxb0 => pftcon%jmaxb0 , & ! Baseline proportion of nitrogen allocated for electron transport (J)
jmaxb1 => pftcon%jmaxb1 , & ! Coefficient determining the response of electron transport rate to light availability (-)
wc2wjb0 => pftcon%wc2wjb0 , & ! The baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) (-)
forc_pbot10 => atm2lnd_inst%forc_pbot240_downscaled_patch , & ! Input: [real(r8) (:) ] 10 day mean atmospheric pressure(Pa)
CO2_p240 => atm2lnd_inst%forc_pco2_240_patch , & ! Input: [real(r8) (:) ] 10-day mean CO2 partial pressure (Pa)
O2_p240 => atm2lnd_inst%forc_po2_240_patch , & ! Input: [real(r8) (:) ] 10-day mean O2 partial pressure (Pa)
Expand Down Expand Up @@ -383,7 +379,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, &
PNcbold = 0.0_r8
call NitrogenAllocation(FNCa,forc_pbot10(p), relh10, CO2a10, O2a10, PARi10, PARimx10, rb10v, hourpd, &
tair10, tleafd10, tleafn10, &
jmaxb1(ft), PNlcold, PNetold, PNrespold, PNcbold, dayl_factor(p), &
jmaxb0(ft), jmaxb1(ft), wc2wjb0(ft), PNlcold, PNetold, PNrespold, PNcbold, dayl_factor(p), &
o3coefjmax(p), PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt)
vcmx25_opt= PNcbopt * FNCa * Fc25
jmx25_opt= PNetopt * FNCa * Fj25
Expand Down Expand Up @@ -769,7 +765,7 @@ end subroutine Clear24_Climate_LUNA
!************************************************************************************************************************************************
!Use the LUNA model to calculate the Nitrogen partioning
subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PARimx10,rb10, hourpd, tair10, tleafd10, tleafn10, &
jmaxb1, PNlcold, PNetold, PNrespold, PNcbold, dayl_factor,o3coefjmax, &
jmaxb0, jmaxb1, wc2wjb0, PNlcold, PNetold, PNrespold, PNcbold, dayl_factor,o3coefjmax, &
PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt)
implicit none
real(r8), intent (in) :: FNCa !Area based functional nitrogen content (g N/m2 leaf)
Expand All @@ -784,7 +780,9 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR
real(r8), intent (in) :: tair10 !10-day running mean of the 2m temperature (oC)
real(r8), intent (in) :: tleafd10 !10-day running mean of daytime leaf temperature (oC)
real(r8), intent (in) :: tleafn10 !10-day running mean of nighttime leaf temperature (oC)
real(r8), intent (in) :: jmaxb0 !Baseline proportion of nitrogen allocated for electron transport (J)
real(r8), intent (in) :: jmaxb1 !coefficient determining the response of electron transport rate to light availability (unitless)
real(r8), intent (in) :: wc2wjb0 !The baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) (-)
real(r8), intent (in) :: PNlcold !old value of the proportion of nitrogen allocated to light capture (unitless)
real(r8), intent (in) :: PNetold !old value of the proportion of nitrogen allocated to electron transport (unitless)
real(r8), intent (in) :: PNrespold !old value of the proportion of nitrogen allocated to respiration (unitless)
Expand Down Expand Up @@ -886,7 +884,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR
call Nitrogen_investments (KcKjFlag,FNCa, Nlc, forc_pbot10, relh10, CO2a10,O2a10, PARi10c, PARimx10c,rb10, hourpd, tair10, &
tleafd10c,tleafn10c, &
Kj2Kc, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref, NUEr, o3coefjmax, &
Kc, Kj, ci, &
jmaxb0, wc2wjb0, Kc, Kj, ci, &
Vcmax, Jmax,JmeanL,JmaxL, Net, Ncb, Nresp, PSN, RESP)

Npsntarget = Nlc + Ncb + Net !target nitrogen allocated to photosynthesis, which may be lower or higher than Npsn_avail
Expand All @@ -901,7 +899,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR
call Nitrogen_investments (KcKjFlag,FNCa, Nlc2, forc_pbot10, relh10, CO2a10,O2a10, PARi10c, PARimx10c,rb10, hourpd, &
tair10, tleafd10c,tleafn10c, &
Kj2Kc, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref,NUEr, o3coefjmax, &
Kc, Kj, ci, &
jmaxb0, wc2wjb0, Kc, Kj, ci, &
Vcmax, Jmax,JmeanL,JmaxL, Net2, Ncb2, Nresp2, PSN2, RESP2)

Npsntarget2 = Nlc2 + Ncb2 + Net2
Expand Down Expand Up @@ -930,7 +928,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR
call Nitrogen_investments (KcKjFlag,FNCa, Nlc1,forc_pbot10, relh10, CO2a10,O2a10, PARi10c, PARimx10c,rb10, hourpd, &
tair10, tleafd10c,tleafn10c, &
Kj2Kc, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref,NUEr, o3coefjmax, &
Kc, Kj, ci,&
jmaxb0, wc2wjb0, Kc, Kj, ci,&
Vcmax, Jmax,JmeanL,JmaxL, Net1, Ncb1, Nresp1, PSN1, RESP1)
Npsntarget1 = Nlc1 + Ncb1 + Net1
Carboncost1 = (Npsntarget - Npsntarget1) * NMCp25 * Cv * (RespTBernacchi(tleafd10c) * hourpd + &
Expand Down Expand Up @@ -961,7 +959,7 @@ end subroutine NitrogenAllocation
subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, &
CO2a10, O2a10, PARi10, PARimx10, rb10, hourpd, tair10, tleafd10, tleafn10, &
Kj2Kc, JmaxCoef, Fc, Fj, NUEc, NUEj, NUEcref, NUEjref, NUEr, o3coefjmax, &
Kc, Kj, ci, Vcmax, Jmax, JmeanL, JmaxL, Net, Ncb, Nresp, PSN, RESP)
jmaxb0, wc2wjb0, Kc, Kj, ci, Vcmax, Jmax, JmeanL, JmaxL, Net, Ncb, Nresp, PSN, RESP)
implicit none
integer, intent (in) :: KcKjFlag !flag to indicate whether to update the Kc and Kj using the photosynthesis subroutine; 0--Kc and Kj need to be calculated; 1--Kc and Kj is prescribed.
real(r8), intent (in) :: FNCa !Area based functional nitrogen content (g N/m2 leaf)
Expand All @@ -987,6 +985,8 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, &
real(r8), intent (in) :: NUEjref !nitrogen use efficiency for electron transport under reference climates
real(r8), intent (in) :: NUEr !nitrogen use efficiency for respiration
real(r8), intent (in) :: o3coefjmax !ozone coef jmax
real(r8), intent (in) :: jmaxb0 !Baseline proportion of nitrogen allocated for electron transport (J)
real(r8), intent (in) :: wc2wjb0 !The baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) (-)

real(r8), intent (inout) :: Kc !conversion factors from Vc,max to Wc
real(r8), intent (inout) :: Kj !conversion factor from electron transport rate to Wj
Expand Down Expand Up @@ -1016,7 +1016,7 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, &

theta = 0.292_r8 / (1.0_r8 + 0.076_r8 / (Nlc * Cb))
ELTRNabsorb = theta * PARi10
Jmaxb0act = params_inst%jmaxb0 * FNCa * Fj
Jmaxb0act = jmaxb0 * FNCa * Fj

! Default value of o3coefjmax is 1 -->
! o3coefjmax is only different from 1 if ozone_inst%stress_method == 'stress_falk'
Expand All @@ -1026,7 +1026,7 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, &

JmaxL = theta * PARimx10 / (sqrt(1.0_r8 + (theta * PARimx10 / Jmax)**2.0_r8))
NUEchg = (NUEc / NUEcref) * (NUEjref / NUEj)
Wc2Wj = params_inst%wc2wjb0 * (NUEchg**0.5_r8)
Wc2Wj = wc2wjb0 * (NUEchg**0.5_r8)
Vcmax = Wc2Wj * JmaxL * Kj2Kc
JmeanL = theta * PARi10 / (sqrt(1.0_r8 + (ELTRNabsorb / Jmax)**2.0_r8))
if(KcKjFlag.eq.0)then !update the Kc,Kj, anc ci information
Expand Down
18 changes: 18 additions & 0 deletions src/main/pftconMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ module pftconMod
real(r8), allocatable :: wood_density (:) ! wood density (kg/m3)
real(r8), allocatable :: crit_onset_gdd_sf(:)! scale factor for crit_onset_gdd
real(r8), allocatable :: ndays_on(:) ! number of days to complete leaf onset
real(r8), allocatable :: jmaxb0(:) ! Baseline proportion of nitrogen allocated for electron transport (J)
real(r8), allocatable :: jmaxb1(:) ! Coefficient determining the response of electron transport rate to light availability
real(r8), allocatable :: wc2wjb0(:) ! The baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) (-)
real(r8), allocatable :: r_mort(:) ! Mortality rate (1/year)

! crop

Expand Down Expand Up @@ -507,7 +510,10 @@ subroutine InitAllocate (this)
allocate( this%wood_density (0:mxpft) )
allocate( this%crit_onset_gdd_sf (0:mxpft) )
allocate( this%ndays_on (0:mxpft) )
allocate( this%jmaxb0 (0:mxpft) )
allocate( this%jmaxb1 (0:mxpft) )
allocate( this%wc2wjb0 (0:mxpft) )
allocate( this%r_mort (0:mxpft) )

end subroutine InitAllocate

Expand Down Expand Up @@ -1019,9 +1025,18 @@ subroutine InitRead(this)
call ncd_io('medlynintercept', this%medlynintercept, 'read', ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__))

call ncd_io('jmaxb0', this%jmaxb0, 'read', ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__))

call ncd_io('jmaxb1', this%jmaxb1, 'read', ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__))

call ncd_io('wc2wjb0', this%wc2wjb0, 'read', ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__))

call ncd_io('r_mort', this%r_mort, 'read', ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__))

call ncd_io('mxmat', this%mxmat, 'read', ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__))

Expand Down Expand Up @@ -1601,7 +1616,10 @@ subroutine Clean(this)
deallocate( this%taper)
deallocate( this%crit_onset_gdd_sf)
deallocate( this%ndays_on)
deallocate( this%jmaxb0)
deallocate( this%jmaxb1)
deallocate( this%wc2wjb0)
deallocate( this%r_mort)
end subroutine Clean

end module pftconMod
Expand Down

0 comments on commit 77b8e80

Please sign in to comment.