diff --git a/src/biogeochem/DryDepVelocity.F90 b/src/biogeochem/DryDepVelocity.F90 index 7646699ffa..dda6f8679f 100644 --- a/src/biogeochem/DryDepVelocity.F90 +++ b/src/biogeochem/DryDepVelocity.F90 @@ -103,9 +103,14 @@ Module DryDepVelocity !------------------------------------------------------------------------ subroutine Init(this, bounds) + use clm_varctl , only : use_fates, use_fates_sp class(drydepvel_type) :: this type(bounds_type), intent(in) :: bounds + if ( (.not. use_fates_sp) .and. (n_drydep > 0 .and. drydep_method == DD_XLND) )then + call endrun( msg='ERROR: Dry-deposition currently does NOT work with FATES outside of FATES-SP mode (see github issue #1044)'//& + errMsg(sourcefile, __LINE__)) + end if call this%InitAllocate(bounds) call this%InitHistory(bounds) diff --git a/src/biogeochem/VOCEmissionMod.F90 b/src/biogeochem/VOCEmissionMod.F90 index 88ae7c08cc..f1865af3b7 100644 --- a/src/biogeochem/VOCEmissionMod.F90 +++ b/src/biogeochem/VOCEmissionMod.F90 @@ -84,10 +84,15 @@ module VOCEmissionMod !------------------------------------------------------------------------ subroutine Init(this, bounds) + use clm_varctl , only : use_fates, use_fates_sp class(vocemis_type) :: this type(bounds_type), intent(in) :: bounds if ( shr_megan_mechcomps_n > 0) then + if ( use_fates .and. (.not. use_fates_sp) ) then + call endrun( msg='ERROR: MEGAN currently does NOT work with FATES outside of FATES-SP mode (see github issue #115)'//& + errMsg(sourcefile, __LINE__)) + end if call this%InitAllocate(bounds) call this%InitHistory(bounds) call this%InitCold(bounds) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 1d6101fdf4..b9a7bc7f36 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -221,10 +221,12 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! ============================================================================ ! Specified phenology + ! Done in SP mode, FATES-SP mode and also when dry-deposition is active ! ============================================================================ if (use_cn) then ! For dry-deposition need to call CLMSP so that mlaidiff is obtained + ! NOTE: This is also true of FATES below if ( n_drydep > 0 .and. drydep_method == DD_XLND ) then call t_startf('interpMonthlyVeg') call interpMonthlyVeg(bounds_proc, canopystate_inst) @@ -233,21 +235,26 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro elseif(use_fates) then - ! FATES does not use any leaf/stem/htop data unless in satphen mode - if ( use_fates_sp) then + ! For FATES-Specified phenology mode interpolate the weights for + ! time-interpolation of monthly vegetation data (as in SP mode below) + ! Also for FATES with dry-deposition as above need to call CLMSP so that mlaidiff is obtained + !if ( use_fates_sp .or. (n_drydep > 0 .and. drydep_method == DD_XLND ) ) then ! Replace with this when we have dry-deposition working + ! For now don't allow for dry-deposition because of issues in #1044 EBK Jun/17/2022 + if ( use_fates_sp ) then call t_startf('interpMonthlyVeg') call interpMonthlyVeg(bounds_proc, canopystate_inst) call t_stopf('interpMonthlyVeg') end if - + else - + ! Determine weights for time interpolation of monthly vegetation data. ! This also determines whether it is time to read new monthly vegetation and ! obtain updated leaf area index [mlai1,mlai2], stem area index [msai1,msai2], ! vegetation top [mhvt1,mhvt2] and vegetation bottom [mhvb1,mhvb2]. The ! weights obtained here are used in subroutine SatellitePhenology to obtain time ! interpolated values. + ! This is also done for FATES-SP mode above if ( doalb .or. ( n_drydep > 0 .and. drydep_method == DD_XLND ) )then call t_startf('interpMonthlyVeg') call interpMonthlyVeg(bounds_proc, canopystate_inst) @@ -256,7 +263,6 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro end if - ! ================================================================================== ! Determine decomp vertical profiles ! diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 83bcf09b2e..44ac50b27c 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -41,7 +41,7 @@ module clm_initializeMod integer :: actual_numcft ! numcft from sfc dataset integer :: actual_numpft ! numpft from sfc dataset - + !----------------------------------------------------------------------- contains !----------------------------------------------------------------------- @@ -105,7 +105,7 @@ subroutine initialize1(dtime) if(use_fates) then call CLMFatesGlobals1(actual_numpft, actual_numcft, actual_maxsoil_patches) end if - + call clm_varpar_init(actual_maxsoil_patches, actual_numpft, actual_numcft) call decomp_cascade_par_init( NLFilename ) call clm_varcon_init( IsSimpleBuildTemp() ) @@ -127,6 +127,7 @@ subroutine initialize2(ni,nj) ! !USES: use clm_varcon , only : spval use clm_varpar , only : natpft_lb, natpft_ub, cft_lb, cft_ub, maxpatch_glc + use clm_varpar , only : surfpft_lb, surfpft_ub use clm_varpar , only : nlevsno use clm_varpar , only : natpft_size,cft_size use clm_varctl , only : fsurdat @@ -250,9 +251,9 @@ subroutine initialize2(ni,nj) ! to allocate space) ! This also sets up various global constants in FATES ! ------------------------------------------------------------------------ - + call CLMFatesGlobals2() - + end if ! Determine decomposition of subgrid scale landunits, columns, patches @@ -431,6 +432,7 @@ subroutine initialize2(ni,nj) if (n_drydep > 0 .and. drydep_method == DD_XLND) then ! Must do this also when drydeposition is used so that estimates of monthly ! differences in LAI can be computed + ! Also do this for FATES see below call SatellitePhenologyInit(bounds_proc) end if if ( use_c14 .and. use_c14_bombspike ) then @@ -439,10 +441,14 @@ subroutine initialize2(ni,nj) if ( use_c13 .and. use_c13_timeseries ) then call C13_init_TimeSeries() end if - + else ! FATES OR Satellite phenology - - if(use_fates_sp .or. .not.use_fates)then + + ! For SP FATES-SP Initialize SP + ! Also for FATES with Dry-Deposition on as well (see above) + !if(use_fates_sp .or. (.not.use_cn) .or. (n_drydep > 0 .and. drydep_method == DD_XLND) )then ! Replace with this when we have dry-deposition working + ! For now don't allow for dry-deposition because of issues in #1044 EBK Jun/17/2022 + if( use_fates_sp .or. .not. use_fates )then call SatellitePhenologyInit(bounds_proc) end if @@ -607,21 +613,19 @@ subroutine initialize2(ni,nj) end if ! Read monthly vegetation - ! Even if CN is on, and dry-deposition is active, read CLMSP annual vegetation + ! Even if CN or FATES is on, and dry-deposition is active, read CLMSP annual vegetation ! to get estimates of monthly LAI - if ( n_drydep > 0 .and. drydep_method == DD_XLND .and. .not.use_fates )then + if ( n_drydep > 0 .and. drydep_method == DD_XLND )then call readAnnualVegetation(bounds_proc, canopystate_inst) - if (nsrest == nsrStartup .and. finidat /= ' ') then - ! Call interpMonthlyVeg for dry-deposition so that mlaidiff will be calculated - ! This needs to be done even if CN or CNDV is on! - call interpMonthlyVeg(bounds_proc, canopystate_inst) - end if + ! Call interpMonthlyVeg for dry-deposition so that mlaidiff will be calculated + ! This needs to be done even if FATES, CN or CNDV is on! + call interpMonthlyVeg(bounds_proc, canopystate_inst) ! If fates has satellite phenology enabled, get the monthly veg values ! prior to the first call to SatellitePhenology() elseif ( use_fates_sp ) then call interpMonthlyVeg(bounds_proc, canopystate_inst) end if - + ! Determine gridcell averaged properties to send to atm if (nsrest == nsrStartup) then call t_startf('init_map2gc')