From e345c390332e8178a0fb814305abc3a656273f4e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 18 Sep 2020 04:24:29 -0600 Subject: [PATCH] Call routine to calc fire's btran2 from CNFireArea MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This has a few advantages: - It makes the logic of CNFireArea more clear (rather than depending on a btran2 variable that is calculated from some other part of the code) - This avoids having the biogeophysics depend on the biogeochemistry - This lets us avoid doing this btran calc if using no-fire – or other, future, fire methods that don't need it The placement in the driver loop differs from before; in order to get bit-for-bit results, we need to save h2osoi_vol and used that saved version from earlier in the driver loop; in a follow-up, answer-changing step, I plan to change this. --- src/biogeochem/CNDriverMod.F90 | 12 +++++- src/biogeochem/CNFireBaseMod.F90 | 46 ++--------------------- src/biogeochem/CNFireLi2014Mod.F90 | 24 +++++++++--- src/biogeochem/CNFireLi2016Mod.F90 | 24 +++++++++--- src/biogeochem/CNFireNoFireMod.F90 | 18 +++++++-- src/biogeochem/CNVegetationFacade.F90 | 15 ++++++-- src/biogeophys/CanopyFluxesMod.F90 | 8 +--- src/biogeophys/HydrologyNoDrainageMod.F90 | 8 ++++ src/biogeophys/SoilMoistStressMod.F90 | 23 ++---------- src/biogeophys/WaterStateBulkType.F90 | 3 +- src/main/FireMethodType.F90 | 21 ++++++++--- src/main/clm_driver.F90 | 10 +++-- 12 files changed, 114 insertions(+), 98 deletions(-) diff --git a/src/biogeochem/CNDriverMod.F90 b/src/biogeochem/CNDriverMod.F90 index f9f4b4532c..a439cee207 100644 --- a/src/biogeochem/CNDriverMod.F90 +++ b/src/biogeochem/CNDriverMod.F90 @@ -40,6 +40,7 @@ module CNDriverMod use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type use ActiveLayerMod , only : active_layer_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type ! ! !PUBLIC TYPES: implicit none @@ -80,7 +81,8 @@ end subroutine CNDriverInit !----------------------------------------------------------------------- subroutine CNDriverNoLeaching(bounds, & - num_soilc, filter_soilc, num_soilp, filter_soilp, num_pcropp, filter_pcropp, doalb, & + num_soilc, filter_soilc, num_soilp, filter_soilp, num_pcropp, filter_pcropp, & + num_exposedvegp, filter_exposedvegp, doalb, & cnveg_state_inst, & cnveg_carbonflux_inst, cnveg_carbonstate_inst, & c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & @@ -94,7 +96,8 @@ subroutine CNDriverNoLeaching(bounds, soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & active_layer_inst, & atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & - wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & + wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, & + soil_water_retention_curve, crop_inst, ch4_inst, & dgvs_inst, photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & nutrient_competition_method, cnfire_method, dribble_crophrv_xsmrpool_2atm) ! @@ -146,6 +149,8 @@ subroutine CNDriverNoLeaching(bounds, integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg logical , intent(in) :: doalb ! true = surface albedo calculation time step type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst @@ -178,6 +183,7 @@ subroutine CNDriverNoLeaching(bounds, type(canopystate_type) , intent(inout) :: canopystate_inst type(soilstate_type) , intent(inout) :: soilstate_inst type(temperature_type) , intent(inout) :: temperature_inst + class(soil_water_retention_curve_type) , intent(in) :: soil_water_retention_curve type(crop_type) , intent(inout) :: crop_inst type(ch4_type) , intent(in) :: ch4_inst type(dgvs_type) , intent(inout) :: dgvs_inst @@ -747,7 +753,9 @@ subroutine CNDriverNoLeaching(bounds, call t_startf('CNFire') call cnfire_method%CNFireArea(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, & totlitc_col=soilbiogeochem_carbonstate_inst%totlitc_col(begc:endc), & decomp_cpools_vr_col=soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools), & diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index cc9d51242b..00fecb9943 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -84,7 +84,6 @@ module CNFireBaseMod procedure, public :: FireReadNML ! Read in namelist for CNFire procedure, public :: CNFireRestart ! Restart for CNFire procedure, public :: CNFireReadParams ! Read in constant parameters from the paramsfile - procedure, public :: CNFireArea ! Calculate fire area procedure, public :: CNFireFluxes ! Calculate fire fluxes procedure, public :: CNFire_calc_fire_root_wetness ! Calcualte CN-fire specific root wetness ! @@ -168,19 +167,19 @@ subroutine CNFireRestart( this, bounds, ncid, flag ) end subroutine CNFireRestart !---------------------------------------------------------------------- - subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedvegp, filter_exposedvegp, & + subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) ! ! Calculate the root wetness term that will be used by the fire model ! use pftconMod , only : pftcon + use clm_varpar , only : nlevgrnd use PatchType , only : patch use WaterStateBulkType , only : waterstatebulk_type use SoilStateType , only : soilstate_type use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type class(cnfire_base_type) :: this type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: nlevgrnd !number of vertical layers integer , intent(in) :: num_exposedvegp !number of filters integer , intent(in) :: filter_exposedvegp(:) !filter array type(waterstatebulk_type), intent(in) :: waterstatebulk_inst @@ -201,13 +200,10 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedveg watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation btran2 => this%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer - h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) + ! FIXME(wjs, 2020-09-18) change this to use h2osoi_vol_col instead of the prehydrology version + h2osoi_vol => waterstatebulk_inst%h2osoi_vol_prehydrology_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) - SHR_ASSERT_ALL_FL((ubound(watsat) == (/bounds%endc,nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(h2osoi_vol) == (/bounds%endc,nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(rootfr) == (/bounds%endp,nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(btran2) == (/bounds%endp/)), sourcefile, __LINE__) do f = 1, num_exposedvegp p = filter_exposedvegp(f) btran2(p) = btran0 @@ -338,40 +334,6 @@ subroutine FireReadNML( this, NLFilename ) end subroutine FireReadNML - !----------------------------------------------------------------------- - subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & - waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) - ! - ! !DESCRIPTION: - ! Computes column-level burned area - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - real(r8) , intent(in) :: totlitc_col(bounds%begc:) - real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) - real(r8) , intent(in) :: t_soi17cm_col(bounds%begc:) - ! - - call endrun( 'cnfire_base::CNFireArea: this method MUST be implemented!' ) - - end subroutine CNFireArea - !----------------------------------------------------------------------- subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & dgvs_inst, cnveg_state_inst, & diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index 5c87e75d1c..3ff8916df7 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -34,8 +34,11 @@ module CNFireLi2014Mod use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use GridcellType , only : grc use ColumnType , only : col use PatchType , only : patch @@ -79,8 +82,10 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & - wateratm2lndbulk_inst, cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) + wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & + cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: ! Computes column-level burned area @@ -100,11 +105,16 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst real(r8) , intent(in) :: totlitc_col(bounds%begc:) @@ -322,6 +332,10 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ dtrotr_col(c)=0._r8 end if end do + + call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) + do pi = 1,max_patch_per_col do fc = 1,num_soilc c = filter_soilc(fc) diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index a95fd712fd..5b1457afc6 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -34,8 +34,11 @@ module CNFireLi2016Mod use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use GridcellType , only : grc use ColumnType , only : col use PatchType , only : patch @@ -83,8 +86,10 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & - wateratm2lndbulk_inst, cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) + wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & + cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: ! Computes column-level burned area @@ -105,11 +110,16 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst real(r8) , intent(in) :: totlitc_col(bounds%begc:) @@ -343,6 +353,10 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ dtrotr_col(c)=0._r8 end if end do + + call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) + do pi = 1,max_patch_per_col do fc = 1,num_soilc c = filter_soilc(fc) diff --git a/src/biogeochem/CNFireNoFireMod.F90 b/src/biogeochem/CNFireNoFireMod.F90 index 025d45cbd8..69411b19eb 100644 --- a/src/biogeochem/CNFireNoFireMod.F90 +++ b/src/biogeochem/CNFireNoFireMod.F90 @@ -17,8 +17,11 @@ module CNFireNoFireMod use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use FireMethodType , only : fire_method_type use CNFireBaseMod , only : cnfire_base_type ! @@ -55,8 +58,10 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: @@ -72,11 +77,16 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst real(r8) , intent(in) :: totlitc_col(bounds%begc:) diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 196817b3cc..d200d6aa23 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -94,6 +94,7 @@ module CNVegetationFacade use dynCNDVMod , only : dynCNDV_init, dynCNDV_interp use CNPrecisionControlMod , only: CNPrecisionControl use SoilBiogeochemPrecisionControlMod , only: SoilBiogeochemPrecisionControl + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type ! implicit none private @@ -875,6 +876,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & num_soilc, filter_soilc, & num_soilp, filter_soilp, & num_pcropp, filter_pcropp, & + num_exposedvegp, filter_exposedvegp, & doalb, & soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & @@ -883,7 +885,8 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & active_layer_inst, & atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & - wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & + wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, & + soil_water_retention_curve, crop_inst, ch4_inst, & photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & nutrient_competition_method, fireemis_inst) ! @@ -904,6 +907,8 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg logical , intent(in) :: doalb ! true = surface albedo calculation time step type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst @@ -923,6 +928,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & type(canopystate_type) , intent(inout) :: canopystate_inst type(soilstate_type) , intent(inout) :: soilstate_inst type(temperature_type) , intent(inout) :: temperature_inst + class(soil_water_retention_curve_type) , intent(in) :: soil_water_retention_curve type(crop_type) , intent(inout) :: crop_inst type(ch4_type) , intent(in) :: ch4_inst type(photosyns_type) , intent(in) :: photosyns_inst @@ -941,7 +947,9 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & call CNDriverNoLeaching(bounds, & num_soilc, filter_soilc, & num_soilp, filter_soilp, & - num_pcropp, filter_pcropp, doalb, & + num_pcropp, filter_pcropp, & + num_exposedvegp, filter_exposedvegp, & + doalb, & this%cnveg_state_inst, & this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, & this%c13_cnveg_carbonflux_inst, this%c13_cnveg_carbonstate_inst, & @@ -956,7 +964,8 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & active_layer_inst, & atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & - wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & + wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, & + soil_water_retention_curve, crop_inst, ch4_inst, & this%dgvs_inst, photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & nutrient_competition_method, this%cnfire_method, this%dribble_crophrv_xsmrpool_2atm) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 492108d8b3..aeae396733 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -190,8 +190,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, waterdiagnosticbulk_inst, wateratm2lndbulk_inst, ch4_inst, ozone_inst, & photosyns_inst, & humanindex_inst, soil_water_retention_curve, & - downreg_patch, leafn_patch, froot_carbon, croot_carbon, & - bgc_vegetation_inst) + downreg_patch, leafn_patch, froot_carbon, croot_carbon) ! ! !DESCRIPTION: ! 1. Calculates the leaf temperature: @@ -234,7 +233,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, swbgt, hmdex, dis_coi, dis_coiS, THIndex, & SwampCoolEff, KtoC, VaporPres use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use CNVegetationFacade , only : cn_vegetation_type ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -264,7 +262,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8), intent(in) :: leafn_patch(bounds%begp:) ! leaf N (gN/m2) real(r8), intent(inout) :: froot_carbon(bounds%begp:) ! fine root biomass (gC/m2) real(r8), intent(inout) :: croot_carbon(bounds%begp:) ! live coarse root biomass (gC/m2) - type(cn_vegetation_type) , intent(inout) :: bgc_vegetation_inst ! ! !LOCAL VARIABLES: real(r8), pointer :: bsun(:) ! sunlit canopy transpiration wetness factor (0 to 1) @@ -707,8 +704,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, temperature_inst=temperature_inst, & waterstatebulk_inst=waterstatebulk_inst, & waterdiagnosticbulk_inst=waterdiagnosticbulk_inst, & - soil_water_retention_curve=soil_water_retention_curve, & - bgc_vegetation_inst=bgc_vegetation_inst) + soil_water_retention_curve=soil_water_retention_curve) end if diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 index 2596f7e5b0..6c2bcee4eb 100644 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/biogeophys/HydrologyNoDrainageMod.F90 @@ -251,6 +251,7 @@ subroutine HydrologyNoDrainage(bounds, & h2osoi_ice_tot => b_waterdiagnostic_inst%h2osoi_ice_tot_col , & ! Output: [real(r8) (:) ] vertically summed ice lens (kg/m2) h2osoi_liq_tot => b_waterdiagnostic_inst%h2osoi_liq_tot_col , & ! Output: [real(r8) (:) ] vertically summed liquid water (kg/m2) h2osoi_vol => b_waterstate_inst%h2osoi_vol_col , & ! Output: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] + h2osoi_vol_prehydrology => b_waterstate_inst%h2osoi_vol_prehydrology_col , & ! Output: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) saved before hydrology [m3/m3] h2osno_top => b_waterdiagnostic_inst%h2osno_top_col , & ! Output: [real(r8) (:) ] mass of snow in top layer (col) [kg] wf => b_waterdiagnostic_inst%wf_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.05 m wf2 => b_waterdiagnostic_inst%wf2_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m @@ -272,6 +273,13 @@ subroutine HydrologyNoDrainage(bounds, & call water_inst%TracerConsistencyCheck(bounds, 'before main snow code in HydrologyNoDrainage') end if + do j = 1, nlevgrnd + do fc = 1, num_hydrologyc + c = filter_hydrologyc(fc) + h2osoi_vol_prehydrology(c,j) = h2osoi_vol(c,j) + end do + end do + ! Determine step size dtime = get_step_size_real() diff --git a/src/biogeophys/SoilMoistStressMod.F90 b/src/biogeophys/SoilMoistStressMod.F90 index 62f37635d3..8232b01811 100644 --- a/src/biogeophys/SoilMoistStressMod.F90 +++ b/src/biogeophys/SoilMoistStressMod.F90 @@ -312,8 +312,7 @@ end subroutine normalize_unfrozen_rootfr subroutine calc_root_moist_stress_clm45default(bounds, & nlevgrnd, fn, filterp, rootfr_unf, & temperature_inst, soilstate_inst, energyflux_inst, waterstatebulk_inst, & - waterdiagnosticbulk_inst, soil_water_retention_curve, & - bgc_vegetation_inst ) + waterdiagnosticbulk_inst, soil_water_retention_curve) ! ! DESCRIPTIONS ! compute the root water stress using the default clm45 approach @@ -331,8 +330,6 @@ subroutine calc_root_moist_stress_clm45default(bounds, & use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type use PatchType , only : patch use clm_varctl , only : iulog, use_hydrstress - use CNVegetationFacade , only : cn_vegetation_type - use clm_varctl , only : use_cn, use_fates ! ! !ARGUMENTS: implicit none @@ -347,7 +344,6 @@ subroutine calc_root_moist_stress_clm45default(bounds, & type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - type(cn_vegetation_type) , intent(inout) :: bgc_vegetation_inst ! ! !LOCAL VARIABLES: real(r8), parameter :: btran0 = 0.0_r8 ! initial value @@ -378,15 +374,6 @@ subroutine calc_root_moist_stress_clm45default(bounds, & h2osoi_liqvol => waterdiagnosticbulk_inst%h2osoi_liqvol_col & ! Output: [real(r8) (:,:) ] liquid volumetric moisture, will be used for BeTR ) - ! - ! Root zone wetness only used by the CN Li Fire model - ! - if ( use_cn .and. .not. use_fates )then - call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds, nlevgrnd, & - fn, filterp, waterstatebulk_inst, soilstate_inst, & - soil_water_retention_curve ) - end if - do j = 1,nlevgrnd do f = 1, fn p = filterp(f) @@ -451,8 +438,7 @@ end subroutine calc_root_moist_stress_clm45default !-------------------------------------------------------------------------------- subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & active_layer_inst, energyflux_inst, soilstate_inst, temperature_inst, & - waterstatebulk_inst, waterdiagnosticbulk_inst, soil_water_retention_curve, & - bgc_vegetation_inst ) + waterstatebulk_inst, waterdiagnosticbulk_inst, soil_water_retention_curve) ! ! DESCRIPTIONS ! compute the root water stress using different approaches @@ -469,7 +455,6 @@ subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type use abortutils , only : endrun - use CNVegetationFacade , only : cn_vegetation_type ! ! !ARGUMENTS: implicit none @@ -484,7 +469,6 @@ subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - type(cn_vegetation_type) , intent(inout) :: bgc_vegetation_inst ! ! !LOCAL VARIABLES: integer :: p, f, j, c, l ! indices @@ -522,8 +506,7 @@ subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & waterstatebulk_inst=waterstatebulk_inst, & waterdiagnosticbulk_inst=waterdiagnosticbulk_inst, & rootfr_unf=rootfr_unf(bounds%begp:bounds%endp,1:nlevgrnd), & - soil_water_retention_curve=soil_water_retention_curve, & - bgc_vegetation_inst=bgc_vegetation_inst ) + soil_water_retention_curve=soil_water_retention_curve) case default call endrun(subname // ':: a root moisture stress function must be specified!') diff --git a/src/biogeophys/WaterStateBulkType.F90 b/src/biogeophys/WaterStateBulkType.F90 index 02a3579b80..402486bd2f 100644 --- a/src/biogeophys/WaterStateBulkType.F90 +++ b/src/biogeophys/WaterStateBulkType.F90 @@ -27,6 +27,7 @@ module WaterStateBulkType real(r8), pointer :: snow_persistence_col (:) ! col length of time that ground has had non-zero snow thickness (sec) real(r8), pointer :: int_snow_col (:) ! col integrated snowfall (mm H2O) + real(r8), pointer :: h2osoi_vol_prehydrology_col (:,:) ! col volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) - saved pre-hydrology contains @@ -104,7 +105,7 @@ subroutine InitBulkAllocate(this, bounds) allocate(this%snow_persistence_col (begc:endc)) ; this%snow_persistence_col (:) = nan allocate(this%int_snow_col (begc:endc)) ; this%int_snow_col (:) = nan - + allocate(this%h2osoi_vol_prehydrology_col(begc:endc, 1:nlevgrnd)); this%h2osoi_vol_prehydrology_col(:,:) = nan end subroutine InitBulkAllocate diff --git a/src/main/FireMethodType.F90 b/src/main/FireMethodType.F90 index eea2ddce69..d199d662fa 100644 --- a/src/main/FireMethodType.F90 +++ b/src/main/FireMethodType.F90 @@ -139,8 +139,10 @@ end subroutine CNFireRestart_interface !----------------------------------------------------------------------- subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: @@ -152,8 +154,11 @@ subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soil use atm2lndType , only : atm2lnd_type use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use CNVegStateType , only : cnveg_state_type use CNVegCarbonStateType , only : cnveg_carbonstate_type import :: fire_method_type @@ -165,11 +170,16 @@ subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soil integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst real(r8) , intent(in) :: totlitc_col(bounds%begc:) @@ -233,7 +243,7 @@ end subroutine CNFireFluxes_interface !----------------------------------------------------------------------- !---------------------------------------------------------------------- - subroutine CNFire_calc_fire_root_wetness_interface( this, bounds, nlevgrnd, num_exposedvegp, & + subroutine CNFire_calc_fire_root_wetness_interface( this, bounds, num_exposedvegp, & filter_exposedvegp, waterstatebulk_inst, & soilstate_inst, soil_water_retention_curve ) ! Calculate root wetness that will be used for the CN fire model @@ -244,7 +254,6 @@ subroutine CNFire_calc_fire_root_wetness_interface( this, bounds, nlevgrnd, num_ import :: fire_method_type class(fire_method_type) :: this type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: nlevgrnd !number of vertical layers integer , intent(in) :: num_exposedvegp !number of filters integer , intent(in) :: filter_exposedvegp(:) !filter array type(waterstatebulk_type), intent(in) :: waterstatebulk_inst diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 51647c105e..8e38910432 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -679,8 +679,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro downreg_patch = downreg_patch(bounds_clump%begp:bounds_clump%endp), & leafn_patch = leafn_patch(bounds_clump%begp:bounds_clump%endp), & froot_carbon = froot_carbon(bounds_clump%begp:bounds_clump%endp), & - croot_carbon = croot_carbon(bounds_clump%begp:bounds_clump%endp), & - bgc_vegetation_inst = bgc_vegetation_inst ) + croot_carbon = croot_carbon(bounds_clump%begp:bounds_clump%endp)) deallocate(downreg_patch, leafn_patch, froot_carbon, croot_carbon) call t_stopf('canflux') @@ -968,7 +967,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call bgc_vegetation_inst%EcosystemDynamicsPreDrainage(bounds_clump, & filter(nc)%num_soilc, filter(nc)%soilc, & filter(nc)%num_soilp, filter(nc)%soilp, & - filter(nc)%num_pcropp, filter(nc)%pcropp, doalb, & + filter(nc)%num_pcropp, filter(nc)%pcropp, & + filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, & + doalb, & soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & @@ -977,7 +978,8 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro active_layer_inst, & atm2lnd_inst, water_inst%waterstatebulk_inst, & water_inst%waterdiagnosticbulk_inst, water_inst%waterfluxbulk_inst, & - water_inst%wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & + water_inst%wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, & + soil_water_retention_curve, crop_inst, ch4_inst, & photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & nutrient_competition_method, fireemis_inst)