From d57b51da715a89e23424fa82bbe471212e90668d Mon Sep 17 00:00:00 2001 From: Peter Schwartz Date: Tue, 31 Oct 2023 15:28:58 -0500 Subject: [PATCH 1/6] Removed unneccesary zero'ing of global variables every timestep. Added initializing into compute loops when needed, and switched some variables to be only be initialized on the first time step. the harvest variables shouldn't require initializing every timestep but extra effort is needed to untangle the dependencies and order of operations. --- .../elm/src/biogeochem/AllocationMod.F90 | 2 +- .../biogeochem/EcosystemBalanceCheckMod.F90 | 6 +- components/elm/src/biogeochem/FireMod.F90 | 3 + .../elm/src/biogeochem/GapMortalityMod.F90 | 2 + .../elm/src/biogeochem/SoilLittDecompMod.F90 | 30 +- .../elm/src/data_types/ColumnDataType.F90 | 486 ++++++++------- .../elm/src/data_types/VegetationDataType.F90 | 576 ++++++++++-------- 7 files changed, 569 insertions(+), 536 deletions(-) diff --git a/components/elm/src/biogeochem/AllocationMod.F90 b/components/elm/src/biogeochem/AllocationMod.F90 index 20815fee2189..2795fd42c8ed 100644 --- a/components/elm/src/biogeochem/AllocationMod.F90 +++ b/components/elm/src/biogeochem/AllocationMod.F90 @@ -1387,7 +1387,7 @@ subroutine Allocation2_ResolveNPLimit (bounds, num_soilc, filter_soilc , & ! deficit for NO3 to meet allocation needs, is only added to the NH4 pool. ! Thus, the NH4 fluxes are increased, for itself and as a surrogate to meet the ! NO3 flux demands. - + supplement_to_sminn_vr(c,j) = 0._r8 if (carbon_only .or. carbonphosphorus_only) then if ( fpi_no3_vr(j) + fpi_nh4_vr(j) < 1._r8 ) then diff --git a/components/elm/src/biogeochem/EcosystemBalanceCheckMod.F90 b/components/elm/src/biogeochem/EcosystemBalanceCheckMod.F90 index 53bac44a63ce..b9adb1a94688 100644 --- a/components/elm/src/biogeochem/EcosystemBalanceCheckMod.F90 +++ b/components/elm/src/biogeochem/EcosystemBalanceCheckMod.F90 @@ -574,7 +574,7 @@ subroutine ColPBalanceCheck(bounds, & integer:: kmo ! month of year (1, ..., 12) integer:: kda ! day of month (1, ..., 31) integer:: mcsec ! seconds of day (0, ..., seconds/day) - integer :: nstep + integer :: nstep !----------------------------------------------------------------------- associate( & @@ -618,7 +618,7 @@ subroutine ColPBalanceCheck(bounds, & ! set time steps dt = dtime_mod kyr = year_curr; kmo = mon_curr; kda = day_curr; mcsec = secs_curr; - + nstep = get_nstep() err_found = .false. if(.not.use_fates)then @@ -733,7 +733,7 @@ subroutine ColPBalanceCheck(bounds, & end do ! end of columns loop - if (err_found .and. nstep>1) then + if (err_found .and. nstep_mod>1) then #ifndef _OPENACC c = err_index write(iulog,*)'column pbalance error = ', col_errpb(c), c diff --git a/components/elm/src/biogeochem/FireMod.F90 b/components/elm/src/biogeochem/FireMod.F90 index cc9aa078215c..0dec0c08a50b 100644 --- a/components/elm/src/biogeochem/FireMod.F90 +++ b/components/elm/src/biogeochem/FireMod.F90 @@ -1368,6 +1368,7 @@ subroutine FireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp, & do j = 1, nlevdecomp ! carbon fluxes do l = 1, ndecomp_pools + m_decomp_cpools_to_fire_vr(c,j,l) = 0._r8 if ( is_litter(l) ) then m_decomp_cpools_to_fire_vr(c,j,l) = decomp_cpools_vr(c,j,l) * f * 0.5_r8 end if @@ -1386,6 +1387,7 @@ subroutine FireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp, & ! nitrogen fluxes do l = 1, ndecomp_pools + m_decomp_npools_to_fire_vr(c,j,l) = 0.0_r8 if ( is_litter(l) ) then m_decomp_npools_to_fire_vr(c,j,l) = decomp_npools_vr(c,j,l) * f * 0.5_r8 end if @@ -1403,6 +1405,7 @@ subroutine FireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp, & ! phosphorus fluxes - loss due to fire do l = 1, ndecomp_pools + m_decomp_ppools_to_fire_vr(c,j,l) = 0._r8 if ( is_litter(l) ) then m_decomp_ppools_to_fire_vr(c,j,l) = decomp_ppools_vr(c,j,l) * f * 0.5_r8 end if diff --git a/components/elm/src/biogeochem/GapMortalityMod.F90 b/components/elm/src/biogeochem/GapMortalityMod.F90 index 59d44b9b8294..32e16e123ca2 100644 --- a/components/elm/src/biogeochem/GapMortalityMod.F90 +++ b/components/elm/src/biogeochem/GapMortalityMod.F90 @@ -141,6 +141,8 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & !------------------------------------------------------ ! displayed pools + veg_cf%m_leafc_to_litter(p) = 0._r8 + veg_cf%m_livestemc_to_litter(p) = 0._r8 if(ivt(p) < npcropmin .or. (ivt(p) >= npcropmin .and. croplive(p))) then veg_cf%m_leafc_to_litter(p) = veg_cs%leafc(p) * m veg_cf%m_livestemc_to_litter(p) = veg_cs%livestemc(p) * m diff --git a/components/elm/src/biogeochem/SoilLittDecompMod.F90 b/components/elm/src/biogeochem/SoilLittDecompMod.F90 index 0586868c8222..d69ecd538678 100644 --- a/components/elm/src/biogeochem/SoilLittDecompMod.F90 +++ b/components/elm/src/biogeochem/SoilLittDecompMod.F90 @@ -308,7 +308,9 @@ subroutine SoilLittDecompAlloc (bounds, num_soilc, filter_soilc, & / cp_decomp_pools_new(c,j,cascade_receiver_pool(k)) ) else ! 100% respiration - pmpf_decomp_cascade(c,j,k) = - p_decomp_cpool_loss(c,j,k) / cp_decomp_pools(c,j,cascade_donor_pool(k)) + if(decomp_ppools_vr(c,j,cascade_donor_pool(k)) > 0._r8) then + pmpf_decomp_cascade(c,j,k) = - p_decomp_cpool_loss(c,j,k) / cp_decomp_pools(c,j,cascade_donor_pool(k)) + end if endif else ! CWD -> litter @@ -414,7 +416,12 @@ subroutine SoilLittDecompAlloc (bounds, num_soilc, filter_soilc, & do j = 1,nlevdecomp do fc = 1,num_soilc c = filter_soilc(fc) - + decomp_cascade_hr_vr(c,j,k) = 0._r8 + decomp_cascade_ctransfer_vr(c,j,k) = 0._r8 + decomp_cascade_ptransfer_vr(c,j,k) = 0._r8 + decomp_cascade_ntransfer_vr(c,j,k) = 0._r8 + decomp_cascade_sminn_flux_vr(c,j,k) = 0._r8 + decomp_cascade_sminp_flux_vr(c,j,k) = 0._r8 if (decomp_cpools_vr(c,j,cascade_donor_pool(k)) > 0._r8) then if ( pmnf_decomp_cascade(c,j,k) > 0._r8 .and. pmpf_decomp_cascade(c,j,k) > 0._r8 ) then ! N and P co-limitation p_decomp_cpool_loss(c,j,k) = p_decomp_cpool_loss(c,j,k) * min( fpi_vr(c,j),fpi_p_vr(c,j) ) @@ -553,18 +560,6 @@ subroutine SoilLittDecompAlloc (bounds, num_soilc, filter_soilc, & end do end if - ! vertically integrate net and gross mineralization fluxes for diagnostic output - ! moved to SoilLittDecompAlloc2 -! do j = 1,nlevdecomp -! do fc = 1,num_soilc -! c = filter_soilc(fc) -! net_nmin(c) = net_nmin(c) + net_nmin_vr(c,j) * dzsoi_decomp(j) -! gross_nmin(c) = gross_nmin(c) + gross_nmin_vr(c,j) * dzsoi_decomp(j) -! net_pmin(c) = net_pmin(c) + net_pmin_vr(c,j) * dzsoi_decomp(j) -! gross_pmin(c) = gross_pmin(c) + gross_pmin_vr(c,j) * dzsoi_decomp(j) -! end do -! end do - end associate end subroutine SoilLittDecompAlloc @@ -821,7 +816,6 @@ subroutine CNvariables_nan4pf (bounds, num_soilc, filter_soilc, num_soilp, filte ! if not properly set. ! !USES: - !$acc routine seq use elm_varctl , only: carbon_only, carbonnitrogen_only use elm_varpar , only: nlevdecomp, ndecomp_cascade_transitions ! @@ -863,13 +857,11 @@ subroutine CNvariables_nan4pf (bounds, num_soilc, filter_soilc, num_soilp, filte call veg_ps%SetValues(num_patch=num_soilp, filter_patch=filter_soilp, value_patch=0._r8) call col_ps%SetValues(num_column=num_soilc, filter_column=filter_soilc, value_column=0._r8) - call veg_pf%setvalues( num_patch=num_soilp, filter_patch=filter_soilp, value_patch=0._r8) - call col_pf%setvalues( num_column=num_soilc, filter_column=filter_soilc, value_column=0._r8) + call veg_pf%SetValues( num_patch=num_soilp, filter_patch=filter_soilp, value_patch=0._r8) + call col_pf%SetValues( num_column=num_soilc, filter_column=filter_soilc, value_column=0._r8) end if end associate end subroutine CNvariables_nan4pf - !------------------------------------------------------------------------------------------------- - end module SoilLittDecompMod diff --git a/components/elm/src/data_types/ColumnDataType.F90 b/components/elm/src/data_types/ColumnDataType.F90 index 7dc67e85602d..286674e7c895 100644 --- a/components/elm/src/data_types/ColumnDataType.F90 +++ b/components/elm/src/data_types/ColumnDataType.F90 @@ -21,7 +21,7 @@ module ColumnDataType use elm_varcon , only : watmin, bdsno, zsoi, zisoi, dzsoi_decomp use elm_varcon , only : c13ratio, c14ratio, secspday use elm_varctl , only : use_fates, use_fates_planthydro, create_glacier_mec_landunit - use elm_varctl , only : use_hydrstress + use elm_varctl , only : use_hydrstress, use_crop use elm_varctl , only : bound_h2osoi, use_cn, iulog, use_vertsoilc, spinup_state use elm_varctl , only : ero_ccycle use elm_varctl , only : use_elm_interface, use_pflotran, pf_cmode @@ -32,7 +32,7 @@ module ColumnDataType use pftvarcon , only : VMAX_MINSURF_P_vr, KM_MINSURF_P_vr, pinit_beta1, pinit_beta2 use soilorder_varcon, only : smax, ks_sorption use elm_time_manager, only : is_restart, get_nstep - use elm_time_manager, only : is_first_step, get_step_size + use elm_time_manager, only : is_first_step, get_step_size, is_first_restart_step use landunit_varcon , only : istice, istwet, istsoil, istdlak, istcrop, istice_mec use column_varcon , only : icol_road_perv, icol_road_imperv, icol_roof, icol_sunwall, icol_shadewall use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal @@ -46,6 +46,7 @@ module ColumnDataType use CNDecompCascadeConType , only : decomp_cascade_con use ColumnType , only : col_pp use LandunitType , only : lun_pp + use timeInfoMod , only : nstep_mod ! ! !PUBLIC TYPES: implicit none @@ -6873,15 +6874,13 @@ subroutine col_cf_summary(this, bounds, num_soilc, filter_soilc, isotope) do j = 1,nlev do fc = 1,num_soilc c = filter_soilc(fc) - - this%decomp_cascade_ctransfer(c,k) = & + this%decomp_cascade_ctransfer(c,k) = & this%decomp_cascade_ctransfer(c,k) + & this%decomp_cascade_ctransfer_vr(c,j,k) * dzsoi_decomp(j) end do end do end do - ! total heterotrophic respiration (HR) do fc = 1,num_soilc c = filter_soilc(fc) @@ -6890,7 +6889,6 @@ subroutine col_cf_summary(this, bounds, num_soilc, filter_soilc, isotope) this%somhr(c) end do - elseif (is_active_betr_bgc) then do fc = 1, num_soilc @@ -7309,7 +7307,7 @@ subroutine col_cf_setvalues ( this, num_column, filter_column, value_column) ! Set column-level carbon fluxes ! ! !ARGUMENTS: - class (column_carbon_flux) :: this + class(column_carbon_flux) :: this integer , intent(in) :: num_column integer , intent(in) :: filter_column(:) real(r8), intent(in) :: value_column @@ -7317,7 +7315,6 @@ subroutine col_cf_setvalues ( this, num_column, filter_column, value_column) ! !LOCAL VARIABLES: integer :: fi,i,j,k,l ! loop index !------------------------------------------------------------------------ - do j = 1, nlevdecomp_full do fi = 1,num_column i = filter_column(fi) @@ -7344,49 +7341,59 @@ subroutine col_cf_setvalues ( this, num_column, filter_column, value_column) this%hr_vr(i,j) = value_column end do end do - - do k = 1, ndecomp_pools - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%m_decomp_cpools_to_fire_vr(i,j,k) = value_column - this%decomp_cpools_transport_tendency(i,j,k) = value_column - this%decomp_cpools_yield_vr(i,j,k) = value_column - end do - end do - end do - do l = 1, ndecomp_cascade_transitions do fi = 1,num_column i = filter_column(fi) - this%decomp_cascade_hr(i,l) = value_column this%decomp_cascade_ctransfer(i,l) = value_column end do end do - - do l = 1, ndecomp_cascade_transitions + do j = 1, nlevdecomp_full + do fi = 1,num_column + i = filter_column(fi) + this%f_co2_soil_vr(i,j) = value_column + end do + end do + + do k = 1, ndecomp_pools do j = 1, nlevdecomp_full do fi = 1,num_column i = filter_column(fi) - this%decomp_cascade_hr_vr(i,j,l) = value_column - this%decomp_cascade_ctransfer_vr(i,j,l) = value_column - this%decomp_k(i,j,l) = value_column + this%decomp_cpools_sourcesink(i,j,k) = value_column end do end do end do + ! pflotran + if(nstep_mod == 0 .or. is_first_restart_step()) then + do k = 1, ndecomp_pools + do j = 1, nlevdecomp_full + do fi = 1,num_column + i = filter_column(fi) + ! only initializing in the first time-step + this%externalc_to_decomp_cpools(i,j,k) = value_column + end do + end do + end do + do fi = 1,num_column + i = filter_column(fi) + this%f_co2_soil(i) = value_column + ! only initializing in the first time-step + this%externalc_to_decomp_delta(i) = value_column + end do + end if do k = 1, ndecomp_pools do fi = 1,num_column i = filter_column(fi) - this%decomp_cpools_leached(i,k) = value_column - this%decomp_cpools_erode(i,k) = value_column - this%decomp_cpools_deposit(i,k) = value_column - this%decomp_cpools_yield(i,k) = value_column + !this%decomp_cpools_leached(i,k) = value_column + !this%decomp_cpools_erode(i,k) = value_column + !this%decomp_cpools_deposit(i,k) = value_column + this%decomp_cpools_yield(i,k) = value_column !if ero_ccycle this%m_decomp_cpools_to_fire(i,k) = value_column - this%bgc_cpool_ext_inputs_vr(i,:, k) = value_column - this%bgc_cpool_ext_loss_vr(i,:, k) = value_column + !NOTE: Can't see where these are used. pflotran maybe?? + !this%bgc_cpool_ext_inputs_vr(i,:, k) = value_column + !this%bgc_cpool_ext_loss_vr(i,:, k) = value_column end do - end do + end do do fi = 1,num_column i = filter_column(fi) @@ -7394,32 +7401,16 @@ subroutine col_cf_setvalues ( this, num_column, filter_column, value_column) this%hrv_deadstemc_to_prod10c(i) = value_column this%hrv_deadstemc_to_prod100c(i) = value_column this%hrv_cropc_to_prod1c(i) = value_column - this%somc_fire(i) = value_column this%prod1c_loss(i) = value_column this%prod10c_loss(i) = value_column this%prod100c_loss(i) = value_column - this%product_closs(i) = value_column - this%somhr(i) = value_column - this%lithr(i) = value_column + this%somhr(i) = value_column ! REVISIT + this%lithr(i) = value_column ! REVISIT this%hr(i) = value_column - this%sr(i) = value_column - this%er(i) = value_column - this%litfire(i) = value_column - this%somfire(i) = value_column - this%totfire(i) = value_column - this%nep(i) = value_column - this%nbp(i) = value_column - this%nee(i) = value_column this%cinputs(i) = value_column this%coutputs(i) = value_column - this%fire_closs(i) = value_column this%cwdc_hr(i) = value_column - this%cwdc_loss(i) = value_column this%litterc_loss(i) = value_column - this%som_c_leached(i) = value_column - this%somc_erode(i) = value_column - this%somc_deposit(i) = value_column - this%somc_yield(i) = value_column ! Zero p2c column fluxes this%rr(i) = value_column @@ -7432,44 +7423,46 @@ subroutine col_cf_setvalues ( this, num_column, filter_column, value_column) this%wood_harvestc(i) = value_column this%hrv_xsmrpool_to_atm(i) = value_column end do - - do k = 1, ndecomp_pools - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cpools_sourcesink(i,j,k) = value_column - end do - end do - end do - - ! pflotran - do k = 1, ndecomp_pools - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - ! only initializing in the first time-step - if ( this%externalc_to_decomp_cpools(i,j,k) == spval ) then - this%externalc_to_decomp_cpools(i,j,k) = value_column - end if - end do - end do - end do - - do fi = 1,num_column - i = filter_column(fi) - this%f_co2_soil(i) = value_column - ! only initializing in the first time-step - if ( this%externalc_to_decomp_delta(i) == spval ) then - this%externalc_to_decomp_delta(i) = value_column - end if - end do - - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%f_co2_soil_vr(i,j) = value_column - end do - end do + + if(use_crop) then + do fi = 1,num_column + i = filter_column(fi) + this%somc_fire(i) = value_column + this%product_closs(i) = value_column + this%sr(i) = value_column + this%er(i) = value_column + this%litfire(i) = value_column + this%somfire(i) = value_column + this%totfire(i) = value_column + this%nep(i) = value_column + this%nbp(i) = value_column + this%nee(i) = value_column + this%fire_closs(i) = value_column + this%cwdc_loss(i) = value_column + this%som_c_leached(i) = value_column + this%somc_erode(i) = value_column + this%somc_deposit(i) = value_column + this%somc_yield(i) = value_column + enddo + end if + do k = 1, ndecomp_pools + do fi = 1,num_column + i = filter_column(fi) + this%decomp_cpools_leached(i,k) = value_column + this%decomp_cpools_erode(i,k) = value_column + this%decomp_cpools_deposit(i,k) = value_column + end do + end do + do k = 1, ndecomp_pools + do j = 1, nlevdecomp_full + do fi = 1,num_column + i = filter_column(fi) + ! this%m_decomp_cpools_to_fire_vr(i,j,k) = value_column + this%decomp_cpools_transport_tendency(i,j,k) = value_column + ! this%decomp_cpools_yield_vr(i,j,k) = value_column + end do + end do + end do end subroutine col_cf_setvalues @@ -8777,7 +8770,7 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) ! Set column-level nitrogen fluxes ! ! !ARGUMENTS: - class (column_nitrogen_flux) :: this + class(column_nitrogen_flux) :: this integer , intent(in) :: num_column integer , intent(in) :: filter_column(:) real(r8), intent(in) :: value_column @@ -8812,59 +8805,66 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) this%harvest_n_to_litr_lig_n(i,j) = value_column this%harvest_n_to_cwdn(i,j) = value_column - this%f_nit_vr(i,j) = value_column - this%f_denit_vr(i,j) = value_column - this%smin_no3_leached_vr(i,j) = value_column - this%smin_no3_runoff_vr(i,j) = value_column - this%n2_n2o_ratio_denit_vr(i,j) = value_column - this%pot_f_nit_vr(i,j) = value_column - this%pot_f_denit_vr(i,j) = value_column - this%actual_immob_no3_vr(i,j) = value_column - this%actual_immob_nh4_vr(i,j) = value_column - this%smin_no3_to_plant_vr(i,j) = value_column - this%smin_nh4_to_plant_vr(i,j) = value_column - this%f_n2o_denit_vr(i,j) = value_column - this%f_n2o_nit_vr(i,j) = value_column - - this%smin_no3_massdens_vr(i,j) = value_column - this%k_nitr_t_vr(i,j) = value_column - this%k_nitr_ph_vr(i,j) = value_column - this%k_nitr_h2o_vr(i,j) = value_column - this%k_nitr_vr(i,j) = value_column - this%wfps_vr(i,j) = value_column - this%fmax_denit_carbonsubstrate_vr(i,j) = value_column - this%fmax_denit_nitrate_vr(i,j) = value_column - this%f_denit_base_vr(i,j) = value_column - - this%diffus(i,j) = value_column - this%ratio_k1(i,j) = value_column - this%ratio_no3_co2(i,j) = value_column - this%soil_co2_prod(i,j) = value_column - this%fr_WFPS(i,j) = value_column - this%soil_bulkdensity(i,j) = value_column - - this%r_psi(i,j) = value_column - this%anaerobic_frac(i,j) = value_column - - ! pflotran - this%plant_ndemand_vr(i,j) = value_column - this%f_ngas_decomp_vr(i,j) = value_column - this%f_ngas_nitri_vr(i,j) = value_column - this%f_ngas_denit_vr(i,j) = value_column - this%f_n2o_soil_vr(i,j) = value_column - this%f_n2_soil_vr(i,j) = value_column - - this%potential_immob_vr(i,j) = value_column - this%actual_immob_vr(i,j) = value_column - this%sminn_to_plant_vr(i,j) = value_column - this%supplement_to_sminn_vr(i,j) = value_column - this%gross_nmin_vr(i,j) = value_column + !this%smin_no3_leached_vr(i,j) = value_column + !this%smin_no3_runoff_vr(i,j) = value_column + !this%n2_n2o_ratio_denit_vr(i,j) = value_column + !this%pot_f_nit_vr(i,j) = value_column + !this%pot_f_denit_vr(i,j) = value_column + !this%actual_immob_no3_vr(i,j) = value_column + !this%actual_immob_nh4_vr(i,j) = value_column + !this%smin_no3_to_plant_vr(i,j) = value_column + !this%smin_nh4_to_plant_vr(i,j) = value_column + !this%f_n2o_denit_vr(i,j) = value_column + !this%f_n2o_nit_vr(i,j) = value_column + + !this%smin_no3_massdens_vr(i,j) = value_column + !this%k_nitr_t_vr(i,j) = value_column + !this%k_nitr_ph_vr(i,j) = value_column + !this%k_nitr_h2o_vr(i,j) = value_column + !this%k_nitr_vr(i,j) = value_column + !this%wfps_vr(i,j) = value_column + !this%fmax_denit_carbonsubstrate_vr(i,j) = value_column + !this%fmax_denit_nitrate_vr(i,j) = value_column + !this%f_denit_base_vr(i,j) = value_column + + !this%diffus(i,j) = value_column + !this%ratio_k1(i,j) = value_column + !this%ratio_no3_co2(i,j) = value_column + !this%soil_co2_prod(i,j) = value_column + !this%fr_WFPS(i,j) = value_column + !this%soil_bulkdensity(i,j) = value_column + + !this%r_psi(i,j) = value_column + !this%anaerobic_frac(i,j) = value_column + + + !this%potential_immob_vr(i,j) = value_column + !this%actual_immob_vr(i,j) = value_column + !this%sminn_to_plant_vr(i,j) = value_column + !this%supplement_to_sminn_vr(i,j) = value_column + !this%gross_nmin_vr(i,j) = value_column this%net_nmin_vr(i,j) = value_column - this%sminn_nh4_input_vr(i,j) = value_column - this%sminn_no3_input_vr(i,j) = value_column + this%sminn_nh4_input_vr(i,j) = value_column !not used anywhere? + this%sminn_no3_input_vr(i,j) = value_column !not used anywhere? end do end do + if( use_pflotran .and. pf_cmode) then + + do j = 1, nlevdecomp_full + do fi = 1,num_column + i = filter_column(fi) + ! pflotran + this%plant_ndemand_vr(i,j) = value_column !use_elm_interface.and.use_pflotran .and. pf_cmode + this%f_ngas_decomp_vr(i,j) = value_column ! "" + this%f_ngas_nitri_vr(i,j) = value_column ! "" + this%f_ngas_denit_vr(i,j) = value_column + this%f_n2o_soil_vr(i,j) = value_column + this%f_n2_soil_vr(i,j) = value_column + end do + end do + end if + do fi = 1,num_column i = filter_column(fi) @@ -8873,6 +8873,13 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) this%nfix_to_ecosysn(i) = value_column this%fert_to_sminn(i) = value_column this%soyfixn_to_sminn(i) = value_column + this%supplement_to_sminn(i) = value_column + this%denit(i) = value_column + this%smin_nh4_to_plant(i) = value_column + this%smin_no3_to_plant(i) = value_column + this%fire_nloss(i) = value_column + this%som_n_leached(i) = value_column + this%hrv_deadstemn_to_prod10n(i) = value_column this%hrv_deadstemn_to_prod100n(i) = value_column this%hrv_cropn_to_prod1n(i) = value_column @@ -8883,10 +8890,8 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) this%potential_immob(i) = value_column this%actual_immob(i) = value_column this%sminn_to_plant(i) = value_column - this%supplement_to_sminn(i) = value_column this%gross_nmin(i) = value_column this%net_nmin(i) = value_column - this%denit(i) = value_column this%f_nit(i) = value_column this%pot_f_nit(i) = value_column @@ -8903,19 +8908,15 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) this%f_n2o_soil(i) = value_column this%f_n2_soil(i) = value_column - this%smin_nh4_to_plant(i) = value_column - this%smin_no3_to_plant(i) = value_column this%ninputs(i) = value_column this%noutputs(i) = value_column - this%fire_nloss(i) = value_column - this%som_n_leached(i) = value_column this%sminn_input(i) = value_column this%sminn_nh4_input(i) = value_column this%sminn_no3_input(i) = value_column - this%somn_erode(i) = value_column - this%somn_deposit(i) = value_column - this%somn_yield(i) = value_column + !this%somn_erode(i) = value_column + !this%somn_deposit(i) = value_column + !this%somn_yield(i) = value_column ! Zero p2c column fluxes this%fire_nloss(i) = value_column this%wood_harvestn(i) = value_column @@ -8923,31 +8924,21 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) ! bgc-interface this%plant_ndemand(i) = value_column end do - do k = 1, ndecomp_pools do fi = 1,num_column i = filter_column(fi) - this%decomp_npools_leached(i,k) = value_column - this%decomp_npools_erode(i,k) = value_column - this%decomp_npools_deposit(i,k) = value_column - this%decomp_npools_yield(i,k) = value_column + !this%decomp_npools_leached(i,k) = value_column + !this%decomp_npools_erode(i,k) = value_column + !this%decomp_npools_deposit(i,k) = value_column + this%decomp_npools_yield(i,k) = value_column !ero_ccyle this%m_decomp_npools_to_fire(i,k) = value_column - this%bgc_npool_ext_inputs_vr(i,:,k) = value_column - this%bgc_npool_ext_loss_vr(i,:,k) = value_column - this%bgc_npool_inputs(i,k) = value_column + !NOTE: when are these used? + !this%bgc_npool_ext_inputs_vr(i,:,k) = value_column + !this%bgc_npool_ext_loss_vr(i,:,k) = value_column + !this%bgc_npool_inputs(i,k) = value_column end do end do - do k = 1, ndecomp_pools - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%m_decomp_npools_to_fire_vr(i,j,k) = value_column - this%decomp_npools_transport_tendency(i,j,k) = value_column - this%decomp_npools_yield_vr(i,j,k) = value_column - end do - end do - end do do l = 1, ndecomp_cascade_transitions do fi = 1,num_column @@ -8957,16 +8948,6 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) end do end do - do l = 1, ndecomp_cascade_transitions - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cascade_ntransfer_vr(i,j,l) = value_column - this%decomp_cascade_sminn_flux_vr(i,j,l) = value_column - end do - end do - end do - do k = 1, ndecomp_pools do j = 1, nlevdecomp_full do fi = 1,num_column @@ -8978,39 +8959,51 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) ! pflotran !------------------------------------------------------------------------ + if(nstep_mod == 0 .or. is_first_restart_step()) then + do k = 1, ndecomp_pools + do j = 1, nlevdecomp_full + do fi = 1,num_column + i = filter_column(fi) + this%m_decomp_npools_to_fire_vr(i,j,k) = value_column + ! only initializing in the first time-step + this%externaln_to_decomp_npools(i,j,k) = value_column + end do + end do + end do + do k = 1, ndecomp_pools do j = 1, nlevdecomp_full do fi = 1,num_column i = filter_column(fi) - ! only initializing in the first time-step - if ( this%externaln_to_decomp_npools(i,j,k) == spval ) then - this%externaln_to_decomp_npools(i,j,k) = value_column - end if + this%decomp_npools_transport_tendency(i,j,k) = value_column end do end do end do + do j = 1, nlevdecomp_full + do fi = 1,num_column + i = filter_column(fi) + ! only initializing in the first time-step + this%no3_net_transport_vr(i,j) = value_column + this%nh4_net_transport_vr(i,j) = value_column + end do + end do + + do fi = 1,num_column + i = filter_column(fi) + ! only initializing in the first time-step + this%externaln_to_decomp_delta(i) = value_column + end do + end if - do j = 1, nlevdecomp_full + if(use_crop) then + do j = 1, nlevdecomp_full do fi = 1,num_column - i = filter_column(fi) - ! only initializing in the first time-step - if ( this%no3_net_transport_vr(i,j) == spval ) then - this%no3_net_transport_vr(i,j) = value_column - end if - if ( this%nh4_net_transport_vr(i,j) == spval ) then - this%nh4_net_transport_vr(i,j) = value_column - end if + i = filter_column(fi) + this%f_nit_vr(i,j) = value_column + this%f_denit_vr(i,j) = value_column end do - end do - - do fi = 1,num_column - i = filter_column(fi) - ! only initializing in the first time-step - if ( this%externaln_to_decomp_delta(i) == spval ) then - this%externaln_to_decomp_delta(i) = value_column - end if - end do - + end do + end if end subroutine col_nf_setvalues !----------------------------------------------------------------------- @@ -9063,7 +9056,7 @@ subroutine col_nf_zero_forfates_veg(this, bounds, num_soilc, filter_soilc) integer , intent(in) :: filter_soilc(:) ! filter for soil columns ! locals integer :: fc - integer :: c + integer :: c,k,j if(.not.use_fates) return @@ -9074,6 +9067,16 @@ subroutine col_nf_zero_forfates_veg(this, bounds, num_soilc, filter_soilc) end do + !do k = 1, ndecomp_pools + ! do j = 1, nlevdecomp_full + ! do fc = 1,num_soilc + ! c = filter_soilc(fc) + ! this%m_decomp_npools_to_fire_vr(c,j,k) = 0._r8 + ! enddo + ! end do + !end do + + end subroutine col_nf_zero_forfates_veg !----------------------------------------------------------------------- @@ -9171,7 +9174,6 @@ subroutine col_nf_summary(this, bounds, num_soilc, filter_soilc) end do end if - ! vertically integrate column-level fire N losses do k = 1, ndecomp_pools do j = 1, nlev @@ -10343,7 +10345,6 @@ subroutine col_pf_setvalues ( this, num_column, filter_column, value_column) ! ! !DESCRIPTION: ! Set phosphorus flux variables - !$acc routine seq ! !ARGUMENTS: class (column_phosphorus_flux) :: this integer , intent(in) :: num_column @@ -10405,6 +10406,7 @@ subroutine col_pf_setvalues ( this, num_column, filter_column, value_column) this%plant_pdemand_vr(i,j) = value_column this%adsorb_to_labilep_vr(i,j) = value_column this%desorb_to_solutionp_vr(i,j) = value_column + end do end do @@ -10460,7 +10462,6 @@ subroutine col_pf_setvalues ( this, num_column, filter_column, value_column) ! bgc-interface this%plant_pdemand(i) = value_column - this%fire_ploss(i) = value_column this%wood_harvestp(i) = value_column this%adsorb_to_labilep(i) = value_column @@ -10479,17 +10480,6 @@ subroutine col_pf_setvalues ( this, num_column, filter_column, value_column) end do end do - do k = 1, ndecomp_pools - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%m_decomp_ppools_to_fire_vr(i,j,k) = value_column - this%decomp_ppools_transport_tendency(i,j,k) = value_column - this%decomp_ppools_yield_vr(i,j,k) = value_column - end do - end do - end do - do l = 1, ndecomp_cascade_transitions do fi = 1,num_column i = filter_column(fi) @@ -10498,16 +10488,6 @@ subroutine col_pf_setvalues ( this, num_column, filter_column, value_column) end do end do - do l = 1, ndecomp_cascade_transitions - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cascade_ptransfer_vr(i,j,l) = value_column - this%decomp_cascade_sminp_flux_vr(i,j,l) = value_column - end do - end do - end do - do k = 1, ndecomp_pools do j = 1, nlevdecomp_full do fi = 1,num_column @@ -10517,40 +10497,54 @@ subroutine col_pf_setvalues ( this, num_column, filter_column, value_column) end do end do end do + + do k = 1, ndecomp_pools + do j = 1, nlevdecomp_full + do fi = 1,num_column + i = filter_column(fi) + this%m_decomp_ppools_to_fire_vr(i,j,k) = value_column + this%decomp_ppools_transport_tendency(i,j,k) = value_column + this%decomp_ppools_yield_vr(i,j,k) = value_column + end do + end do + end do + + ! do l = 1, ndecomp_cascade_transitions + ! do j = 1, nlevdecomp_full + ! do fi = 1,num_column + ! i = filter_column(fi) + ! this%decomp_cascade_ptransfer_vr(i,j,l) = value_column + ! this%decomp_cascade_sminp_flux_vr(i,j,l) = value_column + ! end do + ! end do + ! end do ! pflotran - do k = 1, ndecomp_pools - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - ! only initializing in the first time-step - if ( this%externalp_to_decomp_ppools(i,j,k) == spval ) then - this%externalp_to_decomp_ppools(i,j,k) = value_column - end if - end do - end do - end do + if(nstep_mod == 0 .or. is_first_restart_step() ) then + do k = 1, ndecomp_pools + do j = 1, nlevdecomp_full + do fi = 1,num_column + i = filter_column(fi) + this%externalp_to_decomp_ppools(i,j,k) = value_column + end do + end do + end do do j = 1, nlevdecomp_full do fi = 1,num_column i = filter_column(fi) ! only initializing in the first time-step - if ( this%sminp_net_transport_vr(i,j) == spval ) then - this%sminp_net_transport_vr(i,j) = value_column - end if + this%sminp_net_transport_vr(i,j) = value_column end do end do do fi = 1,num_column i = filter_column(fi) ! only initializing in the first time-step - if ( this%externalp_to_decomp_delta(i) == spval ) then - this%externalp_to_decomp_delta(i) = value_column - end if - if ( this%sminp_net_transport_delta(i) == spval ) then - this%sminp_net_transport_delta(i) = value_column - end if - end do + this%externalp_to_decomp_delta(i) = value_column + this%sminp_net_transport_delta(i) = value_column + end do + end if end subroutine col_pf_setvalues @@ -10731,6 +10725,7 @@ subroutine col_pf_summary(this, bounds, num_soilc, filter_soilc) end if ! vertically integrate column-level fire P losses + if(.not. use_fates) then do k = 1, ndecomp_pools do j = 1, nlevdecomp do fc = 1,num_soilc @@ -10741,6 +10736,7 @@ subroutine col_pf_summary(this, bounds, num_soilc, filter_soilc) end do end do end do + end if ! vertically integrate column-level P erosion flux if (ero_ccycle) then diff --git a/components/elm/src/data_types/VegetationDataType.F90 b/components/elm/src/data_types/VegetationDataType.F90 index 5d84cce180bc..1911ffe44d05 100644 --- a/components/elm/src/data_types/VegetationDataType.F90 +++ b/components/elm/src/data_types/VegetationDataType.F90 @@ -11,7 +11,7 @@ module VegetationDataType use shr_log_mod , only : errMsg => shr_log_errMsg use spmdMod , only : masterproc use abortutils , only : endrun - use elm_time_manager, only : is_restart, get_nstep + use elm_time_manager, only : is_restart, get_nstep, is_first_restart_step use elm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevurb, nlevcan, crop_prog use elm_varpar , only : nlevdecomp, nlevdecomp_full use elm_varcon , only : spval, ispval, sb @@ -36,6 +36,8 @@ module VegetationDataType use ColumnDataType , only : column_carbon_state, column_carbon_flux use ColumnDataType , only : column_nitrogen_state, column_nitrogen_flux use ColumnDataType , only : column_phosphorus_state, column_phosphorus_flux + use timeInfoMod , only : nstep_mod + use dynSubgridControlMod, only : get_do_harvest ! ! !PUBLIC TYPES: implicit none @@ -3589,7 +3591,18 @@ subroutine veg_cs_summary(this, bounds, num_soilc, filter_soilc, num_soilp, filt this%totvegc(p) + & this%xsmrpool(p) + & this%ctrunc(p) - + if(abs(this%totpftc(p)) >= 1.e+20) then + print *, "p:",p + print *, "totvegc",this%totvegc(p) + print *, "dispvegc:",this%dispvegc(p) + print *, "grainc :", this%grainc(p) + print *, "leafc:",this%leafc(p) + print *, "frootc:",this%frootc(p) + print *, "livestemc:",this%livestemc(p) + print *, "deadstemc:",this%deadstemc(p) + print *, "livecrootc:",this%livecrootc(p) + print *, "deadcrootc:",this%deadcrootc(p) + end if ! (WOODC) - wood C this%woodc(p) = & this%deadstemc(p) + & @@ -8281,35 +8294,40 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%m_deadcrootc_storage_to_litter_fire(p) + & this%m_deadcrootc_xfer_to_litter_fire(p) + & this%m_gresp_storage_to_litter_fire(p) + & - this%m_gresp_xfer_to_litter_fire(p) + & - this%hrv_leafc_to_litter(p) + & - this%hrv_leafc_storage_to_litter(p) + & - this%hrv_leafc_xfer_to_litter(p) + & - this%hrv_frootc_to_litter(p) + & - this%hrv_frootc_storage_to_litter(p) + & - this%hrv_frootc_xfer_to_litter(p) + & - this%hrv_livestemc_to_litter(p) + & - this%hrv_livestemc_storage_to_litter(p) + & - this%hrv_livestemc_xfer_to_litter(p) + & - this%hrv_deadstemc_storage_to_litter(p) + & - this%hrv_deadstemc_xfer_to_litter(p) + & - this%hrv_livecrootc_to_litter(p) + & - this%hrv_livecrootc_storage_to_litter(p) + & - this%hrv_livecrootc_xfer_to_litter(p) + & - this%hrv_deadcrootc_to_litter(p) + & - this%hrv_deadcrootc_storage_to_litter(p) + & - this%hrv_deadcrootc_xfer_to_litter(p) + & - this%hrv_gresp_storage_to_litter(p) + & - this%hrv_gresp_xfer_to_litter(p) + & - this%hrv_cpool_to_litter(p) - + this%m_gresp_xfer_to_litter_fire(p) + + !if(get_do_harvest()) then + this%litfall(p) = this%litfall(p) + & + this%hrv_leafc_to_litter(p) + & + this%hrv_leafc_storage_to_litter(p) + & + this%hrv_leafc_xfer_to_litter(p) + & + this%hrv_frootc_to_litter(p) + & + this%hrv_frootc_storage_to_litter(p) + & + this%hrv_frootc_xfer_to_litter(p) + & + this%hrv_livestemc_to_litter(p) + & + this%hrv_livestemc_storage_to_litter(p) + & + this%hrv_livestemc_xfer_to_litter(p) + & + this%hrv_deadstemc_storage_to_litter(p) + & + this%hrv_deadstemc_xfer_to_litter(p) + & + this%hrv_livecrootc_to_litter(p) + & + this%hrv_livecrootc_storage_to_litter(p) + & + this%hrv_livecrootc_xfer_to_litter(p) + & + this%hrv_deadcrootc_to_litter(p) + & + this%hrv_deadcrootc_storage_to_litter(p) + & + this%hrv_deadcrootc_xfer_to_litter(p) + & + this%hrv_gresp_storage_to_litter(p) + & + this%hrv_gresp_xfer_to_litter(p) + & + this%hrv_cpool_to_litter(p) + ! end if ! patch-level fire losses (VEGFIRE) this%vegfire(p) = 0._r8 ! patch-level wood harvest + ! if(use_crop) then this%wood_harvestc(p) = & this%hrv_deadstemc_to_prod10c(p) + & this%hrv_deadstemc_to_prod100c(p) + !endif if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then this%wood_harvestc(p) = & this%wood_harvestc(p) + & @@ -8359,9 +8377,11 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%m_frootc_to_litter(p) + & this%m_frootc_to_fire(p) + & this%m_frootc_to_litter_fire(p) + & - this%hrv_frootc_to_litter(p) + & this%frootc_to_litter(p) - + ! if(use_crop) then + this%frootc_loss(p) = this%frootc_loss(p) + & + this%hrv_frootc_to_litter(p) + ! endif ! (LEAFC_ALLOC) - leaf C allocation this%leafc_alloc(p) = & this%leafc_xfer_to_leafc(p) + & @@ -8372,8 +8392,12 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%m_leafc_to_litter(p) + & this%m_leafc_to_fire(p) + & this%m_leafc_to_litter_fire(p) + & - this%hrv_leafc_to_litter(p) + & this%leafc_to_litter(p) + + !if(use_crop) then + this%leafc_loss(p) = this%leafc_loss(p) + & + this%hrv_leafc_to_litter(p) + !end if if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then this%leafc_loss(p) = & @@ -8402,20 +8426,24 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%m_livestemc_to_fire(p) + & this%m_deadstemc_to_fire(p) + & this%m_livecrootc_to_fire(p) + & - this%m_deadcrootc_to_fire(p) + & - this%hrv_livestemc_to_litter(p) + & - this%hrv_livestemc_storage_to_litter(p) + & - this%hrv_livestemc_xfer_to_litter(p) + & - this%hrv_deadstemc_to_prod10c(p) + & - this%hrv_deadstemc_to_prod100c(p) + & - this%hrv_deadstemc_storage_to_litter(p) + & - this%hrv_deadstemc_xfer_to_litter(p) + & - this%hrv_livecrootc_to_litter(p) + & - this%hrv_livecrootc_storage_to_litter(p) + & - this%hrv_livecrootc_xfer_to_litter(p) + & - this%hrv_deadcrootc_to_litter(p) + & - this%hrv_deadcrootc_storage_to_litter(p) + & - this%hrv_deadcrootc_xfer_to_litter(p) + this%m_deadcrootc_to_fire(p) + + ! if(use_crop) then + this%woodc_loss(p) = this%woodc_loss(p) + & + this%hrv_livestemc_to_litter(p) + & + this%hrv_livestemc_storage_to_litter(p) + & + this%hrv_livestemc_xfer_to_litter(p) + & + this%hrv_deadstemc_to_prod10c(p) + & + this%hrv_deadstemc_to_prod100c(p) + & + this%hrv_deadstemc_storage_to_litter(p) + & + this%hrv_deadstemc_xfer_to_litter(p) + & + this%hrv_livecrootc_to_litter(p) + & + this%hrv_livecrootc_storage_to_litter(p) + & + this%hrv_livecrootc_xfer_to_litter(p) + & + this%hrv_deadcrootc_to_litter(p) + & + this%hrv_deadcrootc_storage_to_litter(p) + & + this%hrv_deadcrootc_xfer_to_litter(p) + !end if ! putting the harvested crop stem and grain in the wood loss bdrewniak if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then this%woodc_loss(p) = & @@ -8591,101 +8619,7 @@ subroutine veg_cf_setvalues ( this, num_patch, filter_patch, value_patch) do fi = 1,num_patch i = filter_patch(fi) - this%m_leafc_to_litter(i) = value_patch - this%m_frootc_to_litter(i) = value_patch - this%m_leafc_storage_to_litter(i) = value_patch - this%m_frootc_storage_to_litter(i) = value_patch - this%m_livestemc_storage_to_litter(i) = value_patch - this%m_deadstemc_storage_to_litter(i) = value_patch - this%m_livecrootc_storage_to_litter(i) = value_patch - this%m_deadcrootc_storage_to_litter(i) = value_patch - this%m_leafc_xfer_to_litter(i) = value_patch - this%m_frootc_xfer_to_litter(i) = value_patch - this%m_livestemc_xfer_to_litter(i) = value_patch - this%m_deadstemc_xfer_to_litter(i) = value_patch - this%m_livecrootc_xfer_to_litter(i) = value_patch - this%m_deadcrootc_xfer_to_litter(i) = value_patch - this%m_livestemc_to_litter(i) = value_patch - this%m_deadstemc_to_litter(i) = value_patch - this%m_livecrootc_to_litter(i) = value_patch - this%m_deadcrootc_to_litter(i) = value_patch - this%m_gresp_storage_to_litter(i) = value_patch - this%m_gresp_xfer_to_litter(i) = value_patch - this%m_cpool_to_litter(i) = value_patch - this%hrv_leafc_to_litter(i) = value_patch - this%hrv_leafc_storage_to_litter(i) = value_patch - this%hrv_leafc_xfer_to_litter(i) = value_patch - this%hrv_frootc_to_litter(i) = value_patch - this%hrv_frootc_storage_to_litter(i) = value_patch - this%hrv_frootc_xfer_to_litter(i) = value_patch - this%hrv_livestemc_to_litter(i) = value_patch - this%hrv_livestemc_storage_to_litter(i) = value_patch - this%hrv_livestemc_xfer_to_litter(i) = value_patch - this%hrv_deadstemc_to_prod10c(i) = value_patch - this%hrv_deadstemc_to_prod100c(i) = value_patch - this%hrv_leafc_to_prod1c(i) = value_patch - this%hrv_livestemc_to_prod1c(i) = value_patch - this%hrv_grainc_to_prod1c(i) = value_patch - this%hrv_cropc_to_prod1c(i) = value_patch - this%hrv_deadstemc_storage_to_litter(i) = value_patch - this%hrv_deadstemc_xfer_to_litter(i) = value_patch - this%hrv_livecrootc_to_litter(i) = value_patch - this%hrv_livecrootc_storage_to_litter(i) = value_patch - this%hrv_livecrootc_xfer_to_litter(i) = value_patch - this%hrv_deadcrootc_to_litter(i) = value_patch - this%hrv_deadcrootc_storage_to_litter(i) = value_patch - this%hrv_deadcrootc_xfer_to_litter(i) = value_patch - this%hrv_gresp_storage_to_litter(i) = value_patch - this%hrv_gresp_xfer_to_litter(i) = value_patch - this%hrv_xsmrpool_to_atm(i) = value_patch - this%hrv_cpool_to_litter(i) = value_patch - - this%m_leafc_to_fire(i) = value_patch - this%m_leafc_storage_to_fire(i) = value_patch - this%m_leafc_xfer_to_fire(i) = value_patch - this%m_livestemc_to_fire(i) = value_patch - this%m_livestemc_storage_to_fire(i) = value_patch - this%m_livestemc_xfer_to_fire(i) = value_patch - this%m_deadstemc_to_fire(i) = value_patch - this%m_deadstemc_storage_to_fire(i) = value_patch - this%m_deadstemc_xfer_to_fire(i) = value_patch - this%m_frootc_to_fire(i) = value_patch - this%m_frootc_storage_to_fire(i) = value_patch - this%m_frootc_xfer_to_fire(i) = value_patch - this%m_livecrootc_to_fire(i) = value_patch - this%m_livecrootc_storage_to_fire(i) = value_patch - this%m_livecrootc_xfer_to_fire(i) = value_patch - this%m_deadcrootc_to_fire(i) = value_patch - this%m_deadcrootc_storage_to_fire(i) = value_patch - this%m_deadcrootc_xfer_to_fire(i) = value_patch - this%m_gresp_storage_to_fire(i) = value_patch - this%m_gresp_xfer_to_fire(i) = value_patch - this%m_cpool_to_fire(i) = value_patch - - this%m_leafc_to_litter_fire(i) = value_patch - this%m_leafc_storage_to_litter_fire(i) = value_patch - this%m_leafc_xfer_to_litter_fire(i) = value_patch - this%m_livestemc_to_litter_fire(i) = value_patch - this%m_livestemc_storage_to_litter_fire(i) = value_patch - this%m_livestemc_xfer_to_litter_fire(i) = value_patch - this%m_livestemc_to_deadstemc_fire(i) = value_patch - this%m_deadstemc_to_litter_fire(i) = value_patch - this%m_deadstemc_storage_to_litter_fire(i) = value_patch - this%m_deadstemc_xfer_to_litter_fire(i) = value_patch - this%m_frootc_to_litter_fire(i) = value_patch - this%m_frootc_storage_to_litter_fire(i) = value_patch - this%m_frootc_xfer_to_litter_fire(i) = value_patch - this%m_livecrootc_to_litter_fire(i) = value_patch - this%m_livecrootc_storage_to_litter_fire(i) = value_patch - this%m_livecrootc_xfer_to_litter_fire(i) = value_patch - this%m_livecrootc_to_deadcrootc_fire(i) = value_patch - this%m_deadcrootc_to_litter_fire(i) = value_patch - this%m_deadcrootc_storage_to_litter_fire(i) = value_patch - this%m_deadcrootc_xfer_to_litter_fire(i) = value_patch - this%m_gresp_storage_to_litter_fire(i) = value_patch - this%m_gresp_xfer_to_litter_fire(i) = value_patch - this%m_cpool_to_litter_fire(i) = value_patch - + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! this%leafc_xfer_to_leafc(i) = value_patch this%frootc_xfer_to_frootc(i) = value_patch this%livestemc_xfer_to_livestemc(i) = value_patch @@ -8726,12 +8660,7 @@ subroutine veg_cf_setvalues ( this, num_patch, filter_patch, value_patch) this%cpool_to_deadcrootc(i) = value_patch this%cpool_to_deadcrootc_storage(i) = value_patch this%cpool_to_gresp_storage(i) = value_patch - this%cpool_leaf_gr(i) = value_patch - this%cpool_leaf_storage_gr(i) = value_patch - this%transfer_leaf_gr(i) = value_patch - this%cpool_froot_gr(i) = value_patch - this%cpool_froot_storage_gr(i) = value_patch - this%transfer_froot_gr(i) = value_patch + this%cpool_livestem_gr(i) = value_patch this%cpool_livestem_storage_gr(i) = value_patch this%transfer_livestem_gr(i) = value_patch @@ -8744,6 +8673,7 @@ subroutine veg_cf_setvalues ( this, num_patch, filter_patch, value_patch) this%cpool_deadcroot_gr(i) = value_patch this%cpool_deadcroot_storage_gr(i) = value_patch this%transfer_deadcroot_gr(i) = value_patch + this%leafc_storage_to_xfer(i) = value_patch this%frootc_storage_to_xfer(i) = value_patch this%livestemc_storage_to_xfer(i) = value_patch @@ -8799,6 +8729,116 @@ subroutine veg_cf_setvalues ( this, num_patch, filter_patch, value_patch) end do end if + do fi = 1,num_patch + i = filter_patch(fi) + this%hrv_leafc_to_litter(i) = value_patch + this%hrv_leafc_storage_to_litter(i) = value_patch + this%hrv_leafc_xfer_to_litter(i) = value_patch + this%hrv_frootc_to_litter(i) = value_patch + this%hrv_frootc_storage_to_litter(i) = value_patch + this%hrv_frootc_xfer_to_litter(i) = value_patch + this%hrv_livestemc_to_litter(i) = value_patch + this%hrv_livestemc_storage_to_litter(i) = value_patch + this%hrv_livestemc_xfer_to_litter(i) = value_patch + this%hrv_deadstemc_to_prod10c(i) = value_patch + this%hrv_deadstemc_to_prod100c(i) = value_patch + this%hrv_leafc_to_prod1c(i) = value_patch + this%hrv_livestemc_to_prod1c(i) = value_patch + this%hrv_grainc_to_prod1c(i) = value_patch + this%hrv_cropc_to_prod1c(i) = value_patch + this%hrv_deadstemc_storage_to_litter(i) = value_patch + this%hrv_deadstemc_xfer_to_litter(i) = value_patch + this%hrv_livecrootc_to_litter(i) = value_patch + this%hrv_livecrootc_storage_to_litter(i) = value_patch + this%hrv_livecrootc_xfer_to_litter(i) = value_patch + this%hrv_deadcrootc_to_litter(i) = value_patch + this%hrv_deadcrootc_storage_to_litter(i) = value_patch + this%hrv_deadcrootc_xfer_to_litter(i) = value_patch + this%hrv_gresp_storage_to_litter(i) = value_patch + this%hrv_gresp_xfer_to_litter(i) = value_patch + this%hrv_xsmrpool_to_atm(i) = value_patch + this%hrv_cpool_to_litter(i) = value_patch + end do + if(nstep_mod == 0 .or. is_first_restart_step() .or. use_crop) then + + do fi = 1,num_patch + i = filter_patch(fi) + !!!!! + ! this%m_leafc_to_litter(i) = value_patch + ! this%m_frootc_to_litter(i) = value_patch + ! this%m_leafc_storage_to_litter(i) = value_patch + ! this%m_frootc_storage_to_litter(i) = value_patch + ! this%m_livestemc_storage_to_litter(i) = value_patch + ! this%m_deadstemc_storage_to_litter(i) = value_patch + ! this%m_livecrootc_storage_to_litter(i) = value_patch + ! this%m_deadcrootc_storage_to_litter(i) = value_patch + ! this%m_leafc_xfer_to_litter(i) = value_patch + ! this%m_frootc_xfer_to_litter(i) = value_patch + ! this%m_livestemc_xfer_to_litter(i) = value_patch + ! this%m_deadstemc_xfer_to_litter(i) = value_patch + ! this%m_livecrootc_xfer_to_litter(i) = value_patch + ! this%m_deadcrootc_xfer_to_litter(i) = value_patch + ! this%m_livestemc_to_litter(i) = value_patch + ! this%m_deadstemc_to_litter(i) = value_patch + ! this%m_livecrootc_to_litter(i) = value_patch + ! this%m_deadcrootc_to_litter(i) = value_patch + ! this%m_gresp_storage_to_litter(i) = value_patch + ! this%m_gresp_xfer_to_litter(i) = value_patch + ! this%m_cpool_to_litter(i) = value_patch + ! this%m_leafc_to_fire(i) = value_patch + ! this%m_leafc_storage_to_fire(i) = value_patch + ! this%m_leafc_xfer_to_fire(i) = value_patch + ! this%m_livestemc_to_fire(i) = value_patch + ! this%m_livestemc_storage_to_fire(i) = value_patch + ! this%m_livestemc_xfer_to_fire(i) = value_patch + ! this%m_deadstemc_to_fire(i) = value_patch + ! this%m_deadstemc_storage_to_fire(i) = value_patch + ! this%m_deadstemc_xfer_to_fire(i) = value_patch + ! this%m_frootc_to_fire(i) = value_patch + ! this%m_frootc_storage_to_fire(i) = value_patch + ! this%m_frootc_xfer_to_fire(i) = value_patch + ! this%m_livecrootc_to_fire(i) = value_patch + ! this%m_livecrootc_storage_to_fire(i) = value_patch + ! this%m_livecrootc_xfer_to_fire(i) = value_patch + ! this%m_deadcrootc_to_fire(i) = value_patch + ! this%m_deadcrootc_storage_to_fire(i) = value_patch + ! this%m_deadcrootc_xfer_to_fire(i) = value_patch + ! this%m_gresp_storage_to_fire(i) = value_patch + ! this%m_gresp_xfer_to_fire(i) = value_patch + ! this%m_cpool_to_fire(i) = value_patch + + ! this%m_leafc_to_litter_fire(i) = value_patch + ! this%m_leafc_storage_to_litter_fire(i) = value_patch + ! this%m_leafc_xfer_to_litter_fire(i) = value_patch + ! this%m_livestemc_to_litter_fire(i) = value_patch + ! this%m_livestemc_storage_to_litter_fire(i) = value_patch + ! this%m_livestemc_xfer_to_litter_fire(i) = value_patch + ! this%m_livestemc_to_deadstemc_fire(i) = value_patch + ! this%m_deadstemc_to_litter_fire(i) = value_patch + ! this%m_deadstemc_storage_to_litter_fire(i) = value_patch + ! this%m_deadstemc_xfer_to_litter_fire(i) = value_patch + ! this%m_frootc_to_litter_fire(i) = value_patch + ! this%m_frootc_storage_to_litter_fire(i) = value_patch + ! this%m_frootc_xfer_to_litter_fire(i) = value_patch + ! this%m_livecrootc_to_litter_fire(i) = value_patch + ! this%m_livecrootc_storage_to_litter_fire(i) = value_patch + ! this%m_livecrootc_xfer_to_litter_fire(i) = value_patch + ! this%m_livecrootc_to_deadcrootc_fire(i) = value_patch + ! this%m_deadcrootc_to_litter_fire(i) = value_patch + ! this%m_deadcrootc_storage_to_litter_fire(i) = value_patch + ! this%m_deadcrootc_xfer_to_litter_fire(i) = value_patch + ! this%m_gresp_storage_to_litter_fire(i) = value_patch + ! this%m_gresp_xfer_to_litter_fire(i) = value_patch + ! this%m_cpool_to_litter_fire(i) = value_patch + ! + ! this%cpool_leaf_gr(i) = value_patch + ! this%cpool_leaf_storage_gr(i) = value_patch + ! this%transfer_leaf_gr(i) = value_patch + ! this%cpool_froot_gr(i) = value_patch + ! this%cpool_froot_storage_gr(i) = value_patch + ! this%transfer_froot_gr(i) = value_patch + end do + end if end subroutine veg_cf_setvalues !------------------------------------------------------------------------ @@ -9624,26 +9664,26 @@ subroutine veg_nf_setvalues ( this, num_patch, filter_patch, value_patch) do fi = 1,num_patch i=filter_patch(fi) - this%m_leafn_to_litter(i) = value_patch - this%m_frootn_to_litter(i) = value_patch - this%m_leafn_storage_to_litter(i) = value_patch - this%m_frootn_storage_to_litter(i) = value_patch - this%m_livestemn_storage_to_litter(i) = value_patch - this%m_deadstemn_storage_to_litter(i) = value_patch - this%m_livecrootn_storage_to_litter(i) = value_patch - this%m_deadcrootn_storage_to_litter(i) = value_patch - this%m_leafn_xfer_to_litter(i) = value_patch - this%m_frootn_xfer_to_litter(i) = value_patch - this%m_livestemn_xfer_to_litter(i) = value_patch - this%m_deadstemn_xfer_to_litter(i) = value_patch - this%m_livecrootn_xfer_to_litter(i) = value_patch - this%m_deadcrootn_xfer_to_litter(i) = value_patch - this%m_livestemn_to_litter(i) = value_patch - this%m_deadstemn_to_litter(i) = value_patch - this%m_livecrootn_to_litter(i) = value_patch - this%m_deadcrootn_to_litter(i) = value_patch - this%m_retransn_to_litter(i) = value_patch - this%m_npool_to_litter(i) = value_patch + !this%m_leafn_to_litter(i) = value_patch + !this%m_frootn_to_litter(i) = value_patch + !this%m_leafn_storage_to_litter(i) = value_patch + !this%m_frootn_storage_to_litter(i) = value_patch + !this%m_livestemn_storage_to_litter(i) = value_patch + !this%m_deadstemn_storage_to_litter(i) = value_patch + !this%m_livecrootn_storage_to_litter(i) = value_patch + !this%m_deadcrootn_storage_to_litter(i) = value_patch + !this%m_leafn_xfer_to_litter(i) = value_patch + !this%m_frootn_xfer_to_litter(i) = value_patch + !this%m_livestemn_xfer_to_litter(i) = value_patch + !this%m_deadstemn_xfer_to_litter(i) = value_patch + !this%m_livecrootn_xfer_to_litter(i) = value_patch + !this%m_deadcrootn_xfer_to_litter(i) = value_patch + !this%m_livestemn_to_litter(i) = value_patch + !this%m_deadstemn_to_litter(i) = value_patch + !this%m_livecrootn_to_litter(i) = value_patch + !this%m_deadcrootn_to_litter(i) = value_patch + !this%m_retransn_to_litter(i) = value_patch + !this%m_npool_to_litter(i) = value_patch this%hrv_leafn_to_litter(i) = value_patch this%hrv_frootn_to_litter(i) = value_patch this%hrv_leafn_storage_to_litter(i) = value_patch @@ -9671,49 +9711,49 @@ subroutine veg_nf_setvalues ( this, num_patch, filter_patch, value_patch) this%hrv_retransn_to_litter(i) = value_patch this%hrv_npool_to_litter(i) = value_patch - this%m_leafn_to_fire(i) = value_patch - this%m_leafn_storage_to_fire(i) = value_patch - this%m_leafn_xfer_to_fire(i) = value_patch - this%m_livestemn_to_fire(i) = value_patch - this%m_livestemn_storage_to_fire(i) = value_patch - this%m_livestemn_xfer_to_fire(i) = value_patch - this%m_deadstemn_to_fire(i) = value_patch - this%m_deadstemn_storage_to_fire(i) = value_patch - this%m_deadstemn_xfer_to_fire(i) = value_patch - this%m_frootn_to_fire(i) = value_patch - this%m_frootn_storage_to_fire(i) = value_patch - this%m_frootn_xfer_to_fire(i) = value_patch - this%m_livecrootn_to_fire(i) = value_patch - this%m_livecrootn_storage_to_fire(i) = value_patch - this%m_livecrootn_xfer_to_fire(i) = value_patch - this%m_deadcrootn_to_fire(i) = value_patch - this%m_deadcrootn_storage_to_fire(i) = value_patch - this%m_deadcrootn_xfer_to_fire(i) = value_patch - this%m_retransn_to_fire(i) = value_patch - this%m_npool_to_fire(i) = value_patch - - this%m_leafn_to_litter_fire(i) = value_patch - this%m_leafn_storage_to_litter_fire(i) = value_patch - this%m_leafn_xfer_to_litter_fire(i) = value_patch - this%m_livestemn_to_litter_fire(i) = value_patch - this%m_livestemn_storage_to_litter_fire(i) = value_patch - this%m_livestemn_xfer_to_litter_fire(i) = value_patch - this%m_livestemn_to_deadstemn_fire(i) = value_patch - this%m_deadstemn_to_litter_fire(i) = value_patch - this%m_deadstemn_storage_to_litter_fire(i) = value_patch - this%m_deadstemn_xfer_to_litter_fire(i) = value_patch - this%m_frootn_to_litter_fire(i) = value_patch - this%m_frootn_storage_to_litter_fire(i) = value_patch - this%m_frootn_xfer_to_litter_fire(i) = value_patch - this%m_livecrootn_to_litter_fire(i) = value_patch - this%m_livecrootn_storage_to_litter_fire(i) = value_patch - this%m_livecrootn_xfer_to_litter_fire(i) = value_patch - this%m_livecrootn_to_deadcrootn_fire(i) = value_patch - this%m_deadcrootn_to_litter_fire(i) = value_patch - this%m_deadcrootn_storage_to_litter_fire(i) = value_patch - this%m_deadcrootn_xfer_to_litter_fire(i) = value_patch - this%m_retransn_to_litter_fire(i) = value_patch - this%m_npool_to_litter_fire(i) = value_patch + !this%m_leafn_to_fire(i) = value_patch + !this%m_leafn_storage_to_fire(i) = value_patch + !this%m_leafn_xfer_to_fire(i) = value_patch + !this%m_livestemn_to_fire(i) = value_patch + !this%m_livestemn_storage_to_fire(i) = value_patch + !this%m_livestemn_xfer_to_fire(i) = value_patch + !this%m_deadstemn_to_fire(i) = value_patch + !this%m_deadstemn_storage_to_fire(i) = value_patch + !this%m_deadstemn_xfer_to_fire(i) = value_patch + !this%m_frootn_to_fire(i) = value_patch + !this%m_frootn_storage_to_fire(i) = value_patch + !this%m_frootn_xfer_to_fire(i) = value_patch + !this%m_livecrootn_to_fire(i) = value_patch + !this%m_livecrootn_storage_to_fire(i) = value_patch + !this%m_livecrootn_xfer_to_fire(i) = value_patch + !this%m_deadcrootn_to_fire(i) = value_patch + !this%m_deadcrootn_storage_to_fire(i) = value_patch + !this%m_deadcrootn_xfer_to_fire(i) = value_patch + !this%m_retransn_to_fire(i) = value_patch + !this%m_npool_to_fire(i) = value_patch + + !this%m_leafn_to_litter_fire(i) = value_patch + !this%m_leafn_storage_to_litter_fire(i) = value_patch + !this%m_leafn_xfer_to_litter_fire(i) = value_patch + !this%m_livestemn_to_litter_fire(i) = value_patch + !this%m_livestemn_storage_to_litter_fire(i) = value_patch + !this%m_livestemn_xfer_to_litter_fire(i) = value_patch + !this%m_livestemn_to_deadstemn_fire(i) = value_patch + !this%m_deadstemn_to_litter_fire(i) = value_patch + !this%m_deadstemn_storage_to_litter_fire(i) = value_patch + !this%m_deadstemn_xfer_to_litter_fire(i) = value_patch + !this%m_frootn_to_litter_fire(i) = value_patch + !this%m_frootn_storage_to_litter_fire(i) = value_patch + !this%m_frootn_xfer_to_litter_fire(i) = value_patch + !this%m_livecrootn_to_litter_fire(i) = value_patch + !this%m_livecrootn_storage_to_litter_fire(i) = value_patch + !this%m_livecrootn_xfer_to_litter_fire(i) = value_patch + !this%m_livecrootn_to_deadcrootn_fire(i) = value_patch + !this%m_deadcrootn_to_litter_fire(i) = value_patch + !this%m_deadcrootn_storage_to_litter_fire(i) = value_patch + !this%m_deadcrootn_xfer_to_litter_fire(i) = value_patch + !this%m_retransn_to_litter_fire(i) = value_patch + !this%m_npool_to_litter_fire(i) = value_patch this%leafn_xfer_to_leafn(i) = value_patch this%frootn_xfer_to_frootn(i) = value_patch @@ -10752,26 +10792,26 @@ subroutine veg_pf_setvalues ( this, num_patch, filter_patch, value_patch) do fi = 1,num_patch i=filter_patch(fi) - this%m_leafp_to_litter(i) = value_patch - this%m_frootp_to_litter(i) = value_patch - this%m_leafp_storage_to_litter(i) = value_patch - this%m_frootp_storage_to_litter(i) = value_patch - this%m_livestemp_storage_to_litter(i) = value_patch - this%m_deadstemp_storage_to_litter(i) = value_patch - this%m_livecrootp_storage_to_litter(i) = value_patch - this%m_deadcrootp_storage_to_litter(i) = value_patch - this%m_leafp_xfer_to_litter(i) = value_patch - this%m_frootp_xfer_to_litter(i) = value_patch - this%m_livestemp_xfer_to_litter(i) = value_patch - this%m_deadstemp_xfer_to_litter(i) = value_patch - this%m_livecrootp_xfer_to_litter(i) = value_patch - this%m_deadcrootp_xfer_to_litter(i) = value_patch - this%m_livestemp_to_litter(i) = value_patch - this%m_deadstemp_to_litter(i) = value_patch - this%m_livecrootp_to_litter(i) = value_patch - this%m_deadcrootp_to_litter(i) = value_patch - this%m_retransp_to_litter(i) = value_patch - this%m_ppool_to_litter(i) = value_patch + !this%m_leafp_to_litter(i) = value_patch + !this%m_frootp_to_litter(i) = value_patch + !this%m_leafp_storage_to_litter(i) = value_patch + !this%m_frootp_storage_to_litter(i) = value_patch + !this%m_livestemp_storage_to_litter(i) = value_patch + !this%m_deadstemp_storage_to_litter(i) = value_patch + !this%m_livecrootp_storage_to_litter(i) = value_patch + !this%m_deadcrootp_storage_to_litter(i) = value_patch + !this%m_leafp_xfer_to_litter(i) = value_patch + !this%m_frootp_xfer_to_litter(i) = value_patch + !this%m_livestemp_xfer_to_litter(i) = value_patch + !this%m_deadstemp_xfer_to_litter(i) = value_patch + !this%m_livecrootp_xfer_to_litter(i) = value_patch + !this%m_deadcrootp_xfer_to_litter(i) = value_patch + !this%m_livestemp_to_litter(i) = value_patch + !this%m_deadstemp_to_litter(i) = value_patch + !this%m_livecrootp_to_litter(i) = value_patch + !this%m_deadcrootp_to_litter(i) = value_patch + !this%m_retransp_to_litter(i) = value_patch + !this%m_ppool_to_litter(i) = value_patch this%hrv_leafp_to_litter(i) = value_patch this%hrv_frootp_to_litter(i) = value_patch this%hrv_leafp_storage_to_litter(i) = value_patch @@ -10798,49 +10838,49 @@ subroutine veg_pf_setvalues ( this, num_patch, filter_patch, value_patch) this%hrv_retransp_to_litter(i) = value_patch this%hrv_ppool_to_litter(i) = value_patch - this%m_leafp_to_fire(i) = value_patch - this%m_leafp_storage_to_fire(i) = value_patch - this%m_leafp_xfer_to_fire(i) = value_patch - this%m_livestemp_to_fire(i) = value_patch - this%m_livestemp_storage_to_fire(i) = value_patch - this%m_livestemp_xfer_to_fire(i) = value_patch - this%m_deadstemp_to_fire(i) = value_patch - this%m_deadstemp_storage_to_fire(i) = value_patch - this%m_deadstemp_xfer_to_fire(i) = value_patch - this%m_frootp_to_fire(i) = value_patch - this%m_frootp_storage_to_fire(i) = value_patch - this%m_frootp_xfer_to_fire(i) = value_patch - this%m_livecrootp_to_fire(i) = value_patch - this%m_livecrootp_storage_to_fire(i) = value_patch - this%m_livecrootp_xfer_to_fire(i) = value_patch - this%m_deadcrootp_to_fire(i) = value_patch - this%m_deadcrootp_storage_to_fire(i) = value_patch - this%m_deadcrootp_xfer_to_fire(i) = value_patch - this%m_retransp_to_fire(i) = value_patch - this%m_ppool_to_fire(i) = value_patch - - this%m_leafp_to_litter_fire(i) = value_patch - this%m_leafp_storage_to_litter_fire(i) = value_patch - this%m_leafp_xfer_to_litter_fire(i) = value_patch - this%m_livestemp_to_litter_fire(i) = value_patch - this%m_livestemp_storage_to_litter_fire(i) = value_patch - this%m_livestemp_xfer_to_litter_fire(i) = value_patch - this%m_livestemp_to_deadstemp_fire(i) = value_patch - this%m_deadstemp_to_litter_fire(i) = value_patch - this%m_deadstemp_storage_to_litter_fire(i) = value_patch - this%m_deadstemp_xfer_to_litter_fire(i) = value_patch - this%m_frootp_to_litter_fire(i) = value_patch - this%m_frootp_storage_to_litter_fire(i) = value_patch - this%m_frootp_xfer_to_litter_fire(i) = value_patch - this%m_livecrootp_to_litter_fire(i) = value_patch - this%m_livecrootp_storage_to_litter_fire(i) = value_patch - this%m_livecrootp_xfer_to_litter_fire(i) = value_patch - this%m_livecrootp_to_deadcrootp_fire(i) = value_patch - this%m_deadcrootp_to_litter_fire(i) = value_patch - this%m_deadcrootp_storage_to_litter_fire(i) = value_patch - this%m_deadcrootp_xfer_to_litter_fire(i) = value_patch - this%m_retransp_to_litter_fire(i) = value_patch - this%m_ppool_to_litter_fire(i) = value_patch + ! this%m_leafp_to_fire(i) = value_patch + ! this%m_leafp_storage_to_fire(i) = value_patch + ! this%m_leafp_xfer_to_fire(i) = value_patch + ! this%m_livestemp_to_fire(i) = value_patch + ! this%m_livestemp_storage_to_fire(i) = value_patch + ! this%m_livestemp_xfer_to_fire(i) = value_patch + ! this%m_deadstemp_to_fire(i) = value_patch + ! this%m_deadstemp_storage_to_fire(i) = value_patch + ! this%m_deadstemp_xfer_to_fire(i) = value_patch + ! this%m_frootp_to_fire(i) = value_patch + ! this%m_frootp_storage_to_fire(i) = value_patch + ! this%m_frootp_xfer_to_fire(i) = value_patch + ! this%m_livecrootp_to_fire(i) = value_patch + ! this%m_livecrootp_storage_to_fire(i) = value_patch + ! this%m_livecrootp_xfer_to_fire(i) = value_patch + ! this%m_deadcrootp_to_fire(i) = value_patch + ! this%m_deadcrootp_storage_to_fire(i) = value_patch + ! this%m_deadcrootp_xfer_to_fire(i) = value_patch + ! this%m_retransp_to_fire(i) = value_patch + ! this%m_ppool_to_fire(i) = value_patch + + ! this%m_leafp_to_litter_fire(i) = value_patch + ! this%m_leafp_storage_to_litter_fire(i) = value_patch + ! this%m_leafp_xfer_to_litter_fire(i) = value_patch + ! this%m_livestemp_to_litter_fire(i) = value_patch + ! this%m_livestemp_storage_to_litter_fire(i) = value_patch + ! this%m_livestemp_xfer_to_litter_fire(i) = value_patch + ! this%m_livestemp_to_deadstemp_fire(i) = value_patch + ! this%m_deadstemp_to_litter_fire(i) = value_patch + ! this%m_deadstemp_storage_to_litter_fire(i) = value_patch + ! this%m_deadstemp_xfer_to_litter_fire(i) = value_patch + ! this%m_frootp_to_litter_fire(i) = value_patch + ! this%m_frootp_storage_to_litter_fire(i) = value_patch + ! this%m_frootp_xfer_to_litter_fire(i) = value_patch + ! this%m_livecrootp_to_litter_fire(i) = value_patch + ! this%m_livecrootp_storage_to_litter_fire(i) = value_patch + ! this%m_livecrootp_xfer_to_litter_fire(i) = value_patch + ! this%m_livecrootp_to_deadcrootp_fire(i) = value_patch + ! this%m_deadcrootp_to_litter_fire(i) = value_patch + ! this%m_deadcrootp_storage_to_litter_fire(i) = value_patch + ! this%m_deadcrootp_xfer_to_litter_fire(i) = value_patch + ! this%m_retransp_to_litter_fire(i) = value_patch + ! this%m_ppool_to_litter_fire(i) = value_patch this%leafp_xfer_to_leafp(i) = value_patch this%frootp_xfer_to_frootp(i) = value_patch From de984a1e78ee1c9ccfafe32320e68fd37054434a Mon Sep 17 00:00:00 2001 From: Peter Schwartz Date: Wed, 1 Nov 2023 12:35:49 -0500 Subject: [PATCH 2/6] Made sure certain mortality variables are set to zero in the GapMortality. Cleaned up the comments in VegetationDataType --- .../elm/src/biogeochem/GapMortalityMod.F90 | 7 + .../elm/src/data_types/VegetationDataType.F90 | 269 ++---------------- 2 files changed, 38 insertions(+), 238 deletions(-) diff --git a/components/elm/src/biogeochem/GapMortalityMod.F90 b/components/elm/src/biogeochem/GapMortalityMod.F90 index 32e16e123ca2..495c46ed0dfc 100644 --- a/components/elm/src/biogeochem/GapMortalityMod.F90 +++ b/components/elm/src/biogeochem/GapMortalityMod.F90 @@ -180,6 +180,8 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & !------------------------------------------------------ ! displayed pools + veg_nf%m_leafn_to_litter(p) = 0._r8 + veg_nf%m_livestemn_to_litter(p) = 0._r8 if(ivt(p) < npcropmin .or. (ivt(p) >= npcropmin .and. croplive(p))) then veg_nf%m_leafn_to_litter(p) = veg_ns%leafn(p) * m veg_nf%m_livestemn_to_litter(p) = veg_ns%livestemn(p) * m @@ -188,6 +190,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_nf%m_deadstemn_to_litter(p) = veg_ns%deadstemn(p) * m veg_nf%m_livecrootn_to_litter(p) = veg_ns%livecrootn(p) * m veg_nf%m_deadcrootn_to_litter(p) = veg_ns%deadcrootn(p) * m + veg_nf%m_retransn_to_litter(p) = 0._r8 if (ivt(p) < npcropmin) then veg_nf%m_retransn_to_litter(p) = veg_ns%retransn(p) * m end if @@ -221,6 +224,8 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & !------------------------------------------------------ ! displayed pools + veg_pf%m_leafp_to_litter(p) = 0._r8 + veg_pf%m_livestemp_to_litter(p) = 0._r8 if(ivt(p) < npcropmin .or. (ivt(p) >= npcropmin .and. croplive(p))) then veg_pf%m_leafp_to_litter(p) = veg_ps%leafp(p) * m veg_pf%m_livestemp_to_litter(p) = veg_ps%livestemp(p) * m @@ -229,6 +234,8 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_pf%m_deadstemp_to_litter(p) = veg_ps%deadstemp(p) * m veg_pf%m_livecrootp_to_litter(p) = veg_ps%livecrootp(p) * m veg_pf%m_deadcrootp_to_litter(p) = veg_ps%deadcrootp(p) * m + + veg_pf%m_retransp_to_litter(p) = 0._r8 if (ivt(p) < npcropmin) then veg_pf%m_retransp_to_litter(p) = veg_ps%retransp(p) * m end if diff --git a/components/elm/src/data_types/VegetationDataType.F90 b/components/elm/src/data_types/VegetationDataType.F90 index 1911ffe44d05..775103ea411c 100644 --- a/components/elm/src/data_types/VegetationDataType.F90 +++ b/components/elm/src/data_types/VegetationDataType.F90 @@ -8695,7 +8695,7 @@ subroutine veg_cf_setvalues ( this, num_patch, filter_patch, value_patch) this%npp(i) = value_patch this%agnpp(i) = value_patch this%bgnpp(i) = value_patch - this%agwdnpp(i) = value_patch + this%agwdnpp(i) = value_patch this%litfall(i) = value_patch this%vegfire(i) = value_patch this%wood_harvestc(i) = value_patch @@ -8729,116 +8729,36 @@ subroutine veg_cf_setvalues ( this, num_patch, filter_patch, value_patch) end do end if - do fi = 1,num_patch - i = filter_patch(fi) - this%hrv_leafc_to_litter(i) = value_patch - this%hrv_leafc_storage_to_litter(i) = value_patch - this%hrv_leafc_xfer_to_litter(i) = value_patch - this%hrv_frootc_to_litter(i) = value_patch - this%hrv_frootc_storage_to_litter(i) = value_patch - this%hrv_frootc_xfer_to_litter(i) = value_patch - this%hrv_livestemc_to_litter(i) = value_patch - this%hrv_livestemc_storage_to_litter(i) = value_patch - this%hrv_livestemc_xfer_to_litter(i) = value_patch - this%hrv_deadstemc_to_prod10c(i) = value_patch - this%hrv_deadstemc_to_prod100c(i) = value_patch - this%hrv_leafc_to_prod1c(i) = value_patch - this%hrv_livestemc_to_prod1c(i) = value_patch - this%hrv_grainc_to_prod1c(i) = value_patch - this%hrv_cropc_to_prod1c(i) = value_patch - this%hrv_deadstemc_storage_to_litter(i) = value_patch - this%hrv_deadstemc_xfer_to_litter(i) = value_patch - this%hrv_livecrootc_to_litter(i) = value_patch - this%hrv_livecrootc_storage_to_litter(i) = value_patch - this%hrv_livecrootc_xfer_to_litter(i) = value_patch - this%hrv_deadcrootc_to_litter(i) = value_patch - this%hrv_deadcrootc_storage_to_litter(i) = value_patch - this%hrv_deadcrootc_xfer_to_litter(i) = value_patch - this%hrv_gresp_storage_to_litter(i) = value_patch - this%hrv_gresp_xfer_to_litter(i) = value_patch - this%hrv_xsmrpool_to_atm(i) = value_patch - this%hrv_cpool_to_litter(i) = value_patch - end do - if(nstep_mod == 0 .or. is_first_restart_step() .or. use_crop) then - - do fi = 1,num_patch - i = filter_patch(fi) - !!!!! - ! this%m_leafc_to_litter(i) = value_patch - ! this%m_frootc_to_litter(i) = value_patch - ! this%m_leafc_storage_to_litter(i) = value_patch - ! this%m_frootc_storage_to_litter(i) = value_patch - ! this%m_livestemc_storage_to_litter(i) = value_patch - ! this%m_deadstemc_storage_to_litter(i) = value_patch - ! this%m_livecrootc_storage_to_litter(i) = value_patch - ! this%m_deadcrootc_storage_to_litter(i) = value_patch - ! this%m_leafc_xfer_to_litter(i) = value_patch - ! this%m_frootc_xfer_to_litter(i) = value_patch - ! this%m_livestemc_xfer_to_litter(i) = value_patch - ! this%m_deadstemc_xfer_to_litter(i) = value_patch - ! this%m_livecrootc_xfer_to_litter(i) = value_patch - ! this%m_deadcrootc_xfer_to_litter(i) = value_patch - ! this%m_livestemc_to_litter(i) = value_patch - ! this%m_deadstemc_to_litter(i) = value_patch - ! this%m_livecrootc_to_litter(i) = value_patch - ! this%m_deadcrootc_to_litter(i) = value_patch - ! this%m_gresp_storage_to_litter(i) = value_patch - ! this%m_gresp_xfer_to_litter(i) = value_patch - ! this%m_cpool_to_litter(i) = value_patch - ! this%m_leafc_to_fire(i) = value_patch - ! this%m_leafc_storage_to_fire(i) = value_patch - ! this%m_leafc_xfer_to_fire(i) = value_patch - ! this%m_livestemc_to_fire(i) = value_patch - ! this%m_livestemc_storage_to_fire(i) = value_patch - ! this%m_livestemc_xfer_to_fire(i) = value_patch - ! this%m_deadstemc_to_fire(i) = value_patch - ! this%m_deadstemc_storage_to_fire(i) = value_patch - ! this%m_deadstemc_xfer_to_fire(i) = value_patch - ! this%m_frootc_to_fire(i) = value_patch - ! this%m_frootc_storage_to_fire(i) = value_patch - ! this%m_frootc_xfer_to_fire(i) = value_patch - ! this%m_livecrootc_to_fire(i) = value_patch - ! this%m_livecrootc_storage_to_fire(i) = value_patch - ! this%m_livecrootc_xfer_to_fire(i) = value_patch - ! this%m_deadcrootc_to_fire(i) = value_patch - ! this%m_deadcrootc_storage_to_fire(i) = value_patch - ! this%m_deadcrootc_xfer_to_fire(i) = value_patch - ! this%m_gresp_storage_to_fire(i) = value_patch - ! this%m_gresp_xfer_to_fire(i) = value_patch - ! this%m_cpool_to_fire(i) = value_patch - - ! this%m_leafc_to_litter_fire(i) = value_patch - ! this%m_leafc_storage_to_litter_fire(i) = value_patch - ! this%m_leafc_xfer_to_litter_fire(i) = value_patch - ! this%m_livestemc_to_litter_fire(i) = value_patch - ! this%m_livestemc_storage_to_litter_fire(i) = value_patch - ! this%m_livestemc_xfer_to_litter_fire(i) = value_patch - ! this%m_livestemc_to_deadstemc_fire(i) = value_patch - ! this%m_deadstemc_to_litter_fire(i) = value_patch - ! this%m_deadstemc_storage_to_litter_fire(i) = value_patch - ! this%m_deadstemc_xfer_to_litter_fire(i) = value_patch - ! this%m_frootc_to_litter_fire(i) = value_patch - ! this%m_frootc_storage_to_litter_fire(i) = value_patch - ! this%m_frootc_xfer_to_litter_fire(i) = value_patch - ! this%m_livecrootc_to_litter_fire(i) = value_patch - ! this%m_livecrootc_storage_to_litter_fire(i) = value_patch - ! this%m_livecrootc_xfer_to_litter_fire(i) = value_patch - ! this%m_livecrootc_to_deadcrootc_fire(i) = value_patch - ! this%m_deadcrootc_to_litter_fire(i) = value_patch - ! this%m_deadcrootc_storage_to_litter_fire(i) = value_patch - ! this%m_deadcrootc_xfer_to_litter_fire(i) = value_patch - ! this%m_gresp_storage_to_litter_fire(i) = value_patch - ! this%m_gresp_xfer_to_litter_fire(i) = value_patch - ! this%m_cpool_to_litter_fire(i) = value_patch - ! - ! this%cpool_leaf_gr(i) = value_patch - ! this%cpool_leaf_storage_gr(i) = value_patch - ! this%transfer_leaf_gr(i) = value_patch - ! this%cpool_froot_gr(i) = value_patch - ! this%cpool_froot_storage_gr(i) = value_patch - ! this%transfer_froot_gr(i) = value_patch - end do - end if + do fi = 1,num_patch + i = filter_patch(fi) + this%hrv_leafc_to_litter(i) = value_patch + this%hrv_leafc_storage_to_litter(i) = value_patch + this%hrv_leafc_xfer_to_litter(i) = value_patch + this%hrv_frootc_to_litter(i) = value_patch + this%hrv_frootc_storage_to_litter(i) = value_patch + this%hrv_frootc_xfer_to_litter(i) = value_patch + this%hrv_livestemc_to_litter(i) = value_patch + this%hrv_livestemc_storage_to_litter(i) = value_patch + this%hrv_livestemc_xfer_to_litter(i) = value_patch + this%hrv_deadstemc_to_prod10c(i) = value_patch + this%hrv_deadstemc_to_prod100c(i) = value_patch + this%hrv_leafc_to_prod1c(i) = value_patch + this%hrv_livestemc_to_prod1c(i) = value_patch + this%hrv_grainc_to_prod1c(i) = value_patch + this%hrv_cropc_to_prod1c(i) = value_patch + this%hrv_deadstemc_storage_to_litter(i) = value_patch + this%hrv_deadstemc_xfer_to_litter(i) = value_patch + this%hrv_livecrootc_to_litter(i) = value_patch + this%hrv_livecrootc_storage_to_litter(i) = value_patch + this%hrv_livecrootc_xfer_to_litter(i) = value_patch + this%hrv_deadcrootc_to_litter(i) = value_patch + this%hrv_deadcrootc_storage_to_litter(i) = value_patch + this%hrv_deadcrootc_xfer_to_litter(i) = value_patch + this%hrv_gresp_storage_to_litter(i) = value_patch + this%hrv_gresp_xfer_to_litter(i) = value_patch + this%hrv_xsmrpool_to_atm(i) = value_patch + this%hrv_cpool_to_litter(i) = value_patch + end do end subroutine veg_cf_setvalues !------------------------------------------------------------------------ @@ -9664,26 +9584,6 @@ subroutine veg_nf_setvalues ( this, num_patch, filter_patch, value_patch) do fi = 1,num_patch i=filter_patch(fi) - !this%m_leafn_to_litter(i) = value_patch - !this%m_frootn_to_litter(i) = value_patch - !this%m_leafn_storage_to_litter(i) = value_patch - !this%m_frootn_storage_to_litter(i) = value_patch - !this%m_livestemn_storage_to_litter(i) = value_patch - !this%m_deadstemn_storage_to_litter(i) = value_patch - !this%m_livecrootn_storage_to_litter(i) = value_patch - !this%m_deadcrootn_storage_to_litter(i) = value_patch - !this%m_leafn_xfer_to_litter(i) = value_patch - !this%m_frootn_xfer_to_litter(i) = value_patch - !this%m_livestemn_xfer_to_litter(i) = value_patch - !this%m_deadstemn_xfer_to_litter(i) = value_patch - !this%m_livecrootn_xfer_to_litter(i) = value_patch - !this%m_deadcrootn_xfer_to_litter(i) = value_patch - !this%m_livestemn_to_litter(i) = value_patch - !this%m_deadstemn_to_litter(i) = value_patch - !this%m_livecrootn_to_litter(i) = value_patch - !this%m_deadcrootn_to_litter(i) = value_patch - !this%m_retransn_to_litter(i) = value_patch - !this%m_npool_to_litter(i) = value_patch this%hrv_leafn_to_litter(i) = value_patch this%hrv_frootn_to_litter(i) = value_patch this%hrv_leafn_storage_to_litter(i) = value_patch @@ -9711,49 +9611,6 @@ subroutine veg_nf_setvalues ( this, num_patch, filter_patch, value_patch) this%hrv_retransn_to_litter(i) = value_patch this%hrv_npool_to_litter(i) = value_patch - !this%m_leafn_to_fire(i) = value_patch - !this%m_leafn_storage_to_fire(i) = value_patch - !this%m_leafn_xfer_to_fire(i) = value_patch - !this%m_livestemn_to_fire(i) = value_patch - !this%m_livestemn_storage_to_fire(i) = value_patch - !this%m_livestemn_xfer_to_fire(i) = value_patch - !this%m_deadstemn_to_fire(i) = value_patch - !this%m_deadstemn_storage_to_fire(i) = value_patch - !this%m_deadstemn_xfer_to_fire(i) = value_patch - !this%m_frootn_to_fire(i) = value_patch - !this%m_frootn_storage_to_fire(i) = value_patch - !this%m_frootn_xfer_to_fire(i) = value_patch - !this%m_livecrootn_to_fire(i) = value_patch - !this%m_livecrootn_storage_to_fire(i) = value_patch - !this%m_livecrootn_xfer_to_fire(i) = value_patch - !this%m_deadcrootn_to_fire(i) = value_patch - !this%m_deadcrootn_storage_to_fire(i) = value_patch - !this%m_deadcrootn_xfer_to_fire(i) = value_patch - !this%m_retransn_to_fire(i) = value_patch - !this%m_npool_to_fire(i) = value_patch - - !this%m_leafn_to_litter_fire(i) = value_patch - !this%m_leafn_storage_to_litter_fire(i) = value_patch - !this%m_leafn_xfer_to_litter_fire(i) = value_patch - !this%m_livestemn_to_litter_fire(i) = value_patch - !this%m_livestemn_storage_to_litter_fire(i) = value_patch - !this%m_livestemn_xfer_to_litter_fire(i) = value_patch - !this%m_livestemn_to_deadstemn_fire(i) = value_patch - !this%m_deadstemn_to_litter_fire(i) = value_patch - !this%m_deadstemn_storage_to_litter_fire(i) = value_patch - !this%m_deadstemn_xfer_to_litter_fire(i) = value_patch - !this%m_frootn_to_litter_fire(i) = value_patch - !this%m_frootn_storage_to_litter_fire(i) = value_patch - !this%m_frootn_xfer_to_litter_fire(i) = value_patch - !this%m_livecrootn_to_litter_fire(i) = value_patch - !this%m_livecrootn_storage_to_litter_fire(i) = value_patch - !this%m_livecrootn_xfer_to_litter_fire(i) = value_patch - !this%m_livecrootn_to_deadcrootn_fire(i) = value_patch - !this%m_deadcrootn_to_litter_fire(i) = value_patch - !this%m_deadcrootn_storage_to_litter_fire(i) = value_patch - !this%m_deadcrootn_xfer_to_litter_fire(i) = value_patch - !this%m_retransn_to_litter_fire(i) = value_patch - !this%m_npool_to_litter_fire(i) = value_patch this%leafn_xfer_to_leafn(i) = value_patch this%frootn_xfer_to_frootn(i) = value_patch @@ -10792,26 +10649,6 @@ subroutine veg_pf_setvalues ( this, num_patch, filter_patch, value_patch) do fi = 1,num_patch i=filter_patch(fi) - !this%m_leafp_to_litter(i) = value_patch - !this%m_frootp_to_litter(i) = value_patch - !this%m_leafp_storage_to_litter(i) = value_patch - !this%m_frootp_storage_to_litter(i) = value_patch - !this%m_livestemp_storage_to_litter(i) = value_patch - !this%m_deadstemp_storage_to_litter(i) = value_patch - !this%m_livecrootp_storage_to_litter(i) = value_patch - !this%m_deadcrootp_storage_to_litter(i) = value_patch - !this%m_leafp_xfer_to_litter(i) = value_patch - !this%m_frootp_xfer_to_litter(i) = value_patch - !this%m_livestemp_xfer_to_litter(i) = value_patch - !this%m_deadstemp_xfer_to_litter(i) = value_patch - !this%m_livecrootp_xfer_to_litter(i) = value_patch - !this%m_deadcrootp_xfer_to_litter(i) = value_patch - !this%m_livestemp_to_litter(i) = value_patch - !this%m_deadstemp_to_litter(i) = value_patch - !this%m_livecrootp_to_litter(i) = value_patch - !this%m_deadcrootp_to_litter(i) = value_patch - !this%m_retransp_to_litter(i) = value_patch - !this%m_ppool_to_litter(i) = value_patch this%hrv_leafp_to_litter(i) = value_patch this%hrv_frootp_to_litter(i) = value_patch this%hrv_leafp_storage_to_litter(i) = value_patch @@ -10838,50 +10675,6 @@ subroutine veg_pf_setvalues ( this, num_patch, filter_patch, value_patch) this%hrv_retransp_to_litter(i) = value_patch this%hrv_ppool_to_litter(i) = value_patch - ! this%m_leafp_to_fire(i) = value_patch - ! this%m_leafp_storage_to_fire(i) = value_patch - ! this%m_leafp_xfer_to_fire(i) = value_patch - ! this%m_livestemp_to_fire(i) = value_patch - ! this%m_livestemp_storage_to_fire(i) = value_patch - ! this%m_livestemp_xfer_to_fire(i) = value_patch - ! this%m_deadstemp_to_fire(i) = value_patch - ! this%m_deadstemp_storage_to_fire(i) = value_patch - ! this%m_deadstemp_xfer_to_fire(i) = value_patch - ! this%m_frootp_to_fire(i) = value_patch - ! this%m_frootp_storage_to_fire(i) = value_patch - ! this%m_frootp_xfer_to_fire(i) = value_patch - ! this%m_livecrootp_to_fire(i) = value_patch - ! this%m_livecrootp_storage_to_fire(i) = value_patch - ! this%m_livecrootp_xfer_to_fire(i) = value_patch - ! this%m_deadcrootp_to_fire(i) = value_patch - ! this%m_deadcrootp_storage_to_fire(i) = value_patch - ! this%m_deadcrootp_xfer_to_fire(i) = value_patch - ! this%m_retransp_to_fire(i) = value_patch - ! this%m_ppool_to_fire(i) = value_patch - - ! this%m_leafp_to_litter_fire(i) = value_patch - ! this%m_leafp_storage_to_litter_fire(i) = value_patch - ! this%m_leafp_xfer_to_litter_fire(i) = value_patch - ! this%m_livestemp_to_litter_fire(i) = value_patch - ! this%m_livestemp_storage_to_litter_fire(i) = value_patch - ! this%m_livestemp_xfer_to_litter_fire(i) = value_patch - ! this%m_livestemp_to_deadstemp_fire(i) = value_patch - ! this%m_deadstemp_to_litter_fire(i) = value_patch - ! this%m_deadstemp_storage_to_litter_fire(i) = value_patch - ! this%m_deadstemp_xfer_to_litter_fire(i) = value_patch - ! this%m_frootp_to_litter_fire(i) = value_patch - ! this%m_frootp_storage_to_litter_fire(i) = value_patch - ! this%m_frootp_xfer_to_litter_fire(i) = value_patch - ! this%m_livecrootp_to_litter_fire(i) = value_patch - ! this%m_livecrootp_storage_to_litter_fire(i) = value_patch - ! this%m_livecrootp_xfer_to_litter_fire(i) = value_patch - ! this%m_livecrootp_to_deadcrootp_fire(i) = value_patch - ! this%m_deadcrootp_to_litter_fire(i) = value_patch - ! this%m_deadcrootp_storage_to_litter_fire(i) = value_patch - ! this%m_deadcrootp_xfer_to_litter_fire(i) = value_patch - ! this%m_retransp_to_litter_fire(i) = value_patch - ! this%m_ppool_to_litter_fire(i) = value_patch - this%leafp_xfer_to_leafp(i) = value_patch this%frootp_xfer_to_frootp(i) = value_patch this%livestemp_xfer_to_livestemp(i) = value_patch From 61edeb5e6619b6dca777383735d109ea3ab357c3 Mon Sep 17 00:00:00 2001 From: Peter Schwartz Date: Fri, 3 Nov 2023 17:03:14 -0500 Subject: [PATCH 3/6] Reverted my change assigning nstep to a known value as that causes a land test to fail. --- components/elm/src/biogeochem/EcosystemBalanceCheckMod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/elm/src/biogeochem/EcosystemBalanceCheckMod.F90 b/components/elm/src/biogeochem/EcosystemBalanceCheckMod.F90 index b9adb1a94688..53bac44a63ce 100644 --- a/components/elm/src/biogeochem/EcosystemBalanceCheckMod.F90 +++ b/components/elm/src/biogeochem/EcosystemBalanceCheckMod.F90 @@ -574,7 +574,7 @@ subroutine ColPBalanceCheck(bounds, & integer:: kmo ! month of year (1, ..., 12) integer:: kda ! day of month (1, ..., 31) integer:: mcsec ! seconds of day (0, ..., seconds/day) - integer :: nstep + integer :: nstep !----------------------------------------------------------------------- associate( & @@ -618,7 +618,7 @@ subroutine ColPBalanceCheck(bounds, & ! set time steps dt = dtime_mod kyr = year_curr; kmo = mon_curr; kda = day_curr; mcsec = secs_curr; - nstep = get_nstep() + err_found = .false. if(.not.use_fates)then @@ -733,7 +733,7 @@ subroutine ColPBalanceCheck(bounds, & end do ! end of columns loop - if (err_found .and. nstep_mod>1) then + if (err_found .and. nstep>1) then #ifndef _OPENACC c = err_index write(iulog,*)'column pbalance error = ', col_errpb(c), c From 61fede13b57f778f6ee9605608e3a7f202643d1d Mon Sep 17 00:00:00 2001 From: Peter Schwartz Date: Mon, 6 Nov 2023 17:28:41 -0600 Subject: [PATCH 4/6] Cleaned up commented out lines. --- .../elm/src/data_types/ColumnDataType.F90 | 66 ------------------- .../elm/src/data_types/VegetationDataType.F90 | 1 - 2 files changed, 67 deletions(-) diff --git a/components/elm/src/data_types/ColumnDataType.F90 b/components/elm/src/data_types/ColumnDataType.F90 index 286674e7c895..73f2baf6c5bc 100644 --- a/components/elm/src/data_types/ColumnDataType.F90 +++ b/components/elm/src/data_types/ColumnDataType.F90 @@ -7368,7 +7368,6 @@ subroutine col_cf_setvalues ( this, num_column, filter_column, value_column) do j = 1, nlevdecomp_full do fi = 1,num_column i = filter_column(fi) - ! only initializing in the first time-step this%externalc_to_decomp_cpools(i,j,k) = value_column end do end do @@ -7376,7 +7375,6 @@ subroutine col_cf_setvalues ( this, num_column, filter_column, value_column) do fi = 1,num_column i = filter_column(fi) this%f_co2_soil(i) = value_column - ! only initializing in the first time-step this%externalc_to_decomp_delta(i) = value_column end do end if @@ -7384,14 +7382,8 @@ subroutine col_cf_setvalues ( this, num_column, filter_column, value_column) do k = 1, ndecomp_pools do fi = 1,num_column i = filter_column(fi) - !this%decomp_cpools_leached(i,k) = value_column - !this%decomp_cpools_erode(i,k) = value_column - !this%decomp_cpools_deposit(i,k) = value_column this%decomp_cpools_yield(i,k) = value_column !if ero_ccycle this%m_decomp_cpools_to_fire(i,k) = value_column - !NOTE: Can't see where these are used. pflotran maybe?? - !this%bgc_cpool_ext_inputs_vr(i,:, k) = value_column - !this%bgc_cpool_ext_loss_vr(i,:, k) = value_column end do end do @@ -7457,9 +7449,7 @@ subroutine col_cf_setvalues ( this, num_column, filter_column, value_column) do j = 1, nlevdecomp_full do fi = 1,num_column i = filter_column(fi) - ! this%m_decomp_cpools_to_fire_vr(i,j,k) = value_column this%decomp_cpools_transport_tendency(i,j,k) = value_column - ! this%decomp_cpools_yield_vr(i,j,k) = value_column end do end do end do @@ -8805,44 +8795,6 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) this%harvest_n_to_litr_lig_n(i,j) = value_column this%harvest_n_to_cwdn(i,j) = value_column - !this%smin_no3_leached_vr(i,j) = value_column - !this%smin_no3_runoff_vr(i,j) = value_column - !this%n2_n2o_ratio_denit_vr(i,j) = value_column - !this%pot_f_nit_vr(i,j) = value_column - !this%pot_f_denit_vr(i,j) = value_column - !this%actual_immob_no3_vr(i,j) = value_column - !this%actual_immob_nh4_vr(i,j) = value_column - !this%smin_no3_to_plant_vr(i,j) = value_column - !this%smin_nh4_to_plant_vr(i,j) = value_column - !this%f_n2o_denit_vr(i,j) = value_column - !this%f_n2o_nit_vr(i,j) = value_column - - !this%smin_no3_massdens_vr(i,j) = value_column - !this%k_nitr_t_vr(i,j) = value_column - !this%k_nitr_ph_vr(i,j) = value_column - !this%k_nitr_h2o_vr(i,j) = value_column - !this%k_nitr_vr(i,j) = value_column - !this%wfps_vr(i,j) = value_column - !this%fmax_denit_carbonsubstrate_vr(i,j) = value_column - !this%fmax_denit_nitrate_vr(i,j) = value_column - !this%f_denit_base_vr(i,j) = value_column - - !this%diffus(i,j) = value_column - !this%ratio_k1(i,j) = value_column - !this%ratio_no3_co2(i,j) = value_column - !this%soil_co2_prod(i,j) = value_column - !this%fr_WFPS(i,j) = value_column - !this%soil_bulkdensity(i,j) = value_column - - !this%r_psi(i,j) = value_column - !this%anaerobic_frac(i,j) = value_column - - - !this%potential_immob_vr(i,j) = value_column - !this%actual_immob_vr(i,j) = value_column - !this%sminn_to_plant_vr(i,j) = value_column - !this%supplement_to_sminn_vr(i,j) = value_column - !this%gross_nmin_vr(i,j) = value_column this%net_nmin_vr(i,j) = value_column this%sminn_nh4_input_vr(i,j) = value_column !not used anywhere? this%sminn_no3_input_vr(i,j) = value_column !not used anywhere? @@ -8914,9 +8866,6 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) this%sminn_input(i) = value_column this%sminn_nh4_input(i) = value_column this%sminn_no3_input(i) = value_column - !this%somn_erode(i) = value_column - !this%somn_deposit(i) = value_column - !this%somn_yield(i) = value_column ! Zero p2c column fluxes this%fire_nloss(i) = value_column this%wood_harvestn(i) = value_column @@ -8927,9 +8876,6 @@ subroutine col_nf_setvalues ( this, num_column, filter_column, value_column) do k = 1, ndecomp_pools do fi = 1,num_column i = filter_column(fi) - !this%decomp_npools_leached(i,k) = value_column - !this%decomp_npools_erode(i,k) = value_column - !this%decomp_npools_deposit(i,k) = value_column this%decomp_npools_yield(i,k) = value_column !ero_ccyle this%m_decomp_npools_to_fire(i,k) = value_column !NOTE: when are these used? @@ -10509,16 +10455,6 @@ subroutine col_pf_setvalues ( this, num_column, filter_column, value_column) end do end do - ! do l = 1, ndecomp_cascade_transitions - ! do j = 1, nlevdecomp_full - ! do fi = 1,num_column - ! i = filter_column(fi) - ! this%decomp_cascade_ptransfer_vr(i,j,l) = value_column - ! this%decomp_cascade_sminp_flux_vr(i,j,l) = value_column - ! end do - ! end do - ! end do - ! pflotran if(nstep_mod == 0 .or. is_first_restart_step() ) then do k = 1, ndecomp_pools @@ -10533,14 +10469,12 @@ subroutine col_pf_setvalues ( this, num_column, filter_column, value_column) do j = 1, nlevdecomp_full do fi = 1,num_column i = filter_column(fi) - ! only initializing in the first time-step this%sminp_net_transport_vr(i,j) = value_column end do end do do fi = 1,num_column i = filter_column(fi) - ! only initializing in the first time-step this%externalp_to_decomp_delta(i) = value_column this%sminp_net_transport_delta(i) = value_column end do diff --git a/components/elm/src/data_types/VegetationDataType.F90 b/components/elm/src/data_types/VegetationDataType.F90 index 775103ea411c..ee3247b1dad1 100644 --- a/components/elm/src/data_types/VegetationDataType.F90 +++ b/components/elm/src/data_types/VegetationDataType.F90 @@ -8619,7 +8619,6 @@ subroutine veg_cf_setvalues ( this, num_patch, filter_patch, value_patch) do fi = 1,num_patch i = filter_patch(fi) - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! this%leafc_xfer_to_leafc(i) = value_patch this%frootc_xfer_to_frootc(i) = value_patch this%livestemc_xfer_to_livestemc(i) = value_patch From 7886cd23be06c0e2496b0df9f23795fdcdf0792e Mon Sep 17 00:00:00 2001 From: Peter Schwartz Date: Mon, 6 Nov 2023 17:33:01 -0600 Subject: [PATCH 5/6] cleaned up debugging code segments --- .../elm/src/data_types/VegetationDataType.F90 | 53 +++++++------------ 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/components/elm/src/data_types/VegetationDataType.F90 b/components/elm/src/data_types/VegetationDataType.F90 index ee3247b1dad1..a2214d992cfc 100644 --- a/components/elm/src/data_types/VegetationDataType.F90 +++ b/components/elm/src/data_types/VegetationDataType.F90 @@ -3591,18 +3591,7 @@ subroutine veg_cs_summary(this, bounds, num_soilc, filter_soilc, num_soilp, filt this%totvegc(p) + & this%xsmrpool(p) + & this%ctrunc(p) - if(abs(this%totpftc(p)) >= 1.e+20) then - print *, "p:",p - print *, "totvegc",this%totvegc(p) - print *, "dispvegc:",this%dispvegc(p) - print *, "grainc :", this%grainc(p) - print *, "leafc:",this%leafc(p) - print *, "frootc:",this%frootc(p) - print *, "livestemc:",this%livestemc(p) - print *, "deadstemc:",this%deadstemc(p) - print *, "livecrootc:",this%livecrootc(p) - print *, "deadcrootc:",this%deadcrootc(p) - end if + ! (WOODC) - wood C this%woodc(p) = & this%deadstemc(p) + & @@ -8296,7 +8285,6 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%m_gresp_storage_to_litter_fire(p) + & this%m_gresp_xfer_to_litter_fire(p) - !if(get_do_harvest()) then this%litfall(p) = this%litfall(p) + & this%hrv_leafc_to_litter(p) + & this%hrv_leafc_storage_to_litter(p) + & @@ -8318,16 +8306,15 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%hrv_gresp_storage_to_litter(p) + & this%hrv_gresp_xfer_to_litter(p) + & this%hrv_cpool_to_litter(p) - ! end if + ! patch-level fire losses (VEGFIRE) this%vegfire(p) = 0._r8 ! patch-level wood harvest - ! if(use_crop) then this%wood_harvestc(p) = & this%hrv_deadstemc_to_prod10c(p) + & this%hrv_deadstemc_to_prod100c(p) - !endif + if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then this%wood_harvestc(p) = & this%wood_harvestc(p) + & @@ -8394,10 +8381,8 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%m_leafc_to_litter_fire(p) + & this%leafc_to_litter(p) - !if(use_crop) then - this%leafc_loss(p) = this%leafc_loss(p) + & + this%leafc_loss(p) = this%leafc_loss(p) + & this%hrv_leafc_to_litter(p) - !end if if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then this%leafc_loss(p) = & @@ -8428,22 +8413,20 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%m_livecrootc_to_fire(p) + & this%m_deadcrootc_to_fire(p) - ! if(use_crop) then - this%woodc_loss(p) = this%woodc_loss(p) + & - this%hrv_livestemc_to_litter(p) + & - this%hrv_livestemc_storage_to_litter(p) + & - this%hrv_livestemc_xfer_to_litter(p) + & - this%hrv_deadstemc_to_prod10c(p) + & - this%hrv_deadstemc_to_prod100c(p) + & - this%hrv_deadstemc_storage_to_litter(p) + & - this%hrv_deadstemc_xfer_to_litter(p) + & - this%hrv_livecrootc_to_litter(p) + & - this%hrv_livecrootc_storage_to_litter(p) + & - this%hrv_livecrootc_xfer_to_litter(p) + & - this%hrv_deadcrootc_to_litter(p) + & - this%hrv_deadcrootc_storage_to_litter(p) + & - this%hrv_deadcrootc_xfer_to_litter(p) - !end if + this%woodc_loss(p) = this%woodc_loss(p) + & + this%hrv_livestemc_to_litter(p) + & + this%hrv_livestemc_storage_to_litter(p) + & + this%hrv_livestemc_xfer_to_litter(p) + & + this%hrv_deadstemc_to_prod10c(p) + & + this%hrv_deadstemc_to_prod100c(p) + & + this%hrv_deadstemc_storage_to_litter(p) + & + this%hrv_deadstemc_xfer_to_litter(p) + & + this%hrv_livecrootc_to_litter(p) + & + this%hrv_livecrootc_storage_to_litter(p) + & + this%hrv_livecrootc_xfer_to_litter(p) + & + this%hrv_deadcrootc_to_litter(p) + & + this%hrv_deadcrootc_storage_to_litter(p) + & + this%hrv_deadcrootc_xfer_to_litter(p) ! putting the harvested crop stem and grain in the wood loss bdrewniak if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then this%woodc_loss(p) = & From 772a5de2c7e34e0509632eb746745710ea8f896d Mon Sep 17 00:00:00 2001 From: Peter Schwartz Date: Thu, 4 Jan 2024 17:32:02 -0600 Subject: [PATCH 6/6] Removed code that had been commented out. --- components/elm/src/data_types/ColumnDataType.F90 | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/components/elm/src/data_types/ColumnDataType.F90 b/components/elm/src/data_types/ColumnDataType.F90 index 73f2baf6c5bc..5971d4aa6af5 100644 --- a/components/elm/src/data_types/ColumnDataType.F90 +++ b/components/elm/src/data_types/ColumnDataType.F90 @@ -9002,7 +9002,7 @@ subroutine col_nf_zero_forfates_veg(this, bounds, num_soilc, filter_soilc) integer , intent(in) :: filter_soilc(:) ! filter for soil columns ! locals integer :: fc - integer :: c,k,j + integer :: c if(.not.use_fates) return @@ -9013,15 +9013,6 @@ subroutine col_nf_zero_forfates_veg(this, bounds, num_soilc, filter_soilc) end do - !do k = 1, ndecomp_pools - ! do j = 1, nlevdecomp_full - ! do fc = 1,num_soilc - ! c = filter_soilc(fc) - ! this%m_decomp_npools_to_fire_vr(c,j,k) = 0._r8 - ! enddo - ! end do - !end do - end subroutine col_nf_zero_forfates_veg