Skip to content

Commit

Permalink
Make implementation cohort independent. Does not change the output bu…
Browse files Browse the repository at this point in the history
…t simplifies a lot the code.
  • Loading branch information
marcadella committed Jan 16, 2025
1 parent 2bdaa30 commit 69782ea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/datatypes_biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module datatypes_biomee
real :: vpd = 0.0
real :: temp = 0.0
real :: patm = 0.0
real, dimension(NLAYERS_MAX) :: par = dummy ! Initialization to a dummy value. Important! Keep it.
real :: par = 0.0
end type dampended_forcing_type

!=============== Tile level data type ============================================================
Expand Down
38 changes: 16 additions & 22 deletions src/gpp_biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ subroutine gpp( forcing, vegn )
integer:: i

! local variables used for P-model part
real :: tk, kphio_temp
real :: kphio_temp
type(outtype_pmodel) :: out_pmodel ! list of P-model output variables

!-----------------------------------------------------------
Expand Down Expand Up @@ -190,6 +190,7 @@ subroutine gpp( forcing, vegn )
vegn%dampended_forcing%temp = (forcing%Tair - kTkelvin)
vegn%dampended_forcing%vpd = forcing%vpd
vegn%dampended_forcing%patm = forcing%P_air
vegn%dampended_forcing%par = forcing%radiation
vegn%dampended_forcing%initialized = .True.
else
vegn%dampended_forcing%co2 = dampen_variability( forcing%CO2 * 1.0e6, params_gpp%tau_acclim, &
Expand All @@ -200,9 +201,18 @@ subroutine gpp( forcing, vegn )
params_gpp%tau_acclim, vegn%dampended_forcing%vpd )
vegn%dampended_forcing%patm = dampen_variability( forcing%P_air, &
params_gpp%tau_acclim, vegn%dampended_forcing%patm )
vegn%dampended_forcing%par = dampen_variability( forcing%radiation, &
params_gpp%tau_acclim, vegn%dampended_forcing%par )
end if

tk = forcing%Tair + kTkelvin
!----------------------------------------------------------------
! Instantaneous temperature effect on quantum yield efficiency
!----------------------------------------------------------------
kphio_temp = calc_kphio_temp( (forcing%Tair - kTkelvin), &
.false., & ! no C4
params_gpp%kphio, &
params_gpp%kphio_par_a, &
params_gpp%kphio_par_b )

!----------------------------------------------------------------
! Photosynthesis for each cohort
Expand All @@ -212,27 +222,11 @@ subroutine gpp( forcing, vegn )
cc => vegn%cohorts(i)
associate ( sp => myinterface%params_species(cc%species) )

!----------------------------------------------------------------
! Instantaneous temperature effect on quantum yield efficiency
!----------------------------------------------------------------
kphio_temp = calc_kphio_temp( (forcing%Tair - kTkelvin), &
.false., & ! no C4
params_gpp%kphio, &
params_gpp%kphio_par_a, &
params_gpp%kphio_par_b )

! photosynthetically active radiation level at this layer
par = f_light(cc%layer) * forcing%radiation * kfFEC * 1.0e-6
! slowly varying light conditions per layer, relevant for acclimation (P-model quantities)
if (vegn%dampended_forcing%par(cc%layer) == dummy) then
vegn%dampended_forcing%par(cc%layer) = par
else
vegn%dampended_forcing%par(cc%layer) = dampen_variability(par, params_gpp%tau_acclim, &
vegn%dampended_forcing%par(cc%layer))
end if

if (cc%status == LEAF_ON) then

! photosynthetically active radiation level at this layer
par = f_light(cc%layer) * vegn%dampended_forcing%par * kfFEC * 1.0e-6

!----------------------------------------------------------------
! P-model call for C3 plants to get a list of variables that are
! acclimated to slowly varying conditions
Expand All @@ -241,7 +235,7 @@ subroutine gpp( forcing, vegn )
kphio = kphio_temp, &
beta = params_gpp%beta, &
kc_jmax = params_gpp%kc_jmax, &
ppfd = vegn%dampended_forcing%par(cc%layer), &
ppfd = par, &
co2 = vegn%dampended_forcing%co2, &
tc = vegn%dampended_forcing%temp, &
vpd = vegn%dampended_forcing%vpd, &
Expand Down

0 comments on commit 69782ea

Please sign in to comment.